mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
Merge "Add logs for launcher user cache" into udc-dev am: 43c79d23b3
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/23523872 Change-Id: Ia1ce65ebd9380662f890a5b1ddc5039211a3d603 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import static android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURC
|
||||
import static com.android.launcher3.LauncherAppState.ACTION_FORCE_ROLOAD;
|
||||
import static com.android.launcher3.config.FeatureFlags.IS_STUDIO_BUILD;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.sDebugTracing;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.testLogD;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
@@ -295,7 +296,7 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi
|
||||
}
|
||||
|
||||
public void onBroadcastIntent(@NonNull final Intent intent) {
|
||||
if (DEBUG_RECEIVER) Log.d(TAG, "onReceive intent=" + intent);
|
||||
if (DEBUG_RECEIVER || sDebugTracing) Log.d(TAG, "onReceive intent=" + intent);
|
||||
final String action = intent.getAction();
|
||||
if (Intent.ACTION_LOCALE_CHANGED.equals(action)) {
|
||||
// If we have changed locale we need to clear out the labels in all apps/workspace.
|
||||
|
||||
@@ -24,6 +24,8 @@ import static com.android.launcher3.model.ModelUtils.filterCurrentWorkspaceItems
|
||||
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER;
|
||||
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_SAFEMODE;
|
||||
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_SUSPENDED;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.testLogD;
|
||||
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
|
||||
import static com.android.launcher3.util.PackageManagerHelper.hasShortcutsPermission;
|
||||
import static com.android.launcher3.util.PackageManagerHelper.isSystemApp;
|
||||
@@ -949,6 +951,7 @@ public class LoaderTask implements Runnable {
|
||||
}
|
||||
|
||||
private List<LauncherActivityInfo> loadAllApps() {
|
||||
testLogD(WORK_TAB_MISSING, "loadingAllApps");
|
||||
final List<UserHandle> profiles = mUserCache.getUserProfiles();
|
||||
List<LauncherActivityInfo> allActivityList = new ArrayList<>();
|
||||
// Clear the list of apps
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.android.launcher3.pm;
|
||||
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
|
||||
import static com.android.launcher3.testing.shared.TestProtocol.testLogD;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.UserHandle;
|
||||
@@ -56,6 +59,7 @@ public class UserCache {
|
||||
}
|
||||
|
||||
private void onUsersChanged(Intent intent) {
|
||||
testLogD(WORK_TAB_MISSING, "onUsersChanged intent: " + intent);
|
||||
enableAndResetCache();
|
||||
mUserChangeListeners.forEach(Runnable::run);
|
||||
}
|
||||
@@ -84,6 +88,7 @@ public class UserCache {
|
||||
List<UserHandle> users = mUserManager.getUserProfiles();
|
||||
if (users != null) {
|
||||
for (UserHandle user : users) {
|
||||
testLogD(WORK_TAB_MISSING, "caching user: " + user);
|
||||
long serial = mUserManager.getSerialNumberForUser(user);
|
||||
mUsers.put(serial, user);
|
||||
mUserToSerialMap.put(user, serial);
|
||||
@@ -134,13 +139,24 @@ public class UserCache {
|
||||
* @see UserManager#getUserProfiles()
|
||||
*/
|
||||
public List<UserHandle> getUserProfiles() {
|
||||
StringBuilder usersToReturn = new StringBuilder();
|
||||
synchronized (this) {
|
||||
if (mUsers != null) {
|
||||
for (UserHandle u : mUserToSerialMap.keySet()) {
|
||||
usersToReturn.append(u).append(" && ");
|
||||
}
|
||||
testLogD(WORK_TAB_MISSING, "users from cache: " + usersToReturn);
|
||||
return new ArrayList<>(mUserToSerialMap.keySet());
|
||||
} else {
|
||||
testLogD(WORK_TAB_MISSING, "users from cache null");
|
||||
}
|
||||
}
|
||||
|
||||
List<UserHandle> users = mUserManager.getUserProfiles();
|
||||
for (UserHandle u : users) {
|
||||
usersToReturn.append(u).append(" && ");
|
||||
}
|
||||
testLogD(WORK_TAB_MISSING, "users from userManager: " + usersToReturn);
|
||||
return users == null ? Collections.emptyList() : users;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.launcher3.util;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
@@ -26,7 +25,6 @@ import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.shortcuts.ShortcutKey;
|
||||
import com.android.launcher3.testing.shared.TestProtocol;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -44,14 +42,7 @@ public abstract class ItemInfoMatcher {
|
||||
private static final ComponentName EMPTY_COMPONENT = new ComponentName("", "");
|
||||
|
||||
public static Predicate<ItemInfo> ofUser(UserHandle user) {
|
||||
return info -> {
|
||||
if (TestProtocol.sDebugTracing) {
|
||||
Log.d(TestProtocol.WORK_TAB_MISSING, "userHandle: " + user
|
||||
+ ", itemUserHandle: " + info.user
|
||||
+ " package: " + info.getTargetPackage());
|
||||
}
|
||||
return info != null && info.user.equals(user);
|
||||
};
|
||||
return info -> info != null && info.user.equals(user);
|
||||
}
|
||||
|
||||
public static Predicate<ItemInfo> ofComponents(
|
||||
|
||||
Reference in New Issue
Block a user