OSDN Git Service

audio service: fix BT SCO intent permission again
authorEric Laurent <elaurent@google.com>
Thu, 28 Mar 2013 23:10:45 +0000 (16:10 -0700)
committerEric Laurent <elaurent@google.com>
Thu, 28 Mar 2013 23:10:45 +0000 (16:10 -0700)
Commit 2a57ca93 did not address the calling permission
for setMode() method which can also indirectly call
BluetoothHeadset APIs.

Bug 8242429

Change-Id: I8483c0492836192f47984c48629291cb261b001b

media/java/android/media/AudioService.java

index 38cdb8a..cf48cdb 100644 (file)
@@ -1533,7 +1533,9 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
             // when entering RINGTONE, IN_CALL or IN_COMMUNICATION mode, clear all
             // SCO connections not started by the application changing the mode
             if (newModeOwnerPid != 0) {
-                 disconnectBluetoothSco(newModeOwnerPid);
+                final long ident = Binder.clearCallingIdentity();
+                disconnectBluetoothSco(newModeOwnerPid);
+                Binder.restoreCallingIdentity(ident);
             }
         }