Merge "Remove UserId from UID when checking against BLUETOOTH_UID"

This commit is contained in:
Lorenzo Colitti 2022-04-22 06:51:41 +00:00 • committed by Gerrit Code Review
commit 64ac247056

View file

@ -2879,7 +2879,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
private void enforceNetworkFactoryPermission() {
// TODO: Check for the BLUETOOTH_STACK permission once that is in the API surface.
if (getCallingUid() == Process.BLUETOOTH_UID) return;
if (UserHandle.getAppId(getCallingUid()) == Process.BLUETOOTH_UID) return;
enforceAnyPermissionOf(
android.Manifest.permission.NETWORK_FACTORY,
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK);
@ -2887,7 +2887,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
private void enforceNetworkFactoryOrSettingsPermission() {
// TODO: Check for the BLUETOOTH_STACK permission once that is in the API surface.
if (getCallingUid() == Process.BLUETOOTH_UID) return;
if (UserHandle.getAppId(getCallingUid()) == Process.BLUETOOTH_UID) return;
enforceAnyPermissionOf(
android.Manifest.permission.NETWORK_SETTINGS,
android.Manifest.permission.NETWORK_FACTORY,
@ -2896,7 +2896,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
private void enforceNetworkFactoryOrTestNetworksPermission() {
// TODO: Check for the BLUETOOTH_STACK permission once that is in the API surface.
if (getCallingUid() == Process.BLUETOOTH_UID) return;
if (UserHandle.getAppId(getCallingUid()) == Process.BLUETOOTH_UID) return;
enforceAnyPermissionOf(
android.Manifest.permission.MANAGE_TEST_NETWORKS,
android.Manifest.permission.NETWORK_FACTORY,
@ -2910,7 +2910,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
android.Manifest.permission.NETWORK_SETTINGS, pid, uid)
|| PERMISSION_GRANTED == mContext.checkPermission(
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, pid, uid)
|| uid == Process.BLUETOOTH_UID;
|| UserHandle.getAppId(uid) == Process.BLUETOOTH_UID;
}
private boolean checkSettingsPermission() {