Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 238e80a5 authored by Clark Scheff's avatar Clark Scheff Committed by Andy Mast
Browse files

Send broadcast when package is 'about' to be removed

If a theme package is removed and it is the currently applied
theme, some apps will crash because the theme resources are
no longer available, since they were cleaned up by the package
manager.  The themes provider will receive this broadcast and
take care of switching back to the default theme for components
that are using the package about to be removed.

Change-Id: I968c25e19eb17ec87e7ddcba5ac0fd81745cef20
parent b400cf4f
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2661,6 +2661,14 @@ public class Intent implements Parcelable, Cloneable {
     */
    public static final String ACTION_GLOBAL_BUTTON = "android.intent.action.GLOBAL_BUTTON";

    /**
     * Broadcast Action: let apps know when a package is going to be removed.  This is useful
     * for switching to default theme if the package being removed is the current applied theme.
     * @hide
     */
    public static final String ACTION_PACKAGE_BEING_REMOVED =
            "android.intent.action.PACKAGE_BEING_REMOVED";

    /**
     * Activity Action: Allow the user to select and return one or more existing
     * documents. When invoked, the system will display the various
+2 −0
Original line number Diff line number Diff line
@@ -9952,6 +9952,8 @@ public class PackageManagerService extends IPackageManager.Stub {
        synchronized (mInstallLock) {
            if (DEBUG_REMOVE) Slog.d(TAG, "deletePackageX: pkg=" + packageName + " user=" + userId);
            sendPackageBroadcast(Intent.ACTION_PACKAGE_BEING_REMOVED, packageName, null,
                    null, null, null, null);
            res = deletePackageLI(packageName,
                    (flags & PackageManager.DELETE_ALL_USERS) != 0
                            ? UserHandle.ALL : new UserHandle(userId),