Pass in correct user to AccountManagerBackupHelper
Bug: 261044673
Test: Manual Testing
- Add debug logs to print blob data during backup.
- Add debug logs to print blob data during restore. Confirm restore is correctly applied and reflected in account_de.db (database which contains grants)
Change-Id: Ibfce9e13510d77525f79fb5e58774172d46a2c9e
This commit is contained in:
committed by
Sarp Misoglu
parent
41e9b2fb88
commit
5afbc8785f
@@ -18,8 +18,8 @@ package com.android.server.backup;
|
||||
|
||||
import android.accounts.AccountManagerInternal;
|
||||
import android.app.backup.BlobBackupHelper;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.server.LocalServices;
|
||||
|
||||
/**
|
||||
@@ -35,8 +35,11 @@ public class AccountManagerBackupHelper extends BlobBackupHelper {
|
||||
// key under which the account access grant state blob is committed to backup
|
||||
private static final String KEY_ACCOUNT_ACCESS_GRANTS = "account_access_grants";
|
||||
|
||||
public AccountManagerBackupHelper() {
|
||||
private final int mUserId;
|
||||
|
||||
public AccountManagerBackupHelper(int userId) {
|
||||
super(STATE_VERSION, KEY_ACCOUNT_ACCESS_GRANTS);
|
||||
mUserId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -48,7 +51,7 @@ public class AccountManagerBackupHelper extends BlobBackupHelper {
|
||||
try {
|
||||
switch (key) {
|
||||
case KEY_ACCOUNT_ACCESS_GRANTS: {
|
||||
return am.backupAccountAccessPermissions(UserHandle.USER_SYSTEM);
|
||||
return am.backupAccountAccessPermissions(mUserId);
|
||||
}
|
||||
|
||||
default: {
|
||||
@@ -71,7 +74,7 @@ public class AccountManagerBackupHelper extends BlobBackupHelper {
|
||||
try {
|
||||
switch (key) {
|
||||
case KEY_ACCOUNT_ACCESS_GRANTS: {
|
||||
am.restoreAccountAccessPermissions(payload, UserHandle.USER_SYSTEM);
|
||||
am.restoreAccountAccessPermissions(payload, mUserId);
|
||||
} break;
|
||||
|
||||
default: {
|
||||
|
||||
@@ -84,7 +84,8 @@ public class SystemBackupAgent extends BackupAgentHelper {
|
||||
private static final String WALLPAPER_IMAGE_KEY = WallpaperBackupHelper.WALLPAPER_IMAGE_KEY;
|
||||
|
||||
private static final Set<String> sEligibleForMultiUser = Sets.newArraySet(
|
||||
PERMISSION_HELPER, NOTIFICATION_HELPER, SYNC_SETTINGS_HELPER, APP_LOCALES_HELPER);
|
||||
PERMISSION_HELPER, NOTIFICATION_HELPER, SYNC_SETTINGS_HELPER, APP_LOCALES_HELPER,
|
||||
ACCOUNT_MANAGER_HELPER);
|
||||
|
||||
private int mUserId = UserHandle.USER_SYSTEM;
|
||||
|
||||
@@ -100,7 +101,7 @@ public class SystemBackupAgent extends BackupAgentHelper {
|
||||
addHelper(PERMISSION_HELPER, new PermissionBackupHelper(mUserId));
|
||||
addHelper(USAGE_STATS_HELPER, new UsageStatsBackupHelper(this));
|
||||
addHelper(SHORTCUT_MANAGER_HELPER, new ShortcutBackupHelper());
|
||||
addHelper(ACCOUNT_MANAGER_HELPER, new AccountManagerBackupHelper());
|
||||
addHelper(ACCOUNT_MANAGER_HELPER, new AccountManagerBackupHelper(mUserId));
|
||||
addHelper(SLICES_HELPER, new SliceBackupHelper(this));
|
||||
addHelper(PEOPLE_HELPER, new PeopleBackupHelper(mUserId));
|
||||
addHelper(APP_LOCALES_HELPER, new AppSpecificLocalesBackupHelper(mUserId));
|
||||
|
||||
Reference in New Issue
Block a user