Loading src/com/android/bluetooth/btservice/AbstractionLayer.java +1 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ final public class AbstractionLayer { static final int BT_PROPERTY_REMOTE_FRIENDLY_NAME = 0x0A; static final int BT_PROPERTY_REMOTE_RSSI = 0x0B; static final int BT_PROPERTY_REMOTE_TRUST_VALUE = 0x0C; static final int BT_DEVICE_TYPE_BREDR = 0x01; static final int BT_DEVICE_TYPE_BLE = 0x02; Loading src/com/android/bluetooth/btservice/AdapterService.java +40 −0 Original line number Diff line number Diff line Loading @@ -779,6 +779,31 @@ public class AdapterService extends Service { return service.setRemoteAlias(device, name); } public boolean getRemoteTrust(BluetoothDevice device) { Log.d(TAG,"getRemoteTrust"); if (!Utils.checkCaller()) { Log.w(TAG,"getRemoteTrust(): not allowed for non-active user"); return false; } AdapterService service = getService(); if (service == null) return false; return service.getRemoteTrust(device); } public boolean setRemoteTrust(BluetoothDevice device, boolean trustValue) { Log.d(TAG,"setRemoteTrust to "+ trustValue); if (!Utils.checkCaller()) { Log.w(TAG,"setRemoteTrust(): not allowed for non-active user"); return false; } AdapterService service = getService(); if (service == null) return false; return service.setRemoteTrust(device, trustValue); } public int getRemoteClass(BluetoothDevice device) { if (!Utils.checkCaller()) { Log.w(TAG,"getRemoteClass(): not allowed for non-active user"); Loading Loading @@ -1257,6 +1282,21 @@ public class AdapterService extends Service { return true; } boolean getRemoteTrust(BluetoothDevice device) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(device); if (deviceProp == null) return false; return deviceProp.getTrust(); } boolean setRemoteTrust(BluetoothDevice device, boolean trustValue) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(device); if (deviceProp == null) return false; deviceProp.setTrust(trustValue); return true; } int getRemoteClass(BluetoothDevice device) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(device); Loading src/com/android/bluetooth/btservice/RemoteDevices.java +34 −0 Original line number Diff line number Diff line Loading @@ -113,8 +113,10 @@ final class RemoteDevices { private short mRssi; private ParcelUuid[] mUuids; private int mDeviceType; private int retValue; private String mAlias; private int mBondState; private boolean mTrustValue; DeviceProperties() { mBondState = BluetoothDevice.BOND_NONE; Loading Loading @@ -193,6 +195,30 @@ final class RemoteDevices { } } /** * @return the mtrustValue */ boolean getTrust() { synchronized (mObject) { debugLog("getTrust. returning: "+mTrustValue); return mTrustValue; } } /** * @param mtrustValue, the trust value to set */ void setTrust(boolean trustVal) { int mTempTrustValue; mTempTrustValue = trustVal? 1: 0; mTrustValue = trustVal; synchronized (mObject) { mAdapterService.setDevicePropertyNative(mAddress, AbstractionLayer.BT_PROPERTY_REMOTE_TRUST_VALUE, Utils.intToByteArray(mTempTrustValue)); } } /** * @param mBondState the mBondState to set */ Loading Loading @@ -307,6 +333,14 @@ final class RemoteDevices { // matches the type defined in BluetoothDevice.java device.mDeviceType = Utils.byteArrayToInt(val); break; case AbstractionLayer.BT_PROPERTY_REMOTE_TRUST_VALUE: // The trust Value set for remote device stored in nvram device.retValue = Utils.byteArrayToInt(val); if(device.retValue == 1) device.mTrustValue = true; else device.mTrustValue = false; break; case AbstractionLayer.BT_PROPERTY_REMOTE_RSSI: // RSSI from hal is in one byte device.mRssi = val[0]; Loading Loading
src/com/android/bluetooth/btservice/AbstractionLayer.java +1 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ final public class AbstractionLayer { static final int BT_PROPERTY_REMOTE_FRIENDLY_NAME = 0x0A; static final int BT_PROPERTY_REMOTE_RSSI = 0x0B; static final int BT_PROPERTY_REMOTE_TRUST_VALUE = 0x0C; static final int BT_DEVICE_TYPE_BREDR = 0x01; static final int BT_DEVICE_TYPE_BLE = 0x02; Loading
src/com/android/bluetooth/btservice/AdapterService.java +40 −0 Original line number Diff line number Diff line Loading @@ -779,6 +779,31 @@ public class AdapterService extends Service { return service.setRemoteAlias(device, name); } public boolean getRemoteTrust(BluetoothDevice device) { Log.d(TAG,"getRemoteTrust"); if (!Utils.checkCaller()) { Log.w(TAG,"getRemoteTrust(): not allowed for non-active user"); return false; } AdapterService service = getService(); if (service == null) return false; return service.getRemoteTrust(device); } public boolean setRemoteTrust(BluetoothDevice device, boolean trustValue) { Log.d(TAG,"setRemoteTrust to "+ trustValue); if (!Utils.checkCaller()) { Log.w(TAG,"setRemoteTrust(): not allowed for non-active user"); return false; } AdapterService service = getService(); if (service == null) return false; return service.setRemoteTrust(device, trustValue); } public int getRemoteClass(BluetoothDevice device) { if (!Utils.checkCaller()) { Log.w(TAG,"getRemoteClass(): not allowed for non-active user"); Loading Loading @@ -1257,6 +1282,21 @@ public class AdapterService extends Service { return true; } boolean getRemoteTrust(BluetoothDevice device) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(device); if (deviceProp == null) return false; return deviceProp.getTrust(); } boolean setRemoteTrust(BluetoothDevice device, boolean trustValue) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(device); if (deviceProp == null) return false; deviceProp.setTrust(trustValue); return true; } int getRemoteClass(BluetoothDevice device) { enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission"); DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(device); Loading
src/com/android/bluetooth/btservice/RemoteDevices.java +34 −0 Original line number Diff line number Diff line Loading @@ -113,8 +113,10 @@ final class RemoteDevices { private short mRssi; private ParcelUuid[] mUuids; private int mDeviceType; private int retValue; private String mAlias; private int mBondState; private boolean mTrustValue; DeviceProperties() { mBondState = BluetoothDevice.BOND_NONE; Loading Loading @@ -193,6 +195,30 @@ final class RemoteDevices { } } /** * @return the mtrustValue */ boolean getTrust() { synchronized (mObject) { debugLog("getTrust. returning: "+mTrustValue); return mTrustValue; } } /** * @param mtrustValue, the trust value to set */ void setTrust(boolean trustVal) { int mTempTrustValue; mTempTrustValue = trustVal? 1: 0; mTrustValue = trustVal; synchronized (mObject) { mAdapterService.setDevicePropertyNative(mAddress, AbstractionLayer.BT_PROPERTY_REMOTE_TRUST_VALUE, Utils.intToByteArray(mTempTrustValue)); } } /** * @param mBondState the mBondState to set */ Loading Loading @@ -307,6 +333,14 @@ final class RemoteDevices { // matches the type defined in BluetoothDevice.java device.mDeviceType = Utils.byteArrayToInt(val); break; case AbstractionLayer.BT_PROPERTY_REMOTE_TRUST_VALUE: // The trust Value set for remote device stored in nvram device.retValue = Utils.byteArrayToInt(val); if(device.retValue == 1) device.mTrustValue = true; else device.mTrustValue = false; break; case AbstractionLayer.BT_PROPERTY_REMOTE_RSSI: // RSSI from hal is in one byte device.mRssi = val[0]; Loading