Loading services/backup/java/com/android/server/backup/BackupManagerService.java +38 −30 Original line number Diff line number Diff line Loading @@ -401,26 +401,35 @@ public class BackupManagerService implements BackupManagerServiceInterface { @Override public void onUnlockUser(int userId) { if (userId == UserHandle.USER_SYSTEM) { sInstance.unlockSystemUser(); } } } // Called through the trampoline from onUnlockUser(), then we buck the work // off to the background thread to keep the unlock time down. public void unlockSystemUser() { mBackupHandler.post(() -> { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup init"); sInstance.initialize(userId); sInstance.initialize(UserHandle.USER_SYSTEM); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); // Migrate legacy setting Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup migrate"); if (!backupSettingMigrated(userId)) { if (!backupSettingMigrated(UserHandle.USER_SYSTEM)) { if (DEBUG) { Slog.i(TAG, "Backup enable apparently not migrated"); } final ContentResolver r = sInstance.mContext.getContentResolver(); final int enableState = Settings.Secure.getIntForUser(r, Settings.Secure.BACKUP_ENABLED, -1, userId); Settings.Secure.BACKUP_ENABLED, -1, UserHandle.USER_SYSTEM); if (enableState >= 0) { if (DEBUG) { Slog.i(TAG, "Migrating enable state " + (enableState != 0)); } writeBackupEnableState(enableState != 0, userId); writeBackupEnableState(enableState != 0, UserHandle.USER_SYSTEM); Settings.Secure.putStringForUser(r, Settings.Secure.BACKUP_ENABLED, null, userId); Settings.Secure.BACKUP_ENABLED, null, UserHandle.USER_SYSTEM); } else { if (DEBUG) { Slog.i(TAG, "Backup not yet configured; retaining null enable state"); Loading @@ -431,13 +440,12 @@ public class BackupManagerService implements BackupManagerServiceInterface { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup enable"); try { sInstance.setBackupEnabled(readBackupEnableState(userId)); sInstance.setBackupEnabled(readBackupEnableState(UserHandle.USER_SYSTEM)); } catch (RemoteException e) { // can't happen; it's a local object } Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } }); } class ProvisionedObserver extends ContentObserver { Loading services/backup/java/com/android/server/backup/BackupManagerServiceInterface.java +2 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ import java.io.PrintWriter; */ public interface BackupManagerServiceInterface { void unlockSystemUser(); // Utility: build a new random integer token int generateRandomIntegerToken(); Loading services/backup/java/com/android/server/backup/RefactoredBackupManagerService.java +38 −30 Original line number Diff line number Diff line Loading @@ -548,26 +548,35 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter @Override public void onUnlockUser(int userId) { if (userId == UserHandle.USER_SYSTEM) { sInstance.unlockSystemUser(); } } } // Called through the trampoline from onUnlockUser(), then we buck the work // off to the background thread to keep the unlock time down. public void unlockSystemUser() { mBackupHandler.post(() -> { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup init"); sInstance.initialize(userId); sInstance.initialize(UserHandle.USER_SYSTEM); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); // Migrate legacy setting Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup migrate"); if (!backupSettingMigrated(userId)) { if (!backupSettingMigrated(UserHandle.USER_SYSTEM)) { if (DEBUG) { Slog.i(TAG, "Backup enable apparently not migrated"); } final ContentResolver r = sInstance.mContext.getContentResolver(); final int enableState = Settings.Secure.getIntForUser(r, Settings.Secure.BACKUP_ENABLED, -1, userId); Settings.Secure.BACKUP_ENABLED, -1, UserHandle.USER_SYSTEM); if (enableState >= 0) { if (DEBUG) { Slog.i(TAG, "Migrating enable state " + (enableState != 0)); } writeBackupEnableState(enableState != 0, userId); writeBackupEnableState(enableState != 0, UserHandle.USER_SYSTEM); Settings.Secure.putStringForUser(r, Settings.Secure.BACKUP_ENABLED, null, userId); Settings.Secure.BACKUP_ENABLED, null, UserHandle.USER_SYSTEM); } else { if (DEBUG) { Slog.i(TAG, "Backup not yet configured; retaining null enable state"); Loading @@ -578,13 +587,12 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup enable"); try { sInstance.setBackupEnabled(readBackupEnableState(userId)); sInstance.setBackupEnabled(readBackupEnableState(UserHandle.USER_SYSTEM)); } catch (RemoteException e) { // can't happen; it's a local object } Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } }); } // Bookkeeping of in-flight operations for timeout etc. purposes. The operation Loading services/backup/java/com/android/server/backup/Trampoline.java +7 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,13 @@ public class Trampoline extends IBackupManager.Stub { } } void unlockSystemUser() { BackupManagerServiceInterface svc = mService; if (svc != null) { svc.unlockSystemUser(); } } public void setBackupServiceActive(final int userHandle, boolean makeActive) { // Only the DPM should be changing the active state of backup final int caller = binderGetCallingUid(); Loading Loading
services/backup/java/com/android/server/backup/BackupManagerService.java +38 −30 Original line number Diff line number Diff line Loading @@ -401,26 +401,35 @@ public class BackupManagerService implements BackupManagerServiceInterface { @Override public void onUnlockUser(int userId) { if (userId == UserHandle.USER_SYSTEM) { sInstance.unlockSystemUser(); } } } // Called through the trampoline from onUnlockUser(), then we buck the work // off to the background thread to keep the unlock time down. public void unlockSystemUser() { mBackupHandler.post(() -> { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup init"); sInstance.initialize(userId); sInstance.initialize(UserHandle.USER_SYSTEM); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); // Migrate legacy setting Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup migrate"); if (!backupSettingMigrated(userId)) { if (!backupSettingMigrated(UserHandle.USER_SYSTEM)) { if (DEBUG) { Slog.i(TAG, "Backup enable apparently not migrated"); } final ContentResolver r = sInstance.mContext.getContentResolver(); final int enableState = Settings.Secure.getIntForUser(r, Settings.Secure.BACKUP_ENABLED, -1, userId); Settings.Secure.BACKUP_ENABLED, -1, UserHandle.USER_SYSTEM); if (enableState >= 0) { if (DEBUG) { Slog.i(TAG, "Migrating enable state " + (enableState != 0)); } writeBackupEnableState(enableState != 0, userId); writeBackupEnableState(enableState != 0, UserHandle.USER_SYSTEM); Settings.Secure.putStringForUser(r, Settings.Secure.BACKUP_ENABLED, null, userId); Settings.Secure.BACKUP_ENABLED, null, UserHandle.USER_SYSTEM); } else { if (DEBUG) { Slog.i(TAG, "Backup not yet configured; retaining null enable state"); Loading @@ -431,13 +440,12 @@ public class BackupManagerService implements BackupManagerServiceInterface { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup enable"); try { sInstance.setBackupEnabled(readBackupEnableState(userId)); sInstance.setBackupEnabled(readBackupEnableState(UserHandle.USER_SYSTEM)); } catch (RemoteException e) { // can't happen; it's a local object } Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } }); } class ProvisionedObserver extends ContentObserver { Loading
services/backup/java/com/android/server/backup/BackupManagerServiceInterface.java +2 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ import java.io.PrintWriter; */ public interface BackupManagerServiceInterface { void unlockSystemUser(); // Utility: build a new random integer token int generateRandomIntegerToken(); Loading
services/backup/java/com/android/server/backup/RefactoredBackupManagerService.java +38 −30 Original line number Diff line number Diff line Loading @@ -548,26 +548,35 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter @Override public void onUnlockUser(int userId) { if (userId == UserHandle.USER_SYSTEM) { sInstance.unlockSystemUser(); } } } // Called through the trampoline from onUnlockUser(), then we buck the work // off to the background thread to keep the unlock time down. public void unlockSystemUser() { mBackupHandler.post(() -> { Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup init"); sInstance.initialize(userId); sInstance.initialize(UserHandle.USER_SYSTEM); Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); // Migrate legacy setting Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup migrate"); if (!backupSettingMigrated(userId)) { if (!backupSettingMigrated(UserHandle.USER_SYSTEM)) { if (DEBUG) { Slog.i(TAG, "Backup enable apparently not migrated"); } final ContentResolver r = sInstance.mContext.getContentResolver(); final int enableState = Settings.Secure.getIntForUser(r, Settings.Secure.BACKUP_ENABLED, -1, userId); Settings.Secure.BACKUP_ENABLED, -1, UserHandle.USER_SYSTEM); if (enableState >= 0) { if (DEBUG) { Slog.i(TAG, "Migrating enable state " + (enableState != 0)); } writeBackupEnableState(enableState != 0, userId); writeBackupEnableState(enableState != 0, UserHandle.USER_SYSTEM); Settings.Secure.putStringForUser(r, Settings.Secure.BACKUP_ENABLED, null, userId); Settings.Secure.BACKUP_ENABLED, null, UserHandle.USER_SYSTEM); } else { if (DEBUG) { Slog.i(TAG, "Backup not yet configured; retaining null enable state"); Loading @@ -578,13 +587,12 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "backup enable"); try { sInstance.setBackupEnabled(readBackupEnableState(userId)); sInstance.setBackupEnabled(readBackupEnableState(UserHandle.USER_SYSTEM)); } catch (RemoteException e) { // can't happen; it's a local object } Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER); } } }); } // Bookkeeping of in-flight operations for timeout etc. purposes. The operation Loading
services/backup/java/com/android/server/backup/Trampoline.java +7 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,13 @@ public class Trampoline extends IBackupManager.Stub { } } void unlockSystemUser() { BackupManagerServiceInterface svc = mService; if (svc != null) { svc.unlockSystemUser(); } } public void setBackupServiceActive(final int userHandle, boolean makeActive) { // Only the DPM should be changing the active state of backup final int caller = binderGetCallingUid(); Loading