diff options
author | Jinsuk Kim <jinsukkim@google.com> | 2014-12-13 02:16:28 +0900 |
---|---|---|
committer | Jinsuk Kim <jinsukkim@google.com> | 2014-12-13 02:22:19 +0900 |
commit | 48cbf292ba9ad550af7e44d950a441b1812428e2 (patch) | |
tree | ca28200210ae13fdeaafb83fcf4a83a42b20c7cf /media | |
parent | c5c93edd9354e956d9b0a4d85fc8372907e2b011 (diff) | |
download | frameworks_base-48cbf292ba9ad550af7e44d950a441b1812428e2.zip frameworks_base-48cbf292ba9ad550af7e44d950a441b1812428e2.tar.gz frameworks_base-48cbf292ba9ad550af7e44d950a441b1812428e2.tar.bz2 |
audioservice: Clear calling identity upon calling HdmiControlService
This makes sure that accessing the HdmiControlService via audio service
should be possible without the system permission.
Bug: 18730526
Change-Id: I05b364d8e38218eb75f3c08972a06bb2d71a982b
Diffstat (limited to 'media')
-rw-r--r-- | media/java/android/media/AudioService.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index 03ecad2..a94573b 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -1159,8 +1159,13 @@ public class AudioService extends IAudioService.Stub { synchronized (mHdmiManager) { if (!mHdmiSystemAudioSupported) return; synchronized (mHdmiTvClient) { - mHdmiTvClient.setSystemAudioVolume( - (oldVolume + 5) / 10, (newVolume + 5) / 10, maxVolume); + final long token = Binder.clearCallingIdentity(); + try { + mHdmiTvClient.setSystemAudioVolume( + (oldVolume + 5) / 10, (newVolume + 5) / 10, maxVolume); + } finally { + Binder.restoreCallingIdentity(token); + } } } } @@ -1538,15 +1543,14 @@ public class AudioService extends IAudioService.Stub { private void setSystemAudioMute(boolean state) { if (mHdmiManager == null || mHdmiTvClient == null) return; synchronized (mHdmiManager) { - final long token = Binder.clearCallingIdentity(); - try { - synchronized (mHdmiTvClient) { - if (mHdmiSystemAudioSupported) { - mHdmiTvClient.setSystemAudioMute(state); - } + if (!mHdmiSystemAudioSupported) return; + synchronized (mHdmiTvClient) { + final long token = Binder.clearCallingIdentity(); + try { + mHdmiTvClient.setSystemAudioMute(state); + } finally { + Binder.restoreCallingIdentity(token); } - } finally { - Binder.restoreCallingIdentity(token); } } } |