From 30b967483d9821547090f1276e269b57e42fde5b Mon Sep 17 00:00:00 2001 From: Sarp Misoglu Date: Thu, 2 Feb 2023 15:26:13 +0000 Subject: [PATCH] Set mUser inside the onCreate(user) method in BackupAgent onCreate(user) is only used for PackageManagerBackupAgent, and not setting it causes package manager backup to be unable to communicate it's done to the restore task. Bug: 266940303 Test: manual, factory reset and restore a cloud backup on an HSUM device Change-Id: Ib6a21ebed486031e179d62173afcfbb466a25412 --- core/java/android/app/backup/BackupAgent.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/core/java/android/app/backup/BackupAgent.java b/core/java/android/app/backup/BackupAgent.java index e323e8967cc7b..909073e27ce5e 100644 --- a/core/java/android/app/backup/BackupAgent.java +++ b/core/java/android/app/backup/BackupAgent.java @@ -265,15 +265,9 @@ public abstract class BackupAgent extends ContextWrapper { public void onCreate() { } - /** - * Provided as a convenience for agent implementations that need an opportunity - * to do one-time initialization before the actual backup or restore operation - * is begun with information about the calling user. - *

- * - * @hide - */ + /** @hide */ public void onCreate(UserHandle user) { + mUser = user; onCreate(); } @@ -284,7 +278,6 @@ public abstract class BackupAgent extends ContextWrapper { */ @Deprecated public void onCreate(UserHandle user, @BackupDestination int backupDestination) { - mUser = user; mBackupDestination = backupDestination; onCreate(user); @@ -295,7 +288,6 @@ public abstract class BackupAgent extends ContextWrapper { */ public void onCreate(UserHandle user, @BackupDestination int backupDestination, @OperationType int operationType) { - mUser = user; mBackupDestination = backupDestination; mLogger = new BackupRestoreEventLogger(operationType);