OSDN Git Service

Do not return devices when caller has no location permission
authorFyodor Kupolov <fkupolov@google.com>
Fri, 19 Jun 2015 22:35:11 +0000 (15:35 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Thu, 9 Jul 2015 21:38:50 +0000 (21:38 +0000)
During startLeScan, do not return devices if calling process has no location
permission/appop

Bug: 21852542
Change-Id: Idce8f4704558574e373e8144390f2a2fa1a7e84a

core/java/android/bluetooth/IBluetoothGatt.aidl
core/java/android/bluetooth/le/BluetoothLeScanner.java

index 72abeaf..3660be7 100644 (file)
@@ -36,7 +36,7 @@ interface IBluetoothGatt {
 
     void startScan(in int appIf, in boolean isServer, in ScanSettings settings,
                    in List<ScanFilter> filters,
-                   in List scanStorages);
+                   in List scanStorages, in String callingPackage);
     void stopScan(in int appIf, in boolean isServer);
     void flushPendingBatchResults(in int appIf, in boolean isServer);
     void startMultiAdvertising(in int appIf,
index 2e6c4f0..e09ab56 100644 (file)
@@ -19,6 +19,7 @@ package android.bluetooth.le;
 import android.Manifest;
 import android.annotation.RequiresPermission;
 import android.annotation.SystemApi;
+import android.app.ActivityThread;
 import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothGatt;
 import android.bluetooth.BluetoothGattCallbackWrapper;
@@ -313,7 +314,7 @@ public final class BluetoothLeScanner {
                     mClientIf = clientIf;
                     try {
                         mBluetoothGatt.startScan(mClientIf, false, mSettings, mFilters,
-                                mResultStorages);
+                                mResultStorages, ActivityThread.currentOpPackageName());
                     } catch (RemoteException e) {
                         Log.e(TAG, "fail to start le scan: " + e);
                         mClientIf = -1;