summaryrefslogtreecommitdiff
path: root/services/robotests/backup
diff options
context:
space:
mode:
author Sarp Misoglu <sarpm@google.com> 2023-02-01 17:11:50 +0000
committer Sarp Misoglu <sarpm@google.com> 2023-02-15 11:25:28 +0000
commitc9892805d16df1ed5abba424e4df8e6e39f83422 (patch)
treebcf594eda385ad8de8df994a999c5ce7164140df /services/robotests/backup
parent15ea931900a6eed04eb8ba44737bd54858b112ae (diff)
Update the default backup user after onUserUnlocking if necessary
On the first ever boot of a HSUM device, UserManager will create the main user after BackupManagerService is created. If that happens the default user will stay as 0 until the device is rebooted. To prevent this we need to update the default user as soon as it's guaranteed that the main user is created (if one is to be created), which is when the first user unlocks. Bug: 266098768 Test: atest BackupManagerServiceTest atest BackupFrameworksServicesRoboTests manually by doing a factory reset and then checking backup is active for the main user via `adb shell bmgr --user 10 activate` Change-Id: Ic14e7357b468c27d206a57f9e7148d918f747c1d
Diffstat (limited to 'services/robotests/backup')
-rw-r--r--services/robotests/backup/src/com/android/server/backup/BackupManagerServiceRoboTest.java18
1 files changed, 1 insertions, 17 deletions
diff --git a/services/robotests/backup/src/com/android/server/backup/BackupManagerServiceRoboTest.java b/services/robotests/backup/src/com/android/server/backup/BackupManagerServiceRoboTest.java
index e2f56ba56f3d..94ee0a871448 100644
--- a/services/robotests/backup/src/com/android/server/backup/BackupManagerServiceRoboTest.java
+++ b/services/robotests/backup/src/com/android/server/backup/BackupManagerServiceRoboTest.java
@@ -1584,11 +1584,7 @@ public class BackupManagerServiceRoboTest {
@Test
public void testConstructor_withNullContext_throws() throws Exception {
expectThrows(
- NullPointerException.class,
- () ->
- new BackupManagerService(
- /* context */ null,
- new SparseArray<>()));
+ NullPointerException.class, () -> new BackupManagerService(/* context */ null));
}
/** Test that the constructor does not create {@link UserBackupManagerService} instances. */
@@ -1616,18 +1612,6 @@ public class BackupManagerServiceRoboTest {
verify(lifecycle).publishService(Context.BACKUP_SERVICE, backupManagerService);
}
- /** testOnUnlockUser_forwards */
- @Test
- public void testOnUnlockUser_forwards() {
- BackupManagerService backupManagerService = mock(BackupManagerService.class);
- BackupManagerService.Lifecycle lifecycle =
- new BackupManagerService.Lifecycle(mContext, backupManagerService);
-
- lifecycle.onUserUnlocking(new TargetUser(new UserInfo(UserHandle.USER_SYSTEM, null, 0)));
-
- verify(backupManagerService).onUnlockUser(UserHandle.USER_SYSTEM);
- }
-
/** testOnStopUser_forwards */
@Test
public void testOnStopUser_forwards() {