summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuslan Tkhakokhov <rthakohov@google.com>2020-08-28 16:20:06 +0000
committerRuslan Tkhakokhov <rthakohov@google.com>2020-08-28 18:51:13 +0000
commit752877e8fcdd0256347aa69cfbbd43bc15710e32 (patch)
tree5d0b13bc58fddbae914919b38fc4adbbc3a7f047
parent0c098c47a5ec999bcdfe1659e1efa5bf927ce2ed (diff)
Revert "Don't check allowBackup in PackageManager"
This reverts commit 0c098c47a5ec999bcdfe1659e1efa5bf927ce2ed. Reason for revert: Broken test (b/166767190) Change-Id: I5a9c7be8f317f07413c1197ac7dc7d762ee98eb4
-rw-r--r--services/core/java/com/android/server/pm/PackageManagerService.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index ffd23788223e..344f9cfdbc96 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -14541,11 +14541,13 @@ public class PackageManagerService extends IPackageManager.Stub
Log.v(TAG, "restoreAndPostInstall userId=" + userId + " package=" + res.pkg);
}
- // A restore should be requested at this point if (a) the install
- // succeeded, (b) the operation is not an update.
+ // A restore should be performed at this point if (a) the install
+ // succeeded, (b) the operation is not an update, and (c) the new
+ // package has not opted out of backup participation.
final boolean update = res.removedInfo != null
&& res.removedInfo.removedPackage != null;
- boolean doRestore = !update;
+ boolean allowBackup = res.pkg != null && res.pkg.isAllowBackup();
+ boolean doRestore = !update && allowBackup;
// Set up the post-install work request bookkeeping. This will be used
// and cleaned up by the post-install event handling regardless of whether