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
This commit is contained in:
Jinsuk Kim
2014-12-13 02:16:28 +09:00
parent c5c93edd93
commit 48cbf292ba

View File

@@ -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);
}
}
}