Loading android/app/src/com/android/bluetooth/pan/PanService.java +10 −4 Original line number Diff line number Diff line Loading @@ -360,6 +360,8 @@ public class PanService extends ProfileService { } public int getConnectionState(BluetoothDevice device) { enforceCallingOrSelfPermission( BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); BluetoothPanDevice panDevice = mPanDevices.get(device); if (panDevice == null) { return BluetoothPan.STATE_DISCONNECTED; Loading @@ -383,7 +385,8 @@ public class PanService extends ProfileService { public boolean isTetheringOn() { // TODO(BT) have a variable marking the on/off state enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); enforceCallingOrSelfPermission( BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); return mTetherOn; } Loading @@ -391,7 +394,8 @@ public class PanService extends ProfileService { if (DBG) { Log.d(TAG, "setBluetoothTethering: " + value + ", mTetherOn: " + mTetherOn); } enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); enforceCallingOrSelfPermission( BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); final Context context = getBaseContext(); ConnectivityManager.enforceTetherChangePermission(context, pkgName); Loading Loading @@ -426,7 +430,8 @@ public class PanService extends ProfileService { * @return true if connectionPolicy is set, false on error */ public boolean setConnectionPolicy(BluetoothDevice device, int connectionPolicy) { enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); enforceCallingOrSelfPermission( BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); if (DBG) { Log.d(TAG, "Saved connectionPolicy " + device + " = " + connectionPolicy); } Loading Loading @@ -461,7 +466,8 @@ public class PanService extends ProfileService { } public List<BluetoothDevice> getConnectedDevices() { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); enforceCallingOrSelfPermission( BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); List<BluetoothDevice> devices = getDevicesMatchingConnectionStates(new int[]{BluetoothProfile.STATE_CONNECTED}); return devices; Loading Loading
android/app/src/com/android/bluetooth/pan/PanService.java +10 −4 Original line number Diff line number Diff line Loading @@ -360,6 +360,8 @@ public class PanService extends ProfileService { } public int getConnectionState(BluetoothDevice device) { enforceCallingOrSelfPermission( BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); BluetoothPanDevice panDevice = mPanDevices.get(device); if (panDevice == null) { return BluetoothPan.STATE_DISCONNECTED; Loading @@ -383,7 +385,8 @@ public class PanService extends ProfileService { public boolean isTetheringOn() { // TODO(BT) have a variable marking the on/off state enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); enforceCallingOrSelfPermission( BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); return mTetherOn; } Loading @@ -391,7 +394,8 @@ public class PanService extends ProfileService { if (DBG) { Log.d(TAG, "setBluetoothTethering: " + value + ", mTetherOn: " + mTetherOn); } enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); enforceCallingOrSelfPermission( BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); final Context context = getBaseContext(); ConnectivityManager.enforceTetherChangePermission(context, pkgName); Loading Loading @@ -426,7 +430,8 @@ public class PanService extends ProfileService { * @return true if connectionPolicy is set, false on error */ public boolean setConnectionPolicy(BluetoothDevice device, int connectionPolicy) { enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH_ADMIN permission"); enforceCallingOrSelfPermission( BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); if (DBG) { Log.d(TAG, "Saved connectionPolicy " + device + " = " + connectionPolicy); } Loading Loading @@ -461,7 +466,8 @@ public class PanService extends ProfileService { } public List<BluetoothDevice> getConnectedDevices() { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); enforceCallingOrSelfPermission( BLUETOOTH_PRIVILEGED, "Need BLUETOOTH_PRIVILEGED permission"); List<BluetoothDevice> devices = getDevicesMatchingConnectionStates(new int[]{BluetoothProfile.STATE_CONNECTED}); return devices; Loading