Merge "Add UID in AppInfo." into udc-dev am: 9b4f62e681
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23331302 Change-Id: I137a76795862d56c5186c7f8fb6a84a5850739cc Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
eb9cd7e26e
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.util.SparseArray;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.UiThread;
|
||||||
|
|
||||||
import com.android.launcher3.LauncherSettings.Favorites;
|
import com.android.launcher3.LauncherSettings.Favorites;
|
||||||
import com.android.launcher3.model.BgDataModel;
|
import com.android.launcher3.model.BgDataModel;
|
||||||
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
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.IntSet;
|
||||||
import com.android.launcher3.util.ItemInfoMatcher;
|
import com.android.launcher3.util.ItemInfoMatcher;
|
||||||
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
import com.android.launcher3.util.LauncherBindableItemsContainer;
|
||||||
|
import com.android.launcher3.util.PackageUserKey;
|
||||||
|
import com.android.launcher3.util.Preconditions;
|
||||||
import com.android.quickstep.RecentsModel;
|
import com.android.quickstep.RecentsModel;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@@ -37,6 +41,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -250,9 +255,12 @@ public class TaskbarModelCallbacks implements
|
|||||||
mControllers.taskbarPopupController.setDeepShortcutMap(deepShortcutMapCopy);
|
mControllers.taskbarPopupController.setDeepShortcutMap(deepShortcutMapCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UiThread
|
||||||
@Override
|
@Override
|
||||||
public void bindAllApplications(AppInfo[] apps, int flags) {
|
public void bindAllApplications(AppInfo[] apps, int flags,
|
||||||
mControllers.taskbarAllAppsController.setApps(apps, flags);
|
Map<PackageUserKey, Integer> packageUserKeytoUidMap) {
|
||||||
|
Preconditions.assertUIThread();
|
||||||
|
mControllers.taskbarAllAppsController.setApps(apps, flags, packageUserKeytoUidMap);
|
||||||
mControllers.taskbarRecentAppsController.setApps(apps);
|
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.taskbar.overlay.TaskbarOverlayContext;
|
||||||
import com.android.launcher3.util.PackageUserKey;
|
import com.android.launcher3.util.PackageUserKey;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -53,6 +55,8 @@ public final class TaskbarAllAppsController {
|
|||||||
private boolean mDisallowGlobalDrag;
|
private boolean mDisallowGlobalDrag;
|
||||||
private boolean mDisallowLongClick;
|
private boolean mDisallowLongClick;
|
||||||
|
|
||||||
|
private Map<PackageUserKey, Integer> mPackageUserKeytoUidMap = Collections.emptyMap();
|
||||||
|
|
||||||
/** Initialize the controller. */
|
/** Initialize the controller. */
|
||||||
public void init(TaskbarControllers controllers, boolean allAppsVisible) {
|
public void init(TaskbarControllers controllers, boolean allAppsVisible) {
|
||||||
mControllers = controllers;
|
mControllers = controllers;
|
||||||
@@ -67,11 +71,12 @@ public final class TaskbarAllAppsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Updates the current {@link AppInfo} instances. */
|
/** 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;
|
mApps = apps;
|
||||||
mAppsModelFlags = flags;
|
mAppsModelFlags = flags;
|
||||||
|
mPackageUserKeytoUidMap = map;
|
||||||
if (mAppsView != null) {
|
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);
|
viewController.show(animate);
|
||||||
mAppsView = overlayContext.getAppsView();
|
mAppsView = overlayContext.getAppsView();
|
||||||
mAppsView.getAppsStore().setApps(mApps, mAppsModelFlags);
|
mAppsView.getAppsStore().setApps(mApps, mAppsModelFlags, mPackageUserKeytoUidMap);
|
||||||
mAppsView.getFloatingHeaderView()
|
mAppsView.getFloatingHeaderView()
|
||||||
.findFixedRowByType(PredictionRowView.class)
|
.findFixedRowByType(PredictionRowView.class)
|
||||||
.setPredictedApps(mPredictedApps);
|
.setPredictedApps(mPredictedApps);
|
||||||
|
|||||||
@@ -566,9 +566,10 @@ public class StatsLogCompatManager extends StatsLogManager {
|
|||||||
* Helps to construct and log statsd compatible impression events.
|
* Helps to construct and log statsd compatible impression events.
|
||||||
*/
|
*/
|
||||||
private static class StatsCompatImpressionLogger implements StatsImpressionLogger {
|
private static class StatsCompatImpressionLogger implements StatsImpressionLogger {
|
||||||
private final IntArray mResultTypeList = new IntArray();
|
private int[] mResultTypeList = new int[]{};
|
||||||
private final IntArray mResultCountList = new IntArray();
|
private int[] mResultCountList = new int[]{};
|
||||||
private final List<Boolean> mAboveKeyboardList = new ArrayList<>();
|
private final List<Boolean> mAboveKeyboardList = new ArrayList<>();
|
||||||
|
private int[] mUidList = new int[]{};
|
||||||
private InstanceId mInstanceId = DEFAULT_INSTANCE_ID;
|
private InstanceId mInstanceId = DEFAULT_INSTANCE_ID;
|
||||||
private State mLauncherState = State.UNKNOWN;
|
private State mLauncherState = State.UNKNOWN;
|
||||||
private int mQueryLength = -1;
|
private int mQueryLength = -1;
|
||||||
@@ -593,28 +594,32 @@ public class StatsLogCompatManager extends StatsLogManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StatsImpressionLogger withResultType(IntArray resultType) {
|
public StatsImpressionLogger withResultType(IntArray resultType) {
|
||||||
this.mResultTypeList.clear();
|
mResultTypeList = resultType.toArray();
|
||||||
this.mResultTypeList.addAll(resultType);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StatsImpressionLogger withResultCount(IntArray resultCount) {
|
public StatsImpressionLogger withResultCount(IntArray resultCount) {
|
||||||
this.mResultCountList.clear();
|
mResultCountList = resultCount.toArray();
|
||||||
this.mResultCountList.addAll(resultCount);
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StatsImpressionLogger withAboveKeyboard(List<Boolean> aboveKeyboard) {
|
public StatsImpressionLogger withAboveKeyboard(List<Boolean> aboveKeyboard) {
|
||||||
this.mAboveKeyboardList.clear();
|
mAboveKeyboardList.clear();
|
||||||
this.mAboveKeyboardList.addAll(aboveKeyboard);
|
this.mAboveKeyboardList.addAll(aboveKeyboard);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StatsImpressionLogger withUids(IntArray uid) {
|
||||||
|
mUidList = uid.toArray();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void log(EventEnum event) {
|
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++) {
|
for (int i = 0; i < mAboveKeyboardList.size(); i++) {
|
||||||
mAboveKeyboard[i] = mAboveKeyboardList.get(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("ImpressionEvent:%s ", name));
|
||||||
logStringBuilder.append(String.format("LauncherState = %s ", mLauncherState));
|
logStringBuilder.append(String.format("LauncherState = %s ", mLauncherState));
|
||||||
logStringBuilder.append(String.format("QueryLength = %s ", mQueryLength));
|
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(
|
logStringBuilder.append(String.format(
|
||||||
"\n ResultType = %s with ResultCount = %s with is_above_keyboard = %s",
|
"\n ResultType = %s with ResultCount = %s with is_above_keyboard = %s"
|
||||||
mResultTypeList.get(i), mResultCountList.get(i),
|
+ " with uid = %s",
|
||||||
mAboveKeyboard[i]));
|
mResultTypeList[i], mResultCountList[i],
|
||||||
|
mAboveKeyboard[i], mUidList[i]));
|
||||||
}
|
}
|
||||||
Log.d(IMPRESSION_TAG, logStringBuilder.toString());
|
Log.d(IMPRESSION_TAG, logStringBuilder.toString());
|
||||||
}
|
}
|
||||||
@@ -643,11 +649,13 @@ public class StatsLogCompatManager extends StatsLogManager {
|
|||||||
mLauncherState.getLauncherState(), // state
|
mLauncherState.getLauncherState(), // state
|
||||||
mQueryLength, // query_length
|
mQueryLength, // query_length
|
||||||
//result type list
|
//result type list
|
||||||
mResultTypeList.toArray(),
|
mResultTypeList,
|
||||||
// result count list
|
// result count list
|
||||||
mResultCountList.toArray(),
|
mResultCountList,
|
||||||
// above keyboard list
|
// above keyboard list
|
||||||
mAboveKeyboard
|
mAboveKeyboard,
|
||||||
|
// uid list
|
||||||
|
mUidList
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
|
import androidx.annotation.UiThread;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import com.android.launcher3.DropTarget.DragObject;
|
import com.android.launcher3.DropTarget.DragObject;
|
||||||
@@ -205,6 +206,7 @@ import com.android.launcher3.util.LockedUserState;
|
|||||||
import com.android.launcher3.util.OnboardingPrefs;
|
import com.android.launcher3.util.OnboardingPrefs;
|
||||||
import com.android.launcher3.util.PackageUserKey;
|
import com.android.launcher3.util.PackageUserKey;
|
||||||
import com.android.launcher3.util.PendingRequestArgs;
|
import com.android.launcher3.util.PendingRequestArgs;
|
||||||
|
import com.android.launcher3.util.Preconditions;
|
||||||
import com.android.launcher3.util.RunnableList;
|
import com.android.launcher3.util.RunnableList;
|
||||||
import com.android.launcher3.util.SafeCloseable;
|
import com.android.launcher3.util.SafeCloseable;
|
||||||
import com.android.launcher3.util.ScreenOnTracker;
|
import com.android.launcher3.util.ScreenOnTracker;
|
||||||
@@ -246,6 +248,7 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
@@ -2971,8 +2974,12 @@ public class Launcher extends StatefulActivity<LauncherState>
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@TargetApi(Build.VERSION_CODES.S)
|
@TargetApi(Build.VERSION_CODES.S)
|
||||||
public void bindAllApplications(AppInfo[] apps, int flags) {
|
@UiThread
|
||||||
mAppsView.getAppsStore().setApps(apps, flags);
|
public void bindAllApplications(AppInfo[] apps, int flags,
|
||||||
|
Map<PackageUserKey, Integer> packageUserKeytoUidMap) {
|
||||||
|
Preconditions.assertUIThread();
|
||||||
|
AllAppsStore appsStore = mAppsView.getAppsStore();
|
||||||
|
appsStore.setApps(apps, flags, packageUserKeytoUidMap);
|
||||||
PopupContainerWithArrow.dismissInvalidPopup(this);
|
PopupContainerWithArrow.dismissInvalidPopup(this);
|
||||||
if (Utilities.ATLEAST_S) {
|
if (Utilities.ATLEAST_S) {
|
||||||
Trace.endAsyncSection(DISPLAY_ALL_APPS_TRACE_METHOD_NAME,
|
Trace.endAsyncSection(DISPLAY_ALL_APPS_TRACE_METHOD_NAME,
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import static com.android.launcher3.model.data.AppInfo.EMPTY_ARRAY;
|
|||||||
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK;
|
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK;
|
||||||
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
|
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
|
||||||
|
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -35,7 +36,9 @@ import com.android.launcher3.util.PackageUserKey;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
@@ -57,8 +60,8 @@ public class AllAppsStore {
|
|||||||
|
|
||||||
private final List<OnUpdateListener> mUpdateListeners = new CopyOnWriteArrayList<>();
|
private final List<OnUpdateListener> mUpdateListeners = new CopyOnWriteArrayList<>();
|
||||||
private final ArrayList<ViewGroup> mIconContainers = new ArrayList<>();
|
private final ArrayList<ViewGroup> mIconContainers = new ArrayList<>();
|
||||||
|
private Map<PackageUserKey, Integer> mPackageUserKeytoUidMap = Collections.emptyMap();
|
||||||
private int mModelFlags;
|
private int mModelFlags;
|
||||||
|
|
||||||
private int mDeferUpdatesFlags = 0;
|
private int mDeferUpdatesFlags = 0;
|
||||||
private boolean mUpdatePending = false;
|
private boolean mUpdatePending = false;
|
||||||
|
|
||||||
@@ -67,12 +70,21 @@ public class AllAppsStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current set of apps.
|
* Sets the current set of apps and sets mapping for {@link PackageUserKey} to Uid for
|
||||||
|
* the current set of apps.
|
||||||
*/
|
*/
|
||||||
public void setApps(AppInfo[] apps, int flags) {
|
public void setApps(AppInfo[] apps, int flags, Map<PackageUserKey, Integer> map) {
|
||||||
mApps = apps;
|
mApps = apps;
|
||||||
mModelFlags = flags;
|
mModelFlags = flags;
|
||||||
notifyUpdate();
|
notifyUpdate();
|
||||||
|
mPackageUserKeytoUidMap = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Look up for Uid using package name and user handle for the current set of apps.
|
||||||
|
*/
|
||||||
|
public int lookUpForUid(String packageName, UserHandle user) {
|
||||||
|
return mPackageUserKeytoUidMap.getOrDefault(new PackageUserKey(packageName, user), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -978,6 +978,14 @@ public class StatsLogManager implements ResourceBasedOverride {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets list of uid for each of {@link com.android.app.search.ResultType} that indicates
|
||||||
|
* package name for the impression event.
|
||||||
|
*/
|
||||||
|
default StatsImpressionLogger withUids(IntArray uid) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the final message and logs it as {@link EventEnum}.
|
* Builds the final message and logs it as {@link EventEnum}.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
|||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.WorkerThread;
|
||||||
|
|
||||||
import com.android.launcher3.InvariantDeviceProfile;
|
import com.android.launcher3.InvariantDeviceProfile;
|
||||||
import com.android.launcher3.LauncherAppState;
|
import com.android.launcher3.LauncherAppState;
|
||||||
import com.android.launcher3.LauncherModel.CallbackTask;
|
import com.android.launcher3.LauncherModel.CallbackTask;
|
||||||
@@ -39,15 +41,20 @@ import com.android.launcher3.util.IntArray;
|
|||||||
import com.android.launcher3.util.IntSet;
|
import com.android.launcher3.util.IntSet;
|
||||||
import com.android.launcher3.util.LooperExecutor;
|
import com.android.launcher3.util.LooperExecutor;
|
||||||
import com.android.launcher3.util.LooperIdleLock;
|
import com.android.launcher3.util.LooperIdleLock;
|
||||||
|
import com.android.launcher3.util.PackageUserKey;
|
||||||
|
import com.android.launcher3.util.Preconditions;
|
||||||
import com.android.launcher3.util.RunnableList;
|
import com.android.launcher3.util.RunnableList;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds the results of {@link com.android.launcher3.model.LoaderTask} to the Callbacks objects.
|
* Binds the results of {@link com.android.launcher3.model.LoaderTask} to the Callbacks objects.
|
||||||
@@ -143,11 +150,18 @@ public abstract class BaseLauncherBinder {
|
|||||||
/**
|
/**
|
||||||
* Binds the all apps results from LoaderTask to the callbacks UX.
|
* Binds the all apps results from LoaderTask to the callbacks UX.
|
||||||
*/
|
*/
|
||||||
|
@WorkerThread
|
||||||
public void bindAllApps() {
|
public void bindAllApps() {
|
||||||
|
Preconditions.assertWorkerThread();
|
||||||
// shallow copy
|
// shallow copy
|
||||||
AppInfo[] apps = mBgAllAppsList.copyData();
|
AppInfo[] apps = mBgAllAppsList.copyData();
|
||||||
int flags = mBgAllAppsList.getFlags();
|
int flags = mBgAllAppsList.getFlags();
|
||||||
executeCallbacksTask(c -> c.bindAllApplications(apps, flags), mUiExecutor);
|
Map<PackageUserKey, Integer> packageUserKeytoUidMap = Arrays.stream(apps).collect(
|
||||||
|
Collectors.toMap(
|
||||||
|
appInfo -> new PackageUserKey(appInfo.componentName.getPackageName(),
|
||||||
|
appInfo.user), appInfo -> appInfo.uid, (a, b) -> a));
|
||||||
|
executeCallbacksTask(c -> c.bindAllApplications(apps, flags, packageUserKeytoUidMap),
|
||||||
|
mUiExecutor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import android.util.Log;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.WorkerThread;
|
||||||
|
|
||||||
import com.android.launcher3.LauncherAppState;
|
import com.android.launcher3.LauncherAppState;
|
||||||
import com.android.launcher3.LauncherModel;
|
import com.android.launcher3.LauncherModel;
|
||||||
@@ -35,11 +36,15 @@ import com.android.launcher3.model.data.ItemInfo;
|
|||||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||||
import com.android.launcher3.testing.shared.TestProtocol;
|
import com.android.launcher3.testing.shared.TestProtocol;
|
||||||
import com.android.launcher3.util.ComponentKey;
|
import com.android.launcher3.util.ComponentKey;
|
||||||
|
import com.android.launcher3.util.PackageUserKey;
|
||||||
|
import com.android.launcher3.util.Preconditions;
|
||||||
import com.android.launcher3.widget.model.WidgetsListBaseEntry;
|
import com.android.launcher3.widget.model.WidgetsListBaseEntry;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
@@ -153,7 +158,9 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask {
|
|||||||
scheduleCallbackTask(c -> c.bindWorkspaceComponentsRemoved(matcher));
|
scheduleCallbackTask(c -> c.bindWorkspaceComponentsRemoved(matcher));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@WorkerThread
|
||||||
public void bindApplicationsIfNeeded() {
|
public void bindApplicationsIfNeeded() {
|
||||||
|
Preconditions.assertWorkerThread();
|
||||||
boolean changeFlag = mAllAppsList.getAndResetChangeFlag();
|
boolean changeFlag = mAllAppsList.getAndResetChangeFlag();
|
||||||
if (TestProtocol.sDebugTracing) {
|
if (TestProtocol.sDebugTracing) {
|
||||||
Log.d(WORK_TAB_MISSING, "bindApplicationsIfNeeded changeFlag? " +
|
Log.d(WORK_TAB_MISSING, "bindApplicationsIfNeeded changeFlag? " +
|
||||||
@@ -162,7 +169,11 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask {
|
|||||||
if (changeFlag) {
|
if (changeFlag) {
|
||||||
AppInfo[] apps = mAllAppsList.copyData();
|
AppInfo[] apps = mAllAppsList.copyData();
|
||||||
int flags = mAllAppsList.getFlags();
|
int flags = mAllAppsList.getFlags();
|
||||||
scheduleCallbackTask(c -> c.bindAllApplications(apps, flags));
|
Map<PackageUserKey, Integer> packageUserKeytoUidMap = Arrays.stream(apps).collect(
|
||||||
|
Collectors.toMap(
|
||||||
|
appInfo -> new PackageUserKey(appInfo.componentName.getPackageName(),
|
||||||
|
appInfo.user), appInfo -> appInfo.uid, (a, b) -> a));
|
||||||
|
scheduleCallbackTask(c -> c.bindAllApplications(apps, flags, packageUserKeytoUidMap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -51,6 +51,7 @@ import com.android.launcher3.util.ComponentKey;
|
|||||||
import com.android.launcher3.util.IntArray;
|
import com.android.launcher3.util.IntArray;
|
||||||
import com.android.launcher3.util.IntSet;
|
import com.android.launcher3.util.IntSet;
|
||||||
import com.android.launcher3.util.IntSparseArrayMap;
|
import com.android.launcher3.util.IntSparseArrayMap;
|
||||||
|
import com.android.launcher3.util.PackageUserKey;
|
||||||
import com.android.launcher3.util.RunnableList;
|
import com.android.launcher3.util.RunnableList;
|
||||||
import com.android.launcher3.widget.model.WidgetsListBaseEntry;
|
import com.android.launcher3.widget.model.WidgetsListBaseEntry;
|
||||||
|
|
||||||
@@ -497,7 +498,9 @@ public class BgDataModel {
|
|||||||
*/
|
*/
|
||||||
default void bindExtraContainerItems(FixedContainerItems item) { }
|
default void bindExtraContainerItems(FixedContainerItems item) { }
|
||||||
|
|
||||||
default void bindAllApplications(AppInfo[] apps, int flags) { }
|
default void bindAllApplications(AppInfo[] apps, int flags,
|
||||||
|
Map<PackageUserKey, Integer> packageUserKeytoUidMap) {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds the cache of string resources
|
* Binds the cache of string resources
|
||||||
|
|||||||
@@ -61,6 +61,13 @@ public class AppInfo extends ItemInfoWithIcon implements WorkspaceItemFactory {
|
|||||||
// Section name used for indexing.
|
// Section name used for indexing.
|
||||||
public String sectionName = "";
|
public String sectionName = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The uid of the application.
|
||||||
|
* The kernel user-ID that has been assigned to this application. Currently this is not a unique
|
||||||
|
* ID (multiple applications can have the same uid).
|
||||||
|
*/
|
||||||
|
public int uid = -1;
|
||||||
|
|
||||||
public AppInfo() {
|
public AppInfo() {
|
||||||
itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
|
itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
|
||||||
}
|
}
|
||||||
@@ -87,6 +94,7 @@ public class AppInfo extends ItemInfoWithIcon implements WorkspaceItemFactory {
|
|||||||
if (quietModeEnabled) {
|
if (quietModeEnabled) {
|
||||||
runtimeStatusFlags |= FLAG_DISABLED_QUIET_USER;
|
runtimeStatusFlags |= FLAG_DISABLED_QUIET_USER;
|
||||||
}
|
}
|
||||||
|
uid = info.getApplicationInfo().uid;
|
||||||
updateRuntimeFlagsForActivityTarget(this, info);
|
updateRuntimeFlagsForActivityTarget(this, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,6 +103,7 @@ public class AppInfo extends ItemInfoWithIcon implements WorkspaceItemFactory {
|
|||||||
componentName = info.componentName;
|
componentName = info.componentName;
|
||||||
title = Utilities.trim(info.title);
|
title = Utilities.trim(info.title);
|
||||||
intent = new Intent(info.intent);
|
intent = new Intent(info.intent);
|
||||||
|
uid = info.uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import android.view.View.OnClickListener;
|
|||||||
import android.view.ViewAnimationUtils;
|
import android.view.ViewAnimationUtils;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
|
import androidx.annotation.UiThread;
|
||||||
|
|
||||||
import com.android.launcher3.AbstractFloatingView;
|
import com.android.launcher3.AbstractFloatingView;
|
||||||
import com.android.launcher3.BaseDraggingActivity;
|
import com.android.launcher3.BaseDraggingActivity;
|
||||||
import com.android.launcher3.BubbleTextView;
|
import com.android.launcher3.BubbleTextView;
|
||||||
@@ -38,6 +40,7 @@ import com.android.launcher3.LauncherPrefs;
|
|||||||
import com.android.launcher3.LauncherSettings;
|
import com.android.launcher3.LauncherSettings;
|
||||||
import com.android.launcher3.R;
|
import com.android.launcher3.R;
|
||||||
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
|
import com.android.launcher3.allapps.ActivityAllAppsContainerView;
|
||||||
|
import com.android.launcher3.allapps.AllAppsStore;
|
||||||
import com.android.launcher3.dragndrop.DragController;
|
import com.android.launcher3.dragndrop.DragController;
|
||||||
import com.android.launcher3.dragndrop.DragOptions;
|
import com.android.launcher3.dragndrop.DragOptions;
|
||||||
import com.android.launcher3.dragndrop.DraggableView;
|
import com.android.launcher3.dragndrop.DraggableView;
|
||||||
@@ -54,10 +57,13 @@ import com.android.launcher3.touch.ItemClickHandler.ItemClickProxy;
|
|||||||
import com.android.launcher3.util.ComponentKey;
|
import com.android.launcher3.util.ComponentKey;
|
||||||
import com.android.launcher3.util.IntSet;
|
import com.android.launcher3.util.IntSet;
|
||||||
import com.android.launcher3.util.OnboardingPrefs;
|
import com.android.launcher3.util.OnboardingPrefs;
|
||||||
|
import com.android.launcher3.util.PackageUserKey;
|
||||||
|
import com.android.launcher3.util.Preconditions;
|
||||||
import com.android.launcher3.util.Themes;
|
import com.android.launcher3.util.Themes;
|
||||||
import com.android.launcher3.views.BaseDragLayer;
|
import com.android.launcher3.views.BaseDragLayer;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launcher activity for secondary displays
|
* Launcher activity for secondary displays
|
||||||
@@ -291,9 +297,13 @@ public class SecondaryDisplayLauncher extends BaseDraggingActivity
|
|||||||
mPopupDataProvider.setDeepShortcutMap(deepShortcutMap);
|
mPopupDataProvider.setDeepShortcutMap(deepShortcutMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UiThread
|
||||||
@Override
|
@Override
|
||||||
public void bindAllApplications(AppInfo[] apps, int flags) {
|
public void bindAllApplications(AppInfo[] apps, int flags,
|
||||||
mAppsView.getAppsStore().setApps(apps, flags);
|
Map<PackageUserKey, Integer> packageUserKeytoUidMap) {
|
||||||
|
Preconditions.assertUIThread();
|
||||||
|
AllAppsStore appsStore = mAppsView.getAppsStore();
|
||||||
|
appsStore.setApps(apps, flags, packageUserKeytoUidMap);
|
||||||
PopupContainerWithArrow.dismissInvalidPopup(this);
|
PopupContainerWithArrow.dismissInvalidPopup(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.android.launcher3.util.IntArray;
|
|||||||
import com.android.launcher3.util.IntSet;
|
import com.android.launcher3.util.IntSet;
|
||||||
import com.android.launcher3.util.LauncherLayoutBuilder;
|
import com.android.launcher3.util.LauncherLayoutBuilder;
|
||||||
import com.android.launcher3.util.LauncherModelHelper;
|
import com.android.launcher3.util.LauncherModelHelper;
|
||||||
|
import com.android.launcher3.util.PackageUserKey;
|
||||||
import com.android.launcher3.util.RunnableList;
|
import com.android.launcher3.util.RunnableList;
|
||||||
import com.android.launcher3.util.TestUtil;
|
import com.android.launcher3.util.TestUtil;
|
||||||
|
|
||||||
@@ -48,6 +49,7 @@ import org.junit.runner.RunWith;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -192,7 +194,8 @@ public class ModelMultiCallbacksTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bindAllApplications(AppInfo[] apps, int flags) {
|
public void bindAllApplications(AppInfo[] apps, int flags,
|
||||||
|
Map<PackageUserKey, Integer> packageUserKeytoUidMap) {
|
||||||
mAppInfos = apps;
|
mAppInfos = apps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user