Merge "Add UID in AppInfo." into udc-dev
This commit is contained in:
commit
9b4f62e681
12 files changed
+129
-31
No files matched your search
@@ -18,6 +18,8 @@ package com.android.launcher3.taskbar;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.UiThread;
|
||||
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.model.BgDataModel;
|
||||
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
||||
@@ -29,6 +31,8 @@ import com.android.launcher3.util.IntArray;
|
||||
import com.android.launcher3.util.IntSet;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
import com.android.launcher3.util.Preconditions;
|
||||
import com.android.quickstep.RecentsModel;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
@@ -37,6 +41,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
@@ -250,9 +255,12 @@ public class TaskbarModelCallbacks implements
|
||||
mControllers.taskbarPopupController.setDeepShortcutMap(deepShortcutMapCopy);
|
||||
}
|
||||
|
||||
@UiThread
|
||||
@Override
|
||||
public void bindAllApplications(AppInfo[] apps, int flags) {
|
||||
mControllers.taskbarAllAppsController.setApps(apps, flags);
|
||||
public void bindAllApplications(AppInfo[] apps, int flags,
|
||||
Map<PackageUserKey, Integer> packageUserKeytoUidMap) {
|
||||
Preconditions.assertUIThread();
|
||||
mControllers.taskbarAllAppsController.setApps(apps, flags, packageUserKeytoUidMap);
|
||||
mControllers.taskbarRecentAppsController.setApps(apps);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,9 @@ import com.android.launcher3.taskbar.TaskbarControllers;
|
||||
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
@@ -53,6 +55,8 @@ public final class TaskbarAllAppsController {
|
||||
private boolean mDisallowGlobalDrag;
|
||||
private boolean mDisallowLongClick;
|
||||
|
||||
private Map<PackageUserKey, Integer> mPackageUserKeytoUidMap = Collections.emptyMap();
|
||||
|
||||
/** Initialize the controller. */
|
||||
public void init(TaskbarControllers controllers, boolean allAppsVisible) {
|
||||
mControllers = controllers;
|
||||
@@ -67,11 +71,12 @@ public final class TaskbarAllAppsController {
|
||||
}
|
||||
|
||||
/** Updates the current {@link AppInfo} instances. */
|
||||
public void setApps(AppInfo[] apps, int flags) {
|
||||
public void setApps(AppInfo[] apps, int flags, Map<PackageUserKey, Integer> map) {
|
||||
mApps = apps;
|
||||
mAppsModelFlags = flags;
|
||||
mPackageUserKeytoUidMap = map;
|
||||
if (mAppsView != null) {
|
||||
mAppsView.getAppsStore().setApps(mApps, mAppsModelFlags);
|
||||
mAppsView.getAppsStore().setApps(mApps, mAppsModelFlags, mPackageUserKeytoUidMap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +141,7 @@ public final class TaskbarAllAppsController {
|
||||
|
||||
viewController.show(animate);
|
||||
mAppsView = overlayContext.getAppsView();
|
||||
mAppsView.getAppsStore().setApps(mApps, mAppsModelFlags);
|
||||
mAppsView.getAppsStore().setApps(mApps, mAppsModelFlags, mPackageUserKeytoUidMap);
|
||||
mAppsView.getFloatingHeaderView()
|
||||
.findFixedRowByType(PredictionRowView.class)
|
||||
.setPredictedApps(mPredictedApps);
|
||||
|
||||
@@ -566,9 +566,10 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
* Helps to construct and log statsd compatible impression events.
|
||||
*/
|
||||
private static class StatsCompatImpressionLogger implements StatsImpressionLogger {
|
||||
private final IntArray mResultTypeList = new IntArray();
|
||||
private final IntArray mResultCountList = new IntArray();
|
||||
private int[] mResultTypeList = new int[]{};
|
||||
private int[] mResultCountList = new int[]{};
|
||||
private final List<Boolean> mAboveKeyboardList = new ArrayList<>();
|
||||
private int[] mUidList = new int[]{};
|
||||
private InstanceId mInstanceId = DEFAULT_INSTANCE_ID;
|
||||
private State mLauncherState = State.UNKNOWN;
|
||||
private int mQueryLength = -1;
|
||||
@@ -593,28 +594,32 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
|
||||
@Override
|
||||
public StatsImpressionLogger withResultType(IntArray resultType) {
|
||||
this.mResultTypeList.clear();
|
||||
this.mResultTypeList.addAll(resultType);
|
||||
mResultTypeList = resultType.toArray();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatsImpressionLogger withResultCount(IntArray resultCount) {
|
||||
this.mResultCountList.clear();
|
||||
this.mResultCountList.addAll(resultCount);
|
||||
mResultCountList = resultCount.toArray();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatsImpressionLogger withAboveKeyboard(List<Boolean> aboveKeyboard) {
|
||||
this.mAboveKeyboardList.clear();
|
||||
mAboveKeyboardList.clear();
|
||||
this.mAboveKeyboardList.addAll(aboveKeyboard);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatsImpressionLogger withUids(IntArray uid) {
|
||||
mUidList = uid.toArray();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(EventEnum event) {
|
||||
boolean [] mAboveKeyboard = new boolean[mAboveKeyboardList.size()];
|
||||
boolean[] mAboveKeyboard = new boolean[mAboveKeyboardList.size()];
|
||||
for (int i = 0; i < mAboveKeyboardList.size(); i++) {
|
||||
mAboveKeyboard[i] = mAboveKeyboardList.get(i);
|
||||
}
|
||||
@@ -626,11 +631,12 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
logStringBuilder.append(String.format("ImpressionEvent:%s ", name));
|
||||
logStringBuilder.append(String.format("LauncherState = %s ", mLauncherState));
|
||||
logStringBuilder.append(String.format("QueryLength = %s ", mQueryLength));
|
||||
for (int i = 0; i < mResultTypeList.size(); i++) {
|
||||
for (int i = 0; i < mResultTypeList.length; i++) {
|
||||
logStringBuilder.append(String.format(
|
||||
"\n ResultType = %s with ResultCount = %s with is_above_keyboard = %s",
|
||||
mResultTypeList.get(i), mResultCountList.get(i),
|
||||
mAboveKeyboard[i]));
|
||||
"\n ResultType = %s with ResultCount = %s with is_above_keyboard = %s"
|
||||
+ " with uid = %s",
|
||||
mResultTypeList[i], mResultCountList[i],
|
||||
mAboveKeyboard[i], mUidList[i]));
|
||||
}
|
||||
Log.d(IMPRESSION_TAG, logStringBuilder.toString());
|
||||
}
|
||||
@@ -643,11 +649,13 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
mLauncherState.getLauncherState(), // state
|
||||
mQueryLength, // query_length
|
||||
//result type list
|
||||
mResultTypeList.toArray(),
|
||||
mResultTypeList,
|
||||
// result count list
|
||||
mResultCountList.toArray(),
|
||||
mResultCountList,
|
||||
// above keyboard list
|
||||
mAboveKeyboard
|
||||
mAboveKeyboard,
|
||||
// uid list
|
||||
mUidList
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user