Remove duplicate code in initializing transports
Use enforceCallingOrSelfPermission which is the same as
enforceCallingPermission except it grants own permissions
when not processing an IPC.
Also remove unused private field from KeyValueBackupTask
Bug: 146939599
Bug: 136738613
Test: 1) adb shell bmgr enable true
2) adb shell bmgr enable false
3) adb shell am broadcast -a "android.app.backup.intent.INIT"
logcat is as expected:
BackupManagerService: Backup enabled => false
BackupManagerService: Running a device init; 3 pending
BackupManagerService: initializeTransport(): [com.android.localtransport/.LocalTransport, com.google.android.gms/.backup.migrate.service.D2dTransport, com.google.android.gms/.backup.BackupTransportService]
BackupManagerService: Initializing (wiping) backup transport storage: com.android.localtransport/.LocalTransport
....
BackupManagerService: Initializing (wiping) backup transport storage: com.google.android.gms/.backup.migrate.service.D2dTransport
...
BackupManagerService: Initializing (wiping) backup transport storage: com.google.android.gms/.backup.BackupTransportService
Change-Id: I98d87f3163cd7fbc1f7aa6712ec421cc8efd5d29
3 files changed