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

Commit 6f2dd3a7 authored by Zach Johnson's avatar Zach Johnson
Browse files

Pass full binder UID to checkPackage

Was passing just the user, which failed in multi-user scenarios.

Passing the full user/app UID fixes this.

Change-Id: I164ccbfd7bb42f8d00b5e7a4bfe780f040352a8d
Bug: 118347564
Bug: 118347252
Fixes: 124074037
Test: manual
parent 1296f0a4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1922,7 +1922,7 @@ public class AdapterService extends Service {
        UserHandle callingUser = UserHandle.of(UserHandle.getCallingUserId());
        debugLog("startDiscovery");
        enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission");
        mAppOps.checkPackage(callingUser.getIdentifier(), callingPackage);
        mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
        boolean isQApp = Utils.isQApp(this, callingPackage);
        String permission = null;
        if (Utils.checkCallerHasNetworkSettingsPermission(this)) {
+2 −2
Original line number Diff line number Diff line
@@ -1921,7 +1921,7 @@ public class GattService extends ProfileService {
        }
        final ScanClient scanClient = new ScanClient(scannerId, settings, filters, storages);
        scanClient.userHandle = UserHandle.of(UserHandle.getCallingUserId());
        mAppOps.checkPackage(scanClient.userHandle.getIdentifier(), callingPackage);
        mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
        scanClient.isQApp = Utils.isQApp(this, callingPackage);
        if (scanClient.isQApp) {
            scanClient.hasLocationPermission =
@@ -1968,7 +1968,7 @@ public class GattService extends ProfileService {
        piInfo.callingPackage = callingPackage;
        ScannerMap.App app = mScannerMap.add(uuid, null, null, piInfo, this);
        app.mUserHandle = UserHandle.of(UserHandle.getCallingUserId());
        mAppOps.checkPackage(app.mUserHandle.getIdentifier(), callingPackage);
        mAppOps.checkPackage(Binder.getCallingUid(), callingPackage);
        app.mIsQApp = Utils.isQApp(this, callingPackage);
        try {
            if (app.mIsQApp) {