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:
1 parent
b8f00da8de
commit
3bbbabc54a
7 files changed
+125
-116
No files matched your search
@@ -22,6 +22,7 @@ import android.content.Context;
|
||||
import com.android.launcher3.compat.LauncherActivityInfoCompat;
|
||||
import com.android.launcher3.compat.LauncherAppsCompat;
|
||||
import com.android.launcher3.compat.UserHandleCompat;
|
||||
import com.android.launcher3.util.FlagOp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@@ -119,19 +120,15 @@ class AllAppsList {
|
||||
}
|
||||
|
||||
/**
|
||||
* Suspend the apps for the given apk identified by packageName.
|
||||
* Updates the apps for the given packageName and user based on {@param op}.
|
||||
*/
|
||||
public void suspendPackage(String packageName, UserHandleCompat user, boolean suspend) {
|
||||
public void updatePackageFlags(String packageName, UserHandleCompat user, FlagOp op) {
|
||||
final List<AppInfo> data = this.data;
|
||||
for (int i = data.size() - 1; i >= 0; i--) {
|
||||
AppInfo info = data.get(i);
|
||||
final ComponentName component = info.intent.getComponent();
|
||||
if (info.user.equals(user) && packageName.equals(component.getPackageName())) {
|
||||
if (suspend) {
|
||||
info.isDisabled |= ShortcutInfo.FLAG_DISABLED_SUSPENDED;
|
||||
} else {
|
||||
info.isDisabled &= ~ShortcutInfo.FLAG_DISABLED_SUSPENDED;
|
||||
}
|
||||
info.isDisabled = op.apply(info.isDisabled);
|
||||
modified.add(info);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user