diff options
| author | 2013-09-03 22:36:09 +0000 | |
|---|---|---|
| committer | 2013-09-03 22:36:09 +0000 | |
| commit | 02a25a97a24e06768159ddc2b680c253a2ce71c7 (patch) | |
| tree | a885ee0baa39a6449f3afc12e90cee57b92875b8 | |
| parent | f0abed57397c18f71efe47f02aa69a719390adb5 (diff) | |
| parent | c5470778a4fa8cc22e234fdcfe93fca39de63d36 (diff) | |
Merge "Block ble adv api based on resource config" into klp-dev
| -rw-r--r-- | core/java/android/bluetooth/BluetoothGatt.java | 8 | ||||
| -rw-r--r-- | core/res/res/values/config.xml | 3 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothGatt.java b/core/java/android/bluetooth/BluetoothGatt.java index b390aa12b95c..a2bb78c4c158 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; diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index d4a408dafd11..dd233c546234 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -774,6 +774,9 @@ re-validation --> <bool name="config_bluetooth_address_validation">false</bool> + <!-- Boolean indicating if current platform supports BLE peripheral mode --> + <bool name="config_bluetooth_le_peripheral_mode_supported">false</bool> + <!-- The default data-use polling period. --> <integer name="config_datause_polling_period_sec">600</integer> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index f008b10475d7..cce19e82c8e9 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -248,6 +248,7 @@ <java-symbol type="bool" name="config_allowActionMenuItemTextWithIcon" /> <java-symbol type="bool" name="config_bluetooth_address_validation" /> <java-symbol type="bool" name="config_bluetooth_sco_off_call" /> + <java-symbol type="bool" name="config_bluetooth_le_peripheral_mode_supported" /> <java-symbol type="bool" name="config_cellBroadcastAppLinks" /> <java-symbol type="bool" name="config_duplicate_port_omadm_wappush" /> <java-symbol type="bool" name="config_enable_emergency_call_while_sim_locked" /> |