diff options
author | Christopher Tate <ctate@google.com> | 2014-09-03 13:50:23 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2014-09-03 14:12:11 -0700 |
commit | 539b217b764562964c7f11b416da8391cb7cf93f (patch) | |
tree | 171567fd1747991d65a852d9a6889be481dcdba4 /services/backup/java/com/android | |
parent | e8f8bc0ad6f7f2c657b4360033d2c7571c800ccb (diff) | |
download | frameworks_base-539b217b764562964c7f11b416da8391cb7cf93f.zip frameworks_base-539b217b764562964c7f11b416da8391cb7cf93f.tar.gz frameworks_base-539b217b764562964c7f11b416da8391cb7cf93f.tar.bz2 |
The transport system API needs to manage binder identity
...around writing settings. It does its own proper permission check;
it just needs to make sure not to accidentally crash the caller in
strange and wondrous ways because of failing to clear binder identity
before writing the result to secure settings.
Bug 16542048
Change-Id: I88d1f2dbeebd24eed5d86989f0ca0d834878b054
Diffstat (limited to 'services/backup/java/com/android')
-rw-r--r-- | services/backup/java/com/android/server/backup/BackupManagerService.java | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java index 3e7a7e4..083aa9b 100644 --- a/services/backup/java/com/android/server/backup/BackupManagerService.java +++ b/services/backup/java/com/android/server/backup/BackupManagerService.java @@ -8395,10 +8395,15 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF Slog.i(TAG, "Auto restore => " + doAutoRestore); - synchronized (this) { - Settings.Secure.putInt(mContext.getContentResolver(), - Settings.Secure.BACKUP_AUTO_RESTORE, doAutoRestore ? 1 : 0); - mAutoRestore = doAutoRestore; + final long oldId = Binder.clearCallingIdentity(); + try { + synchronized (this) { + Settings.Secure.putInt(mContext.getContentResolver(), + Settings.Secure.BACKUP_AUTO_RESTORE, doAutoRestore ? 1 : 0); + mAutoRestore = doAutoRestore; + } + } finally { + Binder.restoreCallingIdentity(oldId); } } @@ -8467,10 +8472,15 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF synchronized (mTransports) { String prevTransport = null; if (mTransports.get(transport) != null) { - prevTransport = mCurrentTransport; - mCurrentTransport = transport; - Settings.Secure.putString(mContext.getContentResolver(), - Settings.Secure.BACKUP_TRANSPORT, transport); + final long oldId = Binder.clearCallingIdentity(); + try { + prevTransport = mCurrentTransport; + mCurrentTransport = transport; + Settings.Secure.putString(mContext.getContentResolver(), + Settings.Secure.BACKUP_TRANSPORT, transport); + } finally { + Binder.restoreCallingIdentity(oldId); + } Slog.v(TAG, "selectBackupTransport() set " + mCurrentTransport + " returning " + prevTransport); } else { |