diff options
| author | 2024-02-28 15:26:50 +0000 | |
|---|---|---|
| committer | 2024-02-29 14:06:50 +0000 | |
| commit | c3ba6cb06cd3fd39bb3e43b3794054590266d990 (patch) | |
| tree | df1f8e58d592a4096036aa75ebd770f2c9c9d1aa | |
| parent | f1b65f66377200cf279ea4de36a999e8f922d36f (diff) | |
Bugfix: Allow shortcut and widget services to update shortcuts and widgets across all launchers during archival.
* In case of a package removed event, when delete_keep_data is set and archival is also set, allow shortcut service to remove all the corresponding shortcuts and widgets across all the launcher apps.
Test: verified bugfix locally.
Bug: 326567866
Change-Id: I6bdfddb889a80e698e9d62bf32022e4f59b0245a
| -rw-r--r-- | services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java | 8 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/ShortcutService.java | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java index 6f45f60f6dfa..21a02ed2957d 100644 --- a/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java +++ b/services/appwidget/java/com/android/server/appwidget/AppWidgetServiceImpl.java @@ -476,8 +476,12 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku } else { // If the package is being updated, we'll receive a PACKAGE_ADDED // shortly, otherwise it is removed permanently. - final boolean packageRemovedPermanently = (extras == null - || !extras.getBoolean(Intent.EXTRA_REPLACING, false)); + boolean isReplacing = extras != null && extras.getBoolean(Intent.EXTRA_REPLACING, + false); + boolean isArchival = extras != null && extras.getBoolean(Intent.EXTRA_ARCHIVAL, + false); + final boolean packageRemovedPermanently = + (extras == null || !isReplacing || (isReplacing && isArchival)); if (packageRemovedPermanently) { for (String pkgName : pkgList) { diff --git a/services/core/java/com/android/server/pm/ShortcutService.java b/services/core/java/com/android/server/pm/ShortcutService.java index a600eeabf62b..e58418d1fa90 100644 --- a/services/core/java/com/android/server/pm/ShortcutService.java +++ b/services/core/java/com/android/server/pm/ShortcutService.java @@ -3795,6 +3795,7 @@ public class ShortcutService extends IShortcutService.Stub { } final boolean replacing = intent.getBooleanExtra(Intent.EXTRA_REPLACING, false); + final boolean archival = intent.getBooleanExtra(Intent.EXTRA_ARCHIVAL, false); switch (action) { case Intent.ACTION_PACKAGE_ADDED: @@ -3805,7 +3806,7 @@ public class ShortcutService extends IShortcutService.Stub { } break; case Intent.ACTION_PACKAGE_REMOVED: - if (!replacing) { + if (!replacing || (replacing && archival)) { handlePackageRemoved(packageName, userId); } break; |