Loading android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +12 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,18 @@ class AdapterProperties { } } /** * Set the Bluetooth Class of Device (CoD) of the adapter. * * @param bytes BluetoothClass of the device */ boolean setBluetoothClass(byte[] bytes) { synchronized (mObject) { return mService.setAdapterPropertyNative( AbstractionLayer.BT_PROPERTY_CLASS_OF_DEVICE, bytes); } } /** * @return the mClass */ Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +20 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.app.AlarmManager; import android.app.PendingIntent; import android.app.Service; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothUuid; Loading Loading @@ -866,6 +867,17 @@ public class AdapterService extends Service { return service.setName(name); } public boolean setBluetoothClass(BluetoothClass bluetoothClass) { if (!Utils.checkCaller()) { Log.w(TAG, "setBluetoothClass() - Not allowed for non-active user"); return false; } AdapterService service = getService(); if (service == null) return false; return service.setBluetoothClass(bluetoothClass); } public int getScanMode() { if (!Utils.checkCallerAllowManagedProfiles(mService)) { Log.w(TAG, "getScanMode() - Not allowed for non-active user"); Loading Loading @@ -1469,6 +1481,13 @@ public class AdapterService extends Service { return mAdapterProperties.setName(name); } boolean setBluetoothClass(BluetoothClass bluetoothClass) { enforceCallingOrSelfPermission( BLUETOOTH_PRIVILEGED, "Need BLUETOOTH PRIVILEGED permission"); return mAdapterProperties.setBluetoothClass(bluetoothClass.getClassOfDeviceBytes()); } int getScanMode() { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +12 −0 Original line number Diff line number Diff line Loading @@ -217,6 +217,18 @@ class AdapterProperties { } } /** * Set the Bluetooth Class of Device (CoD) of the adapter. * * @param bytes BluetoothClass of the device */ boolean setBluetoothClass(byte[] bytes) { synchronized (mObject) { return mService.setAdapterPropertyNative( AbstractionLayer.BT_PROPERTY_CLASS_OF_DEVICE, bytes); } } /** * @return the mClass */ Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +20 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.app.AlarmManager; import android.app.PendingIntent; import android.app.Service; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothUuid; Loading Loading @@ -866,6 +867,17 @@ public class AdapterService extends Service { return service.setName(name); } public boolean setBluetoothClass(BluetoothClass bluetoothClass) { if (!Utils.checkCaller()) { Log.w(TAG, "setBluetoothClass() - Not allowed for non-active user"); return false; } AdapterService service = getService(); if (service == null) return false; return service.setBluetoothClass(bluetoothClass); } public int getScanMode() { if (!Utils.checkCallerAllowManagedProfiles(mService)) { Log.w(TAG, "getScanMode() - Not allowed for non-active user"); Loading Loading @@ -1469,6 +1481,13 @@ public class AdapterService extends Service { return mAdapterProperties.setName(name); } boolean setBluetoothClass(BluetoothClass bluetoothClass) { enforceCallingOrSelfPermission( BLUETOOTH_PRIVILEGED, "Need BLUETOOTH PRIVILEGED permission"); return mAdapterProperties.setBluetoothClass(bluetoothClass.getClassOfDeviceBytes()); } int getScanMode() { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); Loading