Loading services/backup/java/com/android/server/backup/BackupManagerService.java +10 −7 Original line number Original line Diff line number Diff line Loading @@ -1987,7 +1987,7 @@ public class BackupManagerService implements BackupManagerServiceInterface { if (uri == null) { if (uri == null) { return; return; } } String pkgName = uri.getSchemeSpecificPart(); final String pkgName = uri.getSchemeSpecificPart(); if (pkgName != null) { if (pkgName != null) { pkgList = new String[] { pkgName }; pkgList = new String[] { pkgName }; } } Loading @@ -1995,7 +1995,7 @@ public class BackupManagerService implements BackupManagerServiceInterface { // At package-changed we only care about looking at new transport states // At package-changed we only care about looking at new transport states if (changed) { if (changed) { String[] components = final String[] components = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST); intent.getStringArrayExtra(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST); if (MORE_DEBUG) { if (MORE_DEBUG) { Loading @@ -2005,7 +2005,8 @@ public class BackupManagerService implements BackupManagerServiceInterface { } } } } mTransportManager.onPackageChanged(pkgName, components); mBackupHandler.post( () -> mTransportManager.onPackageChanged(pkgName, components)); return; // nothing more to do in the PACKAGE_CHANGED case return; // nothing more to do in the PACKAGE_CHANGED case } } Loading Loading @@ -2037,7 +2038,7 @@ public class BackupManagerService implements BackupManagerServiceInterface { } } // If they're full-backup candidates, add them there instead // If they're full-backup candidates, add them there instead final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis(); for (String packageName : pkgList) { for (final String packageName : pkgList) { try { try { PackageInfo app = mPackageManager.getPackageInfo(packageName, 0); PackageInfo app = mPackageManager.getPackageInfo(packageName, 0); if (appGetsFullBackup(app) if (appGetsFullBackup(app) Loading @@ -2054,7 +2055,8 @@ public class BackupManagerService implements BackupManagerServiceInterface { writeFullBackupScheduleAsync(); writeFullBackupScheduleAsync(); } } mTransportManager.onPackageAdded(packageName); mBackupHandler.post( () -> mTransportManager.onPackageAdded(packageName)); } catch (NameNotFoundException e) { } catch (NameNotFoundException e) { // doesn't really exist; ignore it // doesn't really exist; ignore it Loading @@ -2078,8 +2080,9 @@ public class BackupManagerService implements BackupManagerServiceInterface { removePackageParticipantsLocked(pkgList, uid); removePackageParticipantsLocked(pkgList, uid); } } } } for (String pkgName : pkgList) { for (final String pkgName : pkgList) { mTransportManager.onPackageRemoved(pkgName); mBackupHandler.post( () -> mTransportManager.onPackageRemoved(pkgName)); } } } } } } Loading services/backup/java/com/android/server/backup/RefactoredBackupManagerService.java +10 −7 Original line number Original line Diff line number Diff line Loading @@ -1188,7 +1188,7 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter if (uri == null) { if (uri == null) { return; return; } } String pkgName = uri.getSchemeSpecificPart(); final String pkgName = uri.getSchemeSpecificPart(); if (pkgName != null) { if (pkgName != null) { pkgList = new String[]{pkgName}; pkgList = new String[]{pkgName}; } } Loading @@ -1196,7 +1196,7 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter // At package-changed we only care about looking at new transport states // At package-changed we only care about looking at new transport states if (changed) { if (changed) { String[] components = final String[] components = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST); intent.getStringArrayExtra(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST); if (MORE_DEBUG) { if (MORE_DEBUG) { Loading @@ -1206,7 +1206,8 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter } } } } mTransportManager.onPackageChanged(pkgName, components); mBackupHandler.post( () -> mTransportManager.onPackageChanged(pkgName, components)); return; // nothing more to do in the PACKAGE_CHANGED case return; // nothing more to do in the PACKAGE_CHANGED case } } Loading Loading @@ -1238,7 +1239,7 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter } } // If they're full-backup candidates, add them there instead // If they're full-backup candidates, add them there instead final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis(); for (String packageName : pkgList) { for (final String packageName : pkgList) { try { try { PackageInfo app = mPackageManager.getPackageInfo(packageName, 0); PackageInfo app = mPackageManager.getPackageInfo(packageName, 0); if (AppBackupUtils.appGetsFullBackup(app) if (AppBackupUtils.appGetsFullBackup(app) Loading @@ -1256,7 +1257,8 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter writeFullBackupScheduleAsync(); writeFullBackupScheduleAsync(); } } mTransportManager.onPackageAdded(packageName); mBackupHandler.post( () -> mTransportManager.onPackageAdded(packageName)); } catch (NameNotFoundException e) { } catch (NameNotFoundException e) { // doesn't really exist; ignore it // doesn't really exist; ignore it Loading @@ -1280,8 +1282,9 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter removePackageParticipantsLocked(pkgList, uid); removePackageParticipantsLocked(pkgList, uid); } } } } for (String pkgName : pkgList) { for (final String pkgName : pkgList) { mTransportManager.onPackageRemoved(pkgName); mBackupHandler.post( () -> mTransportManager.onPackageRemoved(pkgName)); } } } } } } Loading services/backup/java/com/android/server/backup/TransportManager.java +13 −14 Original line number Original line Diff line number Diff line Loading @@ -341,9 +341,9 @@ public class TransportManager { private class TransportConnection implements ServiceConnection { private class TransportConnection implements ServiceConnection { // Hold mTransportsLock to access these fields so as to provide a consistent view of them. // Hold mTransportsLock to access these fields so as to provide a consistent view of them. private IBackupTransport mBinder; private volatile IBackupTransport mBinder; private final List<TransportReadyCallback> mListeners = new ArrayList<>(); private final List<TransportReadyCallback> mListeners = new ArrayList<>(); private String mTransportName; private volatile String mTransportName; private final ComponentName mTransportComponent; private final ComponentName mTransportComponent; Loading Loading @@ -426,27 +426,26 @@ public class TransportManager { + rebindTimeout + "ms"); + rebindTimeout + "ms"); } } // Intentionally not synchronized -- the variable is volatile and changes to its value // are inside synchronized blocks, providing a memory sync barrier; and this method // does not touch any other state protected by that lock. private IBackupTransport getBinder() { private IBackupTransport getBinder() { synchronized (mTransportLock) { return mBinder; return mBinder; } } } // Intentionally not synchronized; same as getBinder() private String getName() { private String getName() { synchronized (mTransportLock) { return mTransportName; return mTransportName; } } } // Intentionally not synchronized; same as getBinder() private void bindIfUnbound() { private void bindIfUnbound() { synchronized (mTransportLock) { if (mBinder == null) { if (mBinder == null) { Slog.d(TAG, Slog.d(TAG, "Rebinding to transport " + mTransportComponent.flattenToShortString()); "Rebinding to transport " + mTransportComponent.flattenToShortString()); bindToTransport(mTransportComponent, this); bindToTransport(mTransportComponent, this); } } } } } private void addListener(TransportReadyCallback listener) { private void addListener(TransportReadyCallback listener) { synchronized (mTransportLock) { synchronized (mTransportLock) { Loading Loading
services/backup/java/com/android/server/backup/BackupManagerService.java +10 −7 Original line number Original line Diff line number Diff line Loading @@ -1987,7 +1987,7 @@ public class BackupManagerService implements BackupManagerServiceInterface { if (uri == null) { if (uri == null) { return; return; } } String pkgName = uri.getSchemeSpecificPart(); final String pkgName = uri.getSchemeSpecificPart(); if (pkgName != null) { if (pkgName != null) { pkgList = new String[] { pkgName }; pkgList = new String[] { pkgName }; } } Loading @@ -1995,7 +1995,7 @@ public class BackupManagerService implements BackupManagerServiceInterface { // At package-changed we only care about looking at new transport states // At package-changed we only care about looking at new transport states if (changed) { if (changed) { String[] components = final String[] components = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST); intent.getStringArrayExtra(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST); if (MORE_DEBUG) { if (MORE_DEBUG) { Loading @@ -2005,7 +2005,8 @@ public class BackupManagerService implements BackupManagerServiceInterface { } } } } mTransportManager.onPackageChanged(pkgName, components); mBackupHandler.post( () -> mTransportManager.onPackageChanged(pkgName, components)); return; // nothing more to do in the PACKAGE_CHANGED case return; // nothing more to do in the PACKAGE_CHANGED case } } Loading Loading @@ -2037,7 +2038,7 @@ public class BackupManagerService implements BackupManagerServiceInterface { } } // If they're full-backup candidates, add them there instead // If they're full-backup candidates, add them there instead final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis(); for (String packageName : pkgList) { for (final String packageName : pkgList) { try { try { PackageInfo app = mPackageManager.getPackageInfo(packageName, 0); PackageInfo app = mPackageManager.getPackageInfo(packageName, 0); if (appGetsFullBackup(app) if (appGetsFullBackup(app) Loading @@ -2054,7 +2055,8 @@ public class BackupManagerService implements BackupManagerServiceInterface { writeFullBackupScheduleAsync(); writeFullBackupScheduleAsync(); } } mTransportManager.onPackageAdded(packageName); mBackupHandler.post( () -> mTransportManager.onPackageAdded(packageName)); } catch (NameNotFoundException e) { } catch (NameNotFoundException e) { // doesn't really exist; ignore it // doesn't really exist; ignore it Loading @@ -2078,8 +2080,9 @@ public class BackupManagerService implements BackupManagerServiceInterface { removePackageParticipantsLocked(pkgList, uid); removePackageParticipantsLocked(pkgList, uid); } } } } for (String pkgName : pkgList) { for (final String pkgName : pkgList) { mTransportManager.onPackageRemoved(pkgName); mBackupHandler.post( () -> mTransportManager.onPackageRemoved(pkgName)); } } } } } } Loading
services/backup/java/com/android/server/backup/RefactoredBackupManagerService.java +10 −7 Original line number Original line Diff line number Diff line Loading @@ -1188,7 +1188,7 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter if (uri == null) { if (uri == null) { return; return; } } String pkgName = uri.getSchemeSpecificPart(); final String pkgName = uri.getSchemeSpecificPart(); if (pkgName != null) { if (pkgName != null) { pkgList = new String[]{pkgName}; pkgList = new String[]{pkgName}; } } Loading @@ -1196,7 +1196,7 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter // At package-changed we only care about looking at new transport states // At package-changed we only care about looking at new transport states if (changed) { if (changed) { String[] components = final String[] components = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST); intent.getStringArrayExtra(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST); if (MORE_DEBUG) { if (MORE_DEBUG) { Loading @@ -1206,7 +1206,8 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter } } } } mTransportManager.onPackageChanged(pkgName, components); mBackupHandler.post( () -> mTransportManager.onPackageChanged(pkgName, components)); return; // nothing more to do in the PACKAGE_CHANGED case return; // nothing more to do in the PACKAGE_CHANGED case } } Loading Loading @@ -1238,7 +1239,7 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter } } // If they're full-backup candidates, add them there instead // If they're full-backup candidates, add them there instead final long now = System.currentTimeMillis(); final long now = System.currentTimeMillis(); for (String packageName : pkgList) { for (final String packageName : pkgList) { try { try { PackageInfo app = mPackageManager.getPackageInfo(packageName, 0); PackageInfo app = mPackageManager.getPackageInfo(packageName, 0); if (AppBackupUtils.appGetsFullBackup(app) if (AppBackupUtils.appGetsFullBackup(app) Loading @@ -1256,7 +1257,8 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter writeFullBackupScheduleAsync(); writeFullBackupScheduleAsync(); } } mTransportManager.onPackageAdded(packageName); mBackupHandler.post( () -> mTransportManager.onPackageAdded(packageName)); } catch (NameNotFoundException e) { } catch (NameNotFoundException e) { // doesn't really exist; ignore it // doesn't really exist; ignore it Loading @@ -1280,8 +1282,9 @@ public class RefactoredBackupManagerService implements BackupManagerServiceInter removePackageParticipantsLocked(pkgList, uid); removePackageParticipantsLocked(pkgList, uid); } } } } for (String pkgName : pkgList) { for (final String pkgName : pkgList) { mTransportManager.onPackageRemoved(pkgName); mBackupHandler.post( () -> mTransportManager.onPackageRemoved(pkgName)); } } } } } } Loading
services/backup/java/com/android/server/backup/TransportManager.java +13 −14 Original line number Original line Diff line number Diff line Loading @@ -341,9 +341,9 @@ public class TransportManager { private class TransportConnection implements ServiceConnection { private class TransportConnection implements ServiceConnection { // Hold mTransportsLock to access these fields so as to provide a consistent view of them. // Hold mTransportsLock to access these fields so as to provide a consistent view of them. private IBackupTransport mBinder; private volatile IBackupTransport mBinder; private final List<TransportReadyCallback> mListeners = new ArrayList<>(); private final List<TransportReadyCallback> mListeners = new ArrayList<>(); private String mTransportName; private volatile String mTransportName; private final ComponentName mTransportComponent; private final ComponentName mTransportComponent; Loading Loading @@ -426,27 +426,26 @@ public class TransportManager { + rebindTimeout + "ms"); + rebindTimeout + "ms"); } } // Intentionally not synchronized -- the variable is volatile and changes to its value // are inside synchronized blocks, providing a memory sync barrier; and this method // does not touch any other state protected by that lock. private IBackupTransport getBinder() { private IBackupTransport getBinder() { synchronized (mTransportLock) { return mBinder; return mBinder; } } } // Intentionally not synchronized; same as getBinder() private String getName() { private String getName() { synchronized (mTransportLock) { return mTransportName; return mTransportName; } } } // Intentionally not synchronized; same as getBinder() private void bindIfUnbound() { private void bindIfUnbound() { synchronized (mTransportLock) { if (mBinder == null) { if (mBinder == null) { Slog.d(TAG, Slog.d(TAG, "Rebinding to transport " + mTransportComponent.flattenToShortString()); "Rebinding to transport " + mTransportComponent.flattenToShortString()); bindToTransport(mTransportComponent, this); bindToTransport(mTransportComponent, this); } } } } } private void addListener(TransportReadyCallback listener) { private void addListener(TransportReadyCallback listener) { synchronized (mTransportLock) { synchronized (mTransportLock) { Loading