Loading core/java/android/os/UserManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -579,6 +579,16 @@ public class UserManager { */ public static final String DISALLOW_CAMERA = "no_camera"; /** * Specifies if a user is not allowed to unmute the device's master volume. * * @see DevicePolicyManager#setMasterVolumeMuted(ComponentName, boolean) * @see DevicePolicyManager#clearUserRestriction(ComponentName, String) * @see #getUserRestrictions() * @hide */ public static final String DISALLLOW_UNMUTE_DEVICE = "disallow_unmute_device"; /** * Specifies if a user is not allowed to use cellular data when roaming. This can only be set by * device owners. The default value is <code>false</code>. Loading services/core/java/com/android/server/audio/AudioService.java +9 −4 Original line number Diff line number Diff line Loading @@ -1130,8 +1130,11 @@ public class AudioService extends IAudioService.Stub { final int currentUser = getCurrentUserId(); // Check the current user restriction. boolean masterMute = mUserManagerInternal.getUserRestriction( currentUser, UserManager.DISALLOW_ADJUST_VOLUME); boolean masterMute = mUserManagerInternal.getUserRestriction(currentUser, UserManager.DISALLLOW_UNMUTE_DEVICE) || mUserManagerInternal.getUserRestriction(currentUser, UserManager.DISALLOW_ADJUST_VOLUME); if (mUseFixedVolume) { masterMute = false; AudioSystem.setMasterVolume(1.0f); Loading Loading @@ -5380,9 +5383,11 @@ public class AudioService extends IAudioService.Stub { // Update speaker mute state. { final boolean wasRestricted = prevRestrictions.getBoolean(UserManager.DISALLOW_ADJUST_VOLUME); prevRestrictions.getBoolean(UserManager.DISALLOW_ADJUST_VOLUME) || prevRestrictions.getBoolean(UserManager.DISALLLOW_UNMUTE_DEVICE); final boolean isRestricted = newRestrictions.getBoolean(UserManager.DISALLOW_ADJUST_VOLUME); newRestrictions.getBoolean(UserManager.DISALLOW_ADJUST_VOLUME) || newRestrictions.getBoolean(UserManager.DISALLLOW_UNMUTE_DEVICE); if (wasRestricted != isRestricted) { setMasterMuteInternalNoCallerCheck(isRestricted, /* flags =*/ 0, userId); } Loading services/core/java/com/android/server/pm/UserRestrictionsUtils.java +5 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,8 @@ public class UserRestrictionsUtils { UserManager.DISALLOW_DATA_ROAMING, UserManager.DISALLOW_SET_USER_ICON, UserManager.DISALLOW_SET_WALLPAPER, UserManager.DISALLOW_OEM_UNLOCK UserManager.DISALLOW_OEM_UNLOCK, UserManager.DISALLLOW_UNMUTE_DEVICE, }); /** Loading Loading @@ -150,7 +151,8 @@ public class UserRestrictionsUtils { private static final Set<String> GLOBAL_RESTRICTIONS = Sets.newArraySet( UserManager.DISALLOW_ADJUST_VOLUME, UserManager.DISALLOW_RUN_IN_BACKGROUND, UserManager.DISALLOW_UNMUTE_MICROPHONE UserManager.DISALLOW_UNMUTE_MICROPHONE, UserManager.DISALLLOW_UNMUTE_DEVICE ); /** Loading Loading @@ -439,6 +441,7 @@ public class UserRestrictionsUtils { manager.setOemUnlockEnabled(false); } } break; } } finally { Binder.restoreCallingIdentity(id); Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +1 −11 Original line number Diff line number Diff line Loading @@ -7930,17 +7930,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { Preconditions.checkNotNull(who, "ComponentName is null"); synchronized (this) { getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); int userId = UserHandle.getCallingUserId(); long identity = mInjector.binderClearCallingIdentity(); try { IAudioService iAudioService = IAudioService.Stub.asInterface( ServiceManager.getService(Context.AUDIO_SERVICE)); iAudioService.setMasterMute(on, 0, mContext.getPackageName(), userId); } catch (RemoteException re) { Slog.e(LOG_TAG, "Failed to setMasterMute", re); } finally { mInjector.binderRestoreCallingIdentity(identity); } setUserRestriction(who, UserManager.DISALLLOW_UNMUTE_DEVICE, on); } } Loading Loading
core/java/android/os/UserManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -579,6 +579,16 @@ public class UserManager { */ public static final String DISALLOW_CAMERA = "no_camera"; /** * Specifies if a user is not allowed to unmute the device's master volume. * * @see DevicePolicyManager#setMasterVolumeMuted(ComponentName, boolean) * @see DevicePolicyManager#clearUserRestriction(ComponentName, String) * @see #getUserRestrictions() * @hide */ public static final String DISALLLOW_UNMUTE_DEVICE = "disallow_unmute_device"; /** * Specifies if a user is not allowed to use cellular data when roaming. This can only be set by * device owners. The default value is <code>false</code>. Loading
services/core/java/com/android/server/audio/AudioService.java +9 −4 Original line number Diff line number Diff line Loading @@ -1130,8 +1130,11 @@ public class AudioService extends IAudioService.Stub { final int currentUser = getCurrentUserId(); // Check the current user restriction. boolean masterMute = mUserManagerInternal.getUserRestriction( currentUser, UserManager.DISALLOW_ADJUST_VOLUME); boolean masterMute = mUserManagerInternal.getUserRestriction(currentUser, UserManager.DISALLLOW_UNMUTE_DEVICE) || mUserManagerInternal.getUserRestriction(currentUser, UserManager.DISALLOW_ADJUST_VOLUME); if (mUseFixedVolume) { masterMute = false; AudioSystem.setMasterVolume(1.0f); Loading Loading @@ -5380,9 +5383,11 @@ public class AudioService extends IAudioService.Stub { // Update speaker mute state. { final boolean wasRestricted = prevRestrictions.getBoolean(UserManager.DISALLOW_ADJUST_VOLUME); prevRestrictions.getBoolean(UserManager.DISALLOW_ADJUST_VOLUME) || prevRestrictions.getBoolean(UserManager.DISALLLOW_UNMUTE_DEVICE); final boolean isRestricted = newRestrictions.getBoolean(UserManager.DISALLOW_ADJUST_VOLUME); newRestrictions.getBoolean(UserManager.DISALLOW_ADJUST_VOLUME) || newRestrictions.getBoolean(UserManager.DISALLLOW_UNMUTE_DEVICE); if (wasRestricted != isRestricted) { setMasterMuteInternalNoCallerCheck(isRestricted, /* flags =*/ 0, userId); } Loading
services/core/java/com/android/server/pm/UserRestrictionsUtils.java +5 −2 Original line number Diff line number Diff line Loading @@ -105,7 +105,8 @@ public class UserRestrictionsUtils { UserManager.DISALLOW_DATA_ROAMING, UserManager.DISALLOW_SET_USER_ICON, UserManager.DISALLOW_SET_WALLPAPER, UserManager.DISALLOW_OEM_UNLOCK UserManager.DISALLOW_OEM_UNLOCK, UserManager.DISALLLOW_UNMUTE_DEVICE, }); /** Loading Loading @@ -150,7 +151,8 @@ public class UserRestrictionsUtils { private static final Set<String> GLOBAL_RESTRICTIONS = Sets.newArraySet( UserManager.DISALLOW_ADJUST_VOLUME, UserManager.DISALLOW_RUN_IN_BACKGROUND, UserManager.DISALLOW_UNMUTE_MICROPHONE UserManager.DISALLOW_UNMUTE_MICROPHONE, UserManager.DISALLLOW_UNMUTE_DEVICE ); /** Loading Loading @@ -439,6 +441,7 @@ public class UserRestrictionsUtils { manager.setOemUnlockEnabled(false); } } break; } } finally { Binder.restoreCallingIdentity(id); Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +1 −11 Original line number Diff line number Diff line Loading @@ -7930,17 +7930,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { Preconditions.checkNotNull(who, "ComponentName is null"); synchronized (this) { getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); int userId = UserHandle.getCallingUserId(); long identity = mInjector.binderClearCallingIdentity(); try { IAudioService iAudioService = IAudioService.Stub.asInterface( ServiceManager.getService(Context.AUDIO_SERVICE)); iAudioService.setMasterMute(on, 0, mContext.getPackageName(), userId); } catch (RemoteException re) { Slog.e(LOG_TAG, "Failed to setMasterMute", re); } finally { mInjector.binderRestoreCallingIdentity(identity); } setUserRestriction(who, UserManager.DISALLLOW_UNMUTE_DEVICE, on); } } Loading