Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +14 −3 Original line number Diff line number Diff line Loading @@ -804,7 +804,8 @@ public class SettingsProvider extends ContentProvider { // If this is a setting that is currently restricted for this user, do not allow // unrestricting changes. if (isGlobalOrSecureSettingRestrictedForUser(name, callingUserId, value)) { if (isGlobalOrSecureSettingRestrictedForUser(name, callingUserId, value, Binder.getCallingUid())) { return false; } Loading Loading @@ -935,7 +936,8 @@ public class SettingsProvider extends ContentProvider { // If this is a setting that is currently restricted for this user, do not allow // unrestricting changes. if (isGlobalOrSecureSettingRestrictedForUser(name, callingUserId, value)) { if (isGlobalOrSecureSettingRestrictedForUser(name, callingUserId, value, Binder.getCallingUid())) { return false; } Loading Loading @@ -1158,7 +1160,7 @@ public class SettingsProvider extends ContentProvider { * @return true if the change is prohibited, false if the change is allowed. */ private boolean isGlobalOrSecureSettingRestrictedForUser(String setting, int userId, String value) { String value, int callingUid) { String restriction; switch (setting) { case Settings.Secure.LOCATION_MODE: Loading Loading @@ -1196,6 +1198,15 @@ public class SettingsProvider extends ContentProvider { restriction = UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS; break; case Settings.Secure.ALWAYS_ON_VPN_APP: case Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN: // Whitelist system uid (ConnectivityService) and root uid to change always-on vpn if (callingUid == Process.SYSTEM_UID || callingUid == Process.ROOT_UID) { return false; } restriction = UserManager.DISALLOW_CONFIG_VPN; break; default: if (setting != null && setting.startsWith(Settings.Global.DATA_ROAMING)) { if ("0".equals(value)) return false; Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java +14 −11 Original line number Diff line number Diff line Loading @@ -352,20 +352,23 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EXPANDED_SETTINGS_LAUNCH); if (mSettingsButton.isTunerClick()) { mHost.startRunnableDismissingKeyguard(() -> post(() -> { if (TunerService.isTunerEnabled(mContext)) { TunerService.showResetRequest(mContext, new Runnable() { @Override public void run() { TunerService.showResetRequest(mContext, () -> { // Relaunch settings so that the tuner disappears. startSettingsActivity(); } }); } else { Toast.makeText(getContext(), R.string.tuner_toast, Toast.LENGTH_LONG).show(); Toast.makeText(getContext(), R.string.tuner_toast, Toast.LENGTH_LONG).show(); TunerService.setTunerEnabled(mContext, true); } } startSettingsActivity(); })); } else { startSettingsActivity(); } } else if (v == mAlarmStatus && mNextAlarm != null) { PendingIntent showIntent = mNextAlarm.getShowIntent(); if (showIntent != null && showIntent.isActivity()) { Loading services/core/java/com/android/server/notification/NotificationManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -1989,6 +1989,7 @@ public class NotificationManagerService extends SystemService { android.Manifest.permission.MANAGE_NOTIFICATIONS)) { return; } checkCallerIsSameApp(pkg); if (!checkPolicyAccess(pkg)) { Slog.w(TAG, "Notification policy access denied calling " + method); throw new SecurityException("Notification policy access denied"); Loading Loading @@ -3657,6 +3658,10 @@ public class NotificationManagerService extends SystemService { if (isCallerSystem()) { return; } checkCallerIsSameApp(pkg); } private static void checkCallerIsSameApp(String pkg) { final int uid = Binder.getCallingUid(); try { ApplicationInfo ai = AppGlobals.getPackageManager().getApplicationInfo( Loading Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +14 −3 Original line number Diff line number Diff line Loading @@ -804,7 +804,8 @@ public class SettingsProvider extends ContentProvider { // If this is a setting that is currently restricted for this user, do not allow // unrestricting changes. if (isGlobalOrSecureSettingRestrictedForUser(name, callingUserId, value)) { if (isGlobalOrSecureSettingRestrictedForUser(name, callingUserId, value, Binder.getCallingUid())) { return false; } Loading Loading @@ -935,7 +936,8 @@ public class SettingsProvider extends ContentProvider { // If this is a setting that is currently restricted for this user, do not allow // unrestricting changes. if (isGlobalOrSecureSettingRestrictedForUser(name, callingUserId, value)) { if (isGlobalOrSecureSettingRestrictedForUser(name, callingUserId, value, Binder.getCallingUid())) { return false; } Loading Loading @@ -1158,7 +1160,7 @@ public class SettingsProvider extends ContentProvider { * @return true if the change is prohibited, false if the change is allowed. */ private boolean isGlobalOrSecureSettingRestrictedForUser(String setting, int userId, String value) { String value, int callingUid) { String restriction; switch (setting) { case Settings.Secure.LOCATION_MODE: Loading Loading @@ -1196,6 +1198,15 @@ public class SettingsProvider extends ContentProvider { restriction = UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS; break; case Settings.Secure.ALWAYS_ON_VPN_APP: case Settings.Secure.ALWAYS_ON_VPN_LOCKDOWN: // Whitelist system uid (ConnectivityService) and root uid to change always-on vpn if (callingUid == Process.SYSTEM_UID || callingUid == Process.ROOT_UID) { return false; } restriction = UserManager.DISALLOW_CONFIG_VPN; break; default: if (setting != null && setting.startsWith(Settings.Global.DATA_ROAMING)) { if ("0".equals(value)) return false; Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java +14 −11 Original line number Diff line number Diff line Loading @@ -352,20 +352,23 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_QS_EXPANDED_SETTINGS_LAUNCH); if (mSettingsButton.isTunerClick()) { mHost.startRunnableDismissingKeyguard(() -> post(() -> { if (TunerService.isTunerEnabled(mContext)) { TunerService.showResetRequest(mContext, new Runnable() { @Override public void run() { TunerService.showResetRequest(mContext, () -> { // Relaunch settings so that the tuner disappears. startSettingsActivity(); } }); } else { Toast.makeText(getContext(), R.string.tuner_toast, Toast.LENGTH_LONG).show(); Toast.makeText(getContext(), R.string.tuner_toast, Toast.LENGTH_LONG).show(); TunerService.setTunerEnabled(mContext, true); } } startSettingsActivity(); })); } else { startSettingsActivity(); } } else if (v == mAlarmStatus && mNextAlarm != null) { PendingIntent showIntent = mNextAlarm.getShowIntent(); if (showIntent != null && showIntent.isActivity()) { Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -1989,6 +1989,7 @@ public class NotificationManagerService extends SystemService { android.Manifest.permission.MANAGE_NOTIFICATIONS)) { return; } checkCallerIsSameApp(pkg); if (!checkPolicyAccess(pkg)) { Slog.w(TAG, "Notification policy access denied calling " + method); throw new SecurityException("Notification policy access denied"); Loading Loading @@ -3657,6 +3658,10 @@ public class NotificationManagerService extends SystemService { if (isCallerSystem()) { return; } checkCallerIsSameApp(pkg); } private static void checkCallerIsSameApp(String pkg) { final int uid = Binder.getCallingUid(); try { ApplicationInfo ai = AppGlobals.getPackageManager().getApplicationInfo( Loading