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

Commit a83cab00 authored by Christopher Tate's avatar Christopher Tate
Browse files

Do not hang in pm clear on an invalid package name

The Activity Manager was not properly informing the observer that
the operation had concluded (unsuccessfully).

Bug 8222595

Change-Id: I8234e32d8edf4112c8c7a5e20e341d0b41e23014
parent 09ed05ce
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -1149,10 +1149,7 @@ public final class Pm {

        ClearDataObserver obs = new ClearDataObserver();
        try {
            if (!ActivityManagerNative.getDefault().clearApplicationUserData(pkg, obs, userId)) {
                System.err.println("Failed");
            }

            ActivityManagerNative.getDefault().clearApplicationUserData(pkg, obs, userId);
            synchronized (obs) {
                while (!obs.finished) {
                    try {
+8 −1
Original line number Diff line number Diff line
@@ -3500,6 +3500,13 @@ public final class ActivityManagerService extends ActivityManagerNative
                }
                if (pkgUid == -1) {
                    Slog.w(TAG, "Invalid packageName: " + packageName);
                    if (observer != null) {
                        try {
                            observer.onRemoveCompleted(packageName, false);
                        } catch (RemoteException e) {
                            Slog.i(TAG, "Observer no longer exists.");
                        }
                    }
                    return false;
                }
                if (uid == pkgUid || checkComponentPermission(