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

Commit 5aba226d authored by Christopher Tate's avatar Christopher Tate
Browse files

Fix requestRestore() of an app's own package

The BACKUP permission check was being applied over-zealously.

Bug 19336200

Change-Id: Ia52b5c5cc0fd8d19b74ee624be85113d1b8dca7e
parent 261208e0
Loading
Loading
Loading
Loading
+37 −34
Original line number Diff line number Diff line
@@ -9368,8 +9368,10 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
                throw new SecurityException("No permission to restore other packages");
            }

            // So far so good; we're allowed to try to restore this package.  Now
            // check whether there is data for it in the current dataset, falling back
            // So far so good; we're allowed to try to restore this package.
            long oldId = Binder.clearCallingIdentity();
            try {
                // Check whether there is data for it in the current dataset, falling back
                // to the ancestral dataset if not.
                long token = getAvailableRestoreToken(packageName);
                if (DEBUG) Slog.v(TAG, "restorePackage pkg=" + packageName
@@ -9396,7 +9398,6 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
                mBackupHandler.removeMessages(MSG_RESTORE_TIMEOUT);

                // Ready to go:  enqueue the restore request and claim success
            long oldId = Binder.clearCallingIdentity();
                mWakelock.acquire();
                if (MORE_DEBUG) {
                    Slog.d(TAG, "restorePackage() : " + packageName);
@@ -9405,7 +9406,9 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
                msg.obj = new RestoreParams(mRestoreTransport, dirName,
                        observer, token, app, 0);
                mBackupHandler.sendMessage(msg);
            } finally {
                Binder.restoreCallingIdentity(oldId);
            }
            return 0;
        }