diff options
author | Matthew Xie <mattx@google.com> | 2013-08-27 22:42:29 -0700 |
---|---|---|
committer | Matthew Xie <mattx@google.com> | 2013-08-28 15:45:23 -0700 |
commit | c5470778a4fa8cc22e234fdcfe93fca39de63d36 (patch) | |
tree | 1c109a712b2f87745f2d660acfa588b233732041 /core/java | |
parent | 826debf5f806fdab77f9e3aa17d4e32abc87ec77 (diff) | |
download | frameworks_base-c5470778a4fa8cc22e234fdcfe93fca39de63d36.zip frameworks_base-c5470778a4fa8cc22e234fdcfe93fca39de63d36.tar.gz frameworks_base-c5470778a4fa8cc22e234fdcfe93fca39de63d36.tar.bz2 |
Block ble adv api based on resource config
bug 10516911
Change-Id: I7a62103a1116ffbf7c3c934c1794384c0e6fbdd3
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/bluetooth/BluetoothGatt.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothGatt.java b/core/java/android/bluetooth/BluetoothGatt.java index b390aa1..a2bb78c 100644 --- a/core/java/android/bluetooth/BluetoothGatt.java +++ b/core/java/android/bluetooth/BluetoothGatt.java @@ -702,6 +702,10 @@ public final class BluetoothGatt implements BluetoothProfile { * @param start Start or stop advertising */ /*package*/ void listen(boolean start) { + if (mContext == null || !mContext.getResources(). + getBoolean(com.android.internal.R.bool.config_bluetooth_le_peripheral_mode_supported)) { + throw new UnsupportedOperationException("BluetoothGatt#listen is blocked"); + } if (DBG) Log.d(TAG, "listen() - start: " + start); if (mService == null || mClientIf == 0) return; @@ -728,6 +732,10 @@ public final class BluetoothGatt implements BluetoothProfile { /*package*/ void setAdvData(boolean advData, boolean includeName, boolean includeTxPower, Integer minInterval, Integer maxInterval, Integer appearance, Byte[] manufacturerData) { + if (mContext == null || !mContext.getResources(). + getBoolean(com.android.internal.R.bool.config_bluetooth_le_peripheral_mode_supported)) { + throw new UnsupportedOperationException("BluetoothGatt#setAdvData is blocked"); + } if (DBG) Log.d(TAG, "setAdvData()"); if (mService == null || mClientIf == 0) return; |