From 70e0c58c2269cd29dfd6420d690da13dc03fd457 Mon Sep 17 00:00:00 2001 From: Kenny Guy Date: Tue, 30 Jun 2015 19:18:28 +0100 Subject: Mute correct user from device policy manager. Add per user versions of mute methods so device policy manager can mute the correct user. Just persist change if the calling user isn't the current user. Treat calls to audio manager coming from uid 1000 as if they were coming from current user rather than user 0 so that the correct user's user restriction is checked. Bug: 21782066 Bug: 21778905 Change-Id: I51469b741096d8a2ffdc520eaf5b3fd754f2c819 --- media/java/android/media/AudioManager.java | 9 ++++++--- media/java/android/media/IAudioService.aidl | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'media') diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java index 2c28d8e..3bf8129 100644 --- a/media/java/android/media/AudioManager.java +++ b/media/java/android/media/AudioManager.java @@ -40,6 +40,7 @@ import android.os.Process; import android.os.RemoteException; import android.os.SystemClock; import android.os.ServiceManager; +import android.os.UserHandle; import android.provider.Settings; import android.util.ArrayMap; import android.util.Log; @@ -872,7 +873,8 @@ public class AudioManager { public void setMasterMute(boolean mute, int flags) { IAudioService service = getService(); try { - service.setMasterMute(mute, flags, getContext().getOpPackageName()); + service.setMasterMute(mute, flags, getContext().getOpPackageName(), + UserHandle.getCallingUserId()); } catch (RemoteException e) { Log.e(TAG, "Dead object in setMasterMute", e); } @@ -1551,10 +1553,11 @@ public class AudioManager { * @param on set true to mute the microphone; * false to turn mute off */ - public void setMicrophoneMute(boolean on){ + public void setMicrophoneMute(boolean on) { IAudioService service = getService(); try { - service.setMicrophoneMute(on, getContext().getOpPackageName()); + service.setMicrophoneMute(on, getContext().getOpPackageName(), + UserHandle.getCallingUserId()); } catch (RemoteException e) { Log.e(TAG, "Dead object in setMicrophoneMute", e); } diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl index c75c7e5..8aebe11 100644 --- a/media/java/android/media/IAudioService.aidl +++ b/media/java/android/media/IAudioService.aidl @@ -55,7 +55,7 @@ interface IAudioService { boolean isMasterMute(); - void setMasterMute(boolean mute, int flags, String callingPackage); + void setMasterMute(boolean mute, int flags, String callingPackage, int userId); int getStreamVolume(int streamType); @@ -65,7 +65,7 @@ interface IAudioService { int getLastAudibleStreamVolume(int streamType); - void setMicrophoneMute(boolean on, String callingPackage); + void setMicrophoneMute(boolean on, String callingPackage, int userId); void setRingerModeExternal(int ringerMode, String caller); -- cgit v1.1