diff options
author | John Spurlock <jspurlock@google.com> | 2014-12-28 05:42:43 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2014-12-28 05:42:43 +0000 |
commit | bbe3087ec08b22bf3778e1ed77a0d6bfc13611a4 (patch) | |
tree | cc97f564a780a09e59c963967cff203981d6e44c /media | |
parent | 3ab0f694e0a5241c347f5a158683a66a328a415b (diff) | |
parent | db416907b831010cc2854292aa7de85fd8857a77 (diff) | |
download | frameworks_base-bbe3087ec08b22bf3778e1ed77a0d6bfc13611a4.zip frameworks_base-bbe3087ec08b22bf3778e1ed77a0d6bfc13611a4.tar.gz frameworks_base-bbe3087ec08b22bf3778e1ed77a0d6bfc13611a4.tar.bz2 |
am af84e073: Merge "Audio Policy: Clear calling identity for all paths setting ringer mode." into lmp-mr1-dev
automerge: db41690
* commit 'db416907b831010cc2854292aa7de85fd8857a77':
Audio Policy: Clear calling identity for all paths setting ringer mode.
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); } } |