am 96195285: am 6f54da32: Merge "Expose a few system APIs for BLE scan only mode." into mnc-dev

* commit '9619528558e9d97eb518d29f7cf72b5fa3fe194c':
  Expose a few system APIs for BLE scan only mode.
This commit is contained in:
Wei Wang
2015-06-02 17:48:59 +00:00
committed by Android Git Automerger
2 changed files with 19 additions and 11 deletions

View File

@@ -6486,7 +6486,9 @@ package android.bluetooth {
method public static boolean checkBluetoothAddress(java.lang.String); method public static boolean checkBluetoothAddress(java.lang.String);
method public void closeProfileProxy(int, android.bluetooth.BluetoothProfile); method public void closeProfileProxy(int, android.bluetooth.BluetoothProfile);
method public boolean disable(); method public boolean disable();
method public boolean disableBLE();
method public boolean enable(); method public boolean enable();
method public boolean enableBLE();
method public java.lang.String getAddress(); method public java.lang.String getAddress();
method public android.bluetooth.le.BluetoothLeAdvertiser getBluetoothLeAdvertiser(); method public android.bluetooth.le.BluetoothLeAdvertiser getBluetoothLeAdvertiser();
method public android.bluetooth.le.BluetoothLeScanner getBluetoothLeScanner(); method public android.bluetooth.le.BluetoothLeScanner getBluetoothLeScanner();
@@ -6502,6 +6504,7 @@ package android.bluetooth {
method public boolean isBleScanAlwaysAvailable(); method public boolean isBleScanAlwaysAvailable();
method public boolean isDiscovering(); method public boolean isDiscovering();
method public boolean isEnabled(); method public boolean isEnabled();
method public boolean isLeEnabled();
method public boolean isMultipleAdvertisementSupported(); method public boolean isMultipleAdvertisementSupported();
method public boolean isOffloadedFilteringSupported(); method public boolean isOffloadedFilteringSupported();
method public boolean isOffloadedScanBatchingSupported(); method public boolean isOffloadedScanBatchingSupported();
@@ -6512,6 +6515,7 @@ package android.bluetooth {
method public deprecated boolean startLeScan(android.bluetooth.BluetoothAdapter.LeScanCallback); method public deprecated boolean startLeScan(android.bluetooth.BluetoothAdapter.LeScanCallback);
method public deprecated boolean startLeScan(java.util.UUID[], android.bluetooth.BluetoothAdapter.LeScanCallback); method public deprecated boolean startLeScan(java.util.UUID[], android.bluetooth.BluetoothAdapter.LeScanCallback);
method public deprecated void stopLeScan(android.bluetooth.BluetoothAdapter.LeScanCallback); method public deprecated void stopLeScan(android.bluetooth.BluetoothAdapter.LeScanCallback);
field public static final java.lang.String ACTION_BLE_STATE_CHANGED = "android.bluetooth.adapter.action.BLE_STATE_CHANGED";
field public static final java.lang.String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED"; field public static final java.lang.String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED";
field public static final java.lang.String ACTION_DISCOVERY_FINISHED = "android.bluetooth.adapter.action.DISCOVERY_FINISHED"; field public static final java.lang.String ACTION_DISCOVERY_FINISHED = "android.bluetooth.adapter.action.DISCOVERY_FINISHED";
field public static final java.lang.String ACTION_DISCOVERY_STARTED = "android.bluetooth.adapter.action.DISCOVERY_STARTED"; field public static final java.lang.String ACTION_DISCOVERY_STARTED = "android.bluetooth.adapter.action.DISCOVERY_STARTED";

View File

@@ -410,6 +410,7 @@ public final class BluetoothAdapter {
* Broadcast Action: The Bluetooth adapter state has changed in LE only mode. * Broadcast Action: The Bluetooth adapter state has changed in LE only mode.
* @hide * @hide
*/ */
@SystemApi
public static final String ACTION_BLE_STATE_CHANGED = public static final String ACTION_BLE_STATE_CHANGED =
"android.bluetooth.adapter.action.BLE_STATE_CHANGED"; "android.bluetooth.adapter.action.BLE_STATE_CHANGED";
@@ -620,17 +621,18 @@ public final class BluetoothAdapter {
* @return true if the local Bluetooth LE adapter is turned on * @return true if the local Bluetooth LE adapter is turned on
* @hide * @hide
*/ */
public boolean isLeEnabled() { @SystemApi
final int state = getLeState(); public boolean isLeEnabled() {
if (state == BluetoothAdapter.STATE_ON) { final int state = getLeState();
if (DBG) Log.d (TAG, "STATE_ON"); if (state == BluetoothAdapter.STATE_ON) {
} else if (state == BluetoothAdapter.STATE_BLE_ON) { if (DBG) Log.d (TAG, "STATE_ON");
if (DBG) Log.d (TAG, "STATE_BLE_ON"); } else if (state == BluetoothAdapter.STATE_BLE_ON) {
} else { if (DBG) Log.d (TAG, "STATE_BLE_ON");
if (DBG) Log.d (TAG, "STATE_OFF"); } else {
return false; if (DBG) Log.d (TAG, "STATE_OFF");
} return false;
return true; }
return true;
} }
/** /**
@@ -680,6 +682,7 @@ public final class BluetoothAdapter {
* immediate error * immediate error
* @hide * @hide
*/ */
@SystemApi
public boolean disableBLE() { public boolean disableBLE() {
if (!isBleScanAlwaysAvailable()) return false; if (!isBleScanAlwaysAvailable()) return false;
@@ -742,6 +745,7 @@ public final class BluetoothAdapter {
* immediate error * immediate error
* @hide * @hide
*/ */
@SystemApi
public boolean enableBLE() { public boolean enableBLE() {
if (!isBleScanAlwaysAvailable()) return false; if (!isBleScanAlwaysAvailable()) return false;