Loading core/res/AndroidManifest.xml +2 −2 Original line number Diff line number Diff line Loading @@ -4511,9 +4511,9 @@ android:protectionLevel="signature" /> <!-- @SystemApi Allows an application to turn on / off quiet mode. @hide <p>Not for use by third-party applications. --> @hide --> <permission android:name="android.permission.MODIFY_QUIET_MODE" android:protectionLevel="signature|privileged" /> android:protectionLevel="signature|privileged|wellbeing" /> <!-- Allows internal management of the camera framework @hide --> Loading services/core/java/com/android/server/pm/UserManagerService.java +9 −3 Original line number Diff line number Diff line Loading @@ -871,7 +871,7 @@ public class UserManagerService extends IUserManager.Stub { "target should only be specified when we are disabling quiet mode."); } ensureCanModifyQuietMode(callingPackage, Binder.getCallingUid(), target != null); ensureCanModifyQuietMode(callingPackage, Binder.getCallingUid(), userId, target != null); final long identity = Binder.clearCallingIdentity(); try { boolean result = false; Loading Loading @@ -903,13 +903,15 @@ public class UserManagerService extends IUserManager.Stub { * <li>Has system UID or root UID</li> * <li>Has {@link Manifest.permission#MODIFY_QUIET_MODE}</li> * <li>Has {@link Manifest.permission#MANAGE_USERS}</li> * <li>Is the foreground default launcher app</li> * </ul> * <p> * If caller wants to start an intent after disabling the quiet mode, it must has * If caller wants to start an intent after disabling the quiet mode, or if it is targeting a * user in a different profile group from the caller, it must have * {@link Manifest.permission#MANAGE_USERS}. */ private void ensureCanModifyQuietMode(String callingPackage, int callingUid, boolean startIntent) { @UserIdInt int targetUserId, boolean startIntent) { if (hasManageUsersPermission()) { return; } Loading @@ -917,6 +919,10 @@ public class UserManagerService extends IUserManager.Stub { throw new SecurityException("MANAGE_USERS permission is required to start intent " + "after disabling quiet mode."); } if (!isSameProfileGroupNoChecks(UserHandle.getUserId(callingUid), targetUserId)) { throw new SecurityException("MANAGE_USERS permission is required to modify quiet mode " + "for a different profile group."); } final boolean hasModifyQuietModePermission = hasPermissionGranted( Manifest.permission.MODIFY_QUIET_MODE, callingUid); if (hasModifyQuietModePermission) { Loading Loading
core/res/AndroidManifest.xml +2 −2 Original line number Diff line number Diff line Loading @@ -4511,9 +4511,9 @@ android:protectionLevel="signature" /> <!-- @SystemApi Allows an application to turn on / off quiet mode. @hide <p>Not for use by third-party applications. --> @hide --> <permission android:name="android.permission.MODIFY_QUIET_MODE" android:protectionLevel="signature|privileged" /> android:protectionLevel="signature|privileged|wellbeing" /> <!-- Allows internal management of the camera framework @hide --> Loading
services/core/java/com/android/server/pm/UserManagerService.java +9 −3 Original line number Diff line number Diff line Loading @@ -871,7 +871,7 @@ public class UserManagerService extends IUserManager.Stub { "target should only be specified when we are disabling quiet mode."); } ensureCanModifyQuietMode(callingPackage, Binder.getCallingUid(), target != null); ensureCanModifyQuietMode(callingPackage, Binder.getCallingUid(), userId, target != null); final long identity = Binder.clearCallingIdentity(); try { boolean result = false; Loading Loading @@ -903,13 +903,15 @@ public class UserManagerService extends IUserManager.Stub { * <li>Has system UID or root UID</li> * <li>Has {@link Manifest.permission#MODIFY_QUIET_MODE}</li> * <li>Has {@link Manifest.permission#MANAGE_USERS}</li> * <li>Is the foreground default launcher app</li> * </ul> * <p> * If caller wants to start an intent after disabling the quiet mode, it must has * If caller wants to start an intent after disabling the quiet mode, or if it is targeting a * user in a different profile group from the caller, it must have * {@link Manifest.permission#MANAGE_USERS}. */ private void ensureCanModifyQuietMode(String callingPackage, int callingUid, boolean startIntent) { @UserIdInt int targetUserId, boolean startIntent) { if (hasManageUsersPermission()) { return; } Loading @@ -917,6 +919,10 @@ public class UserManagerService extends IUserManager.Stub { throw new SecurityException("MANAGE_USERS permission is required to start intent " + "after disabling quiet mode."); } if (!isSameProfileGroupNoChecks(UserHandle.getUserId(callingUid), targetUserId)) { throw new SecurityException("MANAGE_USERS permission is required to modify quiet mode " + "for a different profile group."); } final boolean hasModifyQuietModePermission = hasPermissionGranted( Manifest.permission.MODIFY_QUIET_MODE, callingUid); if (hasModifyQuietModePermission) { Loading