Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3ac949d authored by Etienne Ruffieux's avatar Etienne Ruffieux
Browse files

fixing CTS tests for BluetoothAdapter restrictions

Tag: #feature
Test: atest
Bug: 218719641
Ignore-AOSP-First: change only in internal
Change-Id: I8e28eafcd6ba9dc67e205eec06ae07639a7e0a60
parent 51ed4f0f
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -1240,7 +1240,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
        final int callingUid = Binder.getCallingUid();
        final int callingPid = Binder.getCallingPid();
        if (!isPrivileged(callingPid, callingUid) && !isDeviceOwner(callingUid, packageName)
                && !CompatChanges.isChangeEnabled(RESTRICT_ENABLE_DISABLE, callingUid)
                && CompatChanges.isChangeEnabled(RESTRICT_ENABLE_DISABLE, callingUid)
                && !isSystem(packageName, callingUid)) {
            return false;
        }
@@ -3061,6 +3061,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub {

    private boolean isPrivileged(int pid, int uid) {
        return (mContext.checkPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED, pid, uid)
                == PackageManager.PERMISSION_GRANTED)
                || (mContext.checkPermission(android.Manifest.permission.NETWORK_SETTINGS, pid, uid)
                == PackageManager.PERMISSION_GRANTED)
                || (mContext.getPackageManager().checkSignatures(uid, Process.SYSTEM_UID)
                == PackageManager.SIGNATURE_MATCH);