summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorGovinda Wasserman <gwasserman@google.com>2021-08-17 11:00:54 -0400
committerGovinda Wasserman <gwasserman@google.com>2021-08-19 12:30:40 -0400
commit8de1c313e64c40f48b222e6cb069a4509723b95c (patch)
treeebe3d9efca07d005d1f53c1c08d82f2feb6ac22d /core/java/android
parent0e40c2c994301418eb791822dee98a89e6396448 (diff)
Allow BackupHelper to be overridden
This will allow vendor versions of System UI to backup their vendor-specific data. Test: Tested locally BUG: 195548201 Change-Id: Iebf512104be2a8fa0dfb614af12d95ed6a3625eb
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/backup/BackupManager.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/core/java/android/app/backup/BackupManager.java b/core/java/android/app/backup/BackupManager.java
index dae565e12fd7..67f631f98f0b 100644
--- a/core/java/android/app/backup/BackupManager.java
+++ b/core/java/android/app/backup/BackupManager.java
@@ -281,6 +281,32 @@ public class BackupManager {
}
/**
+ * Convenience method for callers who need to indicate that some other package or
+ * some other user needs a backup pass. This can be useful in the case of groups of
+ * packages that share a uid and/or have user-specific data.
+ * <p>
+ * This method requires that the application hold the "android.permission.BACKUP"
+ * permission if the package named in the package argument does not run under the
+ * same uid as the caller. This method also requires that the application hold the
+ * "android.permission.INTERACT_ACROSS_USERS_FULL" if the user argument is not the
+ * same as the user the caller is running under.
+ * @param userId The user to back up
+ * @param packageName The package name identifying the application to back up.
+ *
+ * @hide
+ */
+ public static void dataChangedForUser(int userId, String packageName) {
+ checkServiceBinder();
+ if (sService != null) {
+ try {
+ sService.dataChangedForUser(userId, packageName);
+ } catch (RemoteException e) {
+ Log.e(TAG, "dataChanged(userId,pkg) couldn't connect");
+ }
+ }
+ }
+
+ /**
* @deprecated Applications shouldn't request a restore operation using this method. In Android
* P and later, this method is a no-op.
*