Fixing model being updated on UI thread
> When package gets unavailable or suspended, the disabled flag was getting updated on the UI thread. This could lead to inconsistent model if launcher activity didn't exist. > Fixing: When unsuspending one work profile apps, all work profile apps get unsuspended Bug: 27673573,27673373,27403236 Change-Id: I7fde3f79c36204e73ca66ccf8431fa0f0cce3d08
This commit is contained in:
@@ -3922,41 +3922,10 @@ public class Workspace extends PagedView
|
||||
});
|
||||
}
|
||||
|
||||
public void disableShortcutsByPackageName(final ArrayList<String> packages,
|
||||
final UserHandleCompat user, final int reason) {
|
||||
final HashSet<String> packageNames = new HashSet<String>();
|
||||
packageNames.addAll(packages);
|
||||
|
||||
mapOverItems(MAP_RECURSE, new ItemOperator() {
|
||||
@Override
|
||||
public boolean evaluate(ItemInfo info, View v, View parent) {
|
||||
if (info instanceof ShortcutInfo && v instanceof BubbleTextView) {
|
||||
ShortcutInfo shortcutInfo = (ShortcutInfo) info;
|
||||
ComponentName cn = shortcutInfo.getTargetComponent();
|
||||
if (user.equals(shortcutInfo.user) && cn != null
|
||||
&& packageNames.contains(cn.getPackageName())) {
|
||||
shortcutInfo.isDisabled |= reason;
|
||||
BubbleTextView shortcut = (BubbleTextView) v;
|
||||
shortcut.applyFromShortcutInfo(shortcutInfo, mIconCache);
|
||||
|
||||
if (parent != null) {
|
||||
parent.invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
// process all the shortcuts
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Removes ALL items that match a given package name, this is usually called when a package
|
||||
// has been removed and we want to remove all components (widgets, shortcuts, apps) that
|
||||
// belong to that package.
|
||||
void removeItemsByPackageName(final ArrayList<String> packages, final UserHandleCompat user) {
|
||||
final HashSet<String> packageNames = new HashSet<String>();
|
||||
packageNames.addAll(packages);
|
||||
|
||||
void removeItemsByPackageName(final HashSet<String> packageNames, final UserHandleCompat user) {
|
||||
// Filter out all the ItemInfos that this is going to affect
|
||||
final HashSet<ItemInfo> infos = new HashSet<ItemInfo>();
|
||||
final HashSet<ComponentName> cns = new HashSet<ComponentName>();
|
||||
@@ -4138,7 +4107,7 @@ public class Workspace extends PagedView
|
||||
}
|
||||
|
||||
public void removeAbandonedPromise(String packageName, UserHandleCompat user) {
|
||||
ArrayList<String> packages = new ArrayList<String>(1);
|
||||
HashSet<String> packages = new HashSet<>(1);
|
||||
packages.add(packageName);
|
||||
LauncherModel.deletePackageFromDatabase(mLauncher, packageName, user);
|
||||
removeItemsByPackageName(packages, user);
|
||||
|
||||
Reference in New Issue
Block a user