Bugfix: Remove widgets and deep shortcuts of app which gets archived.

* Once app is archived, remove widgets and deep shortcuts corresponding to the app from the home screen.
* However during backup & restore, widgets should not be removed if they are being restored.

Test: verified bugfix locally.
Bug: 326567866
Flag: ACONFIG com.android.launcher3.enable_support_for_archiving DEVELOPMENT
Change-Id: Ib3a112aadc7bd901fd6a0ba86f472ec6acf8d626
This commit is contained in:
Rohit Goyal
2024-02-29 13:46:52 +00:00
parent a9338897a4
commit bef2930f5a
2 changed files with 22 additions and 4 deletions
@@ -78,10 +78,12 @@ public class ShortcutsChangedTask extends BaseModelUpdateTask {
if (!matchingWorkspaceItems.isEmpty()) {
if (mShortcuts.isEmpty()) {
PackageManagerHelper packageManagerHelper = new PackageManagerHelper(
app.getContext());
// Verify that the app is indeed installed.
if (!new PackageManagerHelper(app.getContext())
.isAppInstalled(mPackageName, mUser)) {
// App is not installed, ignoring package events
if (!packageManagerHelper.isAppInstalled(mPackageName, mUser)
&& !packageManagerHelper.isAppArchivedForUser(mPackageName, mUser)) {
// App is not installed or archived, ignoring package events
return;
}
}