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
diff --git a/src/com/android/bluetooth/btservice/AdapterService.java b/src/com/android/bluetooth/btservice/AdapterService.java
index 56748be..40528b2 100644
--- a/src/com/android/bluetooth/btservice/AdapterService.java
+++ b/src/com/android/bluetooth/btservice/AdapterService.java
@@ -1922,7 +1922,7 @@
         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)) {
diff --git a/src/com/android/bluetooth/gatt/GattService.java b/src/com/android/bluetooth/gatt/GattService.java
index c14aaac..f3346bf 100644
--- a/src/com/android/bluetooth/gatt/GattService.java
+++ b/src/com/android/bluetooth/gatt/GattService.java
@@ -1921,7 +1921,7 @@
         }
         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 @@
         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) {