diff options
author | John Spurlock <jspurlock@google.com> | 2014-12-24 01:16:12 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-12-24 01:16:14 +0000 |
commit | af84e073bce12c6ae0c737339804e96314bb663d (patch) | |
tree | ae9d50b0808511ff41a52a02ce3a6a385b0ca0bc /media | |
parent | 45c6ae56d969709e0969514fa219375561c2df38 (diff) | |
parent | af88a19165a1de77948d58b2692c9a7e13712a59 (diff) | |
download | frameworks_base-af84e073bce12c6ae0c737339804e96314bb663d.zip frameworks_base-af84e073bce12c6ae0c737339804e96314bb663d.tar.gz frameworks_base-af84e073bce12c6ae0c737339804e96314bb663d.tar.bz2 |
Merge "Audio Policy: Clear calling identity for all paths setting ringer mode." into lmp-mr1-dev
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioService.java | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index 1c10422..f8688da 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -1841,22 +1841,12 @@ public class AudioService extends IAudioService.Stub { } public void setRingerModeExternal(int ringerMode, String caller) { - final long identity = Binder.clearCallingIdentity(); - try { - setRingerMode(ringerMode, caller, true /*external*/); - } finally { - Binder.restoreCallingIdentity(identity); - } + setRingerMode(ringerMode, caller, true /*external*/); } public void setRingerModeInternal(int ringerMode, String caller) { enforceSelfOrSystemUI("setRingerModeInternal"); - final long identity = Binder.clearCallingIdentity(); - try { - setRingerMode(ringerMode, caller, false /*external*/); - } finally { - Binder.restoreCallingIdentity(identity); - } + setRingerMode(ringerMode, caller, false /*external*/); } private void setRingerMode(int ringerMode, String caller, boolean external) { @@ -1870,28 +1860,33 @@ public class AudioService extends IAudioService.Stub { if ((ringerMode == AudioManager.RINGER_MODE_VIBRATE) && !mHasVibrator) { ringerMode = AudioManager.RINGER_MODE_SILENT; } - synchronized (mSettingsLock) { - final int ringerModeInternal = getRingerModeInternal(); - final int ringerModeExternal = getRingerModeExternal(); - if (external) { - setRingerModeExt(ringerMode); - if (mRingerModeDelegate != null) { - ringerMode = mRingerModeDelegate.onSetRingerModeExternal(ringerModeExternal, - ringerMode, caller, ringerModeInternal); - } - if (ringerMode != ringerModeInternal) { - setRingerModeInt(ringerMode, true /*persist*/); - } - } else /*internal*/ { - if (ringerMode != ringerModeInternal) { - setRingerModeInt(ringerMode, true /*persist*/); - } - if (mRingerModeDelegate != null) { - ringerMode = mRingerModeDelegate.onSetRingerModeInternal(ringerModeInternal, - ringerMode, caller, ringerModeExternal); + final long identity = Binder.clearCallingIdentity(); + try { + synchronized (mSettingsLock) { + final int ringerModeInternal = getRingerModeInternal(); + final int ringerModeExternal = getRingerModeExternal(); + if (external) { + setRingerModeExt(ringerMode); + if (mRingerModeDelegate != null) { + ringerMode = mRingerModeDelegate.onSetRingerModeExternal(ringerModeExternal, + ringerMode, caller, ringerModeInternal); + } + if (ringerMode != ringerModeInternal) { + setRingerModeInt(ringerMode, true /*persist*/); + } + } else /*internal*/ { + if (ringerMode != ringerModeInternal) { + setRingerModeInt(ringerMode, true /*persist*/); + } + if (mRingerModeDelegate != null) { + ringerMode = mRingerModeDelegate.onSetRingerModeInternal(ringerModeInternal, + ringerMode, caller, ringerModeExternal); + } + setRingerModeExt(ringerMode); } - setRingerModeExt(ringerMode); } + } finally { + Binder.restoreCallingIdentity(identity); } } |