mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 07:46:55 +00:00
Simplifying logic for managed for icon addition
> Checking for duplicate icons before adding new icons For O and above, icon addition is controlled using SessionCommitReceiver. As long as the Launcher is the default app, it will keep adding icons on the homescreen. Apps installed while launcher was not the default homescreen, no icons will be added. For below O, icons are added based on package event. As long as the Launcher process is running, it will keep adding icons on the homescreen. Apps installed while the launcher app was dead, no icons will be added. Bug: 37528649 Bug: 37082950 Bug: 34112546 Change-Id: Ic99501fa476c00474a479f2a36c24614bfa3f4bf
This commit is contained in:
@@ -35,6 +35,7 @@ import com.android.launcher3.LauncherModel.CallbackTask;
|
||||
import com.android.launcher3.LauncherModel.Callbacks;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.SessionCommitReceiver;
|
||||
import com.android.launcher3.ShortcutInfo;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.compat.LauncherAppsCompat;
|
||||
@@ -43,7 +44,6 @@ import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.graphics.LauncherIcons;
|
||||
import com.android.launcher3.util.FlagOp;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.ManagedProfileHeuristic;
|
||||
import com.android.launcher3.util.PackageManagerHelper;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
|
||||
@@ -100,11 +100,11 @@ public class PackageUpdatedTask extends ExtendedModelTask {
|
||||
appsList.removePackage(packages[i], Process.myUserHandle());
|
||||
}
|
||||
appsList.addPackage(context, packages[i], mUser);
|
||||
}
|
||||
|
||||
ManagedProfileHeuristic heuristic = ManagedProfileHeuristic.get(context, mUser);
|
||||
if (heuristic != null) {
|
||||
heuristic.processPackageAdd(mPackages);
|
||||
// Automatically add homescreen icon for work profile apps for below O device.
|
||||
if (!Utilities.isAtLeastO() && !Process.myUserHandle().equals(mUser)) {
|
||||
SessionCommitReceiver.queueAppIconAddition(context, packages[i], mUser);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -119,10 +119,6 @@ public class PackageUpdatedTask extends ExtendedModelTask {
|
||||
flagOp = FlagOp.removeFlag(ShortcutInfo.FLAG_DISABLED_NOT_AVAILABLE);
|
||||
break;
|
||||
case OP_REMOVE: {
|
||||
ManagedProfileHeuristic heuristic = ManagedProfileHeuristic.get(context, mUser);
|
||||
if (heuristic != null) {
|
||||
heuristic.processPackageRemoved(mPackages);
|
||||
}
|
||||
for (int i = 0; i < N; i++) {
|
||||
iconCache.removeIconsForPkg(packages[i], mUser);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user