import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
+import android.annotation.UnsupportedAppUsage;
import android.app.ActivityThread;
import android.bluetooth.le.BluetoothLeAdvertiser;
import android.bluetooth.le.BluetoothLeScanner;
"android.bluetooth.adapter.extra.PREVIOUS_STATE";
/** @hide */
- @IntDef({
+ @IntDef(prefix = { "STATE_" }, value = {
STATE_OFF,
STATE_TURNING_ON,
STATE_ON,
"android.bluetooth.adapter.extra.PREVIOUS_SCAN_MODE";
/** @hide */
- @IntDef({SCAN_MODE_NONE, SCAN_MODE_CONNECTABLE, SCAN_MODE_CONNECTABLE_DISCOVERABLE})
+ @IntDef(prefix = { "SCAN_" }, value = {
+ SCAN_MODE_NONE,
+ SCAN_MODE_CONNECTABLE,
+ SCAN_MODE_CONNECTABLE_DISCOVERABLE
+ })
@Retention(RetentionPolicy.SOURCE)
public @interface ScanMode {}
* Intent used to broadcast the change in connection state of the local
* Bluetooth adapter to a profile of the remote device. When the adapter is
* not connected to any profiles of any remote devices and it attempts a
- * connection to a profile this intent will sent. Once connected, this intent
+ * connection to a profile this intent will be sent. Once connected, this intent
* will not be sent for any more connection attempts to any profiles of any
* remote device. When the adapter disconnects from the last profile its
* connected to of any remote device, this intent will be sent.
private static PeriodicAdvertisingManager sPeriodicAdvertisingManager;
private final IBluetoothManager mManagerService;
+ @UnsupportedAppUsage
private IBluetooth mService;
private final ReentrantReadWriteLock mServiceLock = new ReentrantReadWriteLock();
if (!getLeAccess()) {
return null;
}
- if (!isMultipleAdvertisementSupported()) {
- Log.e(TAG, "Bluetooth LE advertising not supported");
- return null;
- }
synchronized (mLock) {
if (sBluetoothLeAdvertiser == null) {
sBluetoothLeAdvertiser = new BluetoothLeAdvertiser(mManagerService);
*/
@RequiresPermission(Manifest.permission.BLUETOOTH)
@AdapterState
+ @UnsupportedAppUsage
public int getLeState() {
int state = BluetoothAdapter.STATE_OFF;
* @return true to indicate adapter shutdown has begun, or false on immediate error
* @hide
*/
+ @UnsupportedAppUsage
public boolean disable(boolean persist) {
try {
* @return true to indicate that the config file was successfully cleared
* @hide
*/
+ @UnsupportedAppUsage
public boolean factoryReset() {
try {
mServiceLock.readLock().lock();
* @return the UUIDs supported by the local Bluetooth Adapter.
* @hide
*/
+ @UnsupportedAppUsage
public ParcelUuid[] getUuids() {
if (getState() != STATE_ON) {
return null;
* @return true if the scan mode was set, false otherwise
* @hide
*/
+ @UnsupportedAppUsage
public boolean setScanMode(@ScanMode int mode, int duration) {
if (getState() != STATE_ON) {
return false;
}
/** @hide */
+ @UnsupportedAppUsage
public boolean setScanMode(int mode) {
if (getState() != STATE_ON) {
return false;
}
/** @hide */
+ @UnsupportedAppUsage
public int getDiscoverableTimeout() {
if (getState() != STATE_ON) {
return -1;
}
/** @hide */
+ @UnsupportedAppUsage
public void setDiscoverableTimeout(int timeout) {
if (getState() != STATE_ON) {
return;
* #STATE_CONNECTING} or {@link #STATE_DISCONNECTED}
* @hide
*/
+ @UnsupportedAppUsage
public int getConnectionState() {
if (getState() != STATE_ON) {
return BluetoothAdapter.STATE_DISCONNECTED;
* permissions, or channel in use.
* @hide
*/
+ @UnsupportedAppUsage
public BluetoothServerSocket listenUsingRfcommOn(int channel, boolean mitm,
boolean min16DigitPin) throws IOException {
BluetoothServerSocket socket =
* permissions, or channel in use.
* @hide
*/
+ @UnsupportedAppUsage
public BluetoothServerSocket listenUsingEncryptedRfcommWithServiceRecord(String name, UUID uuid)
throws IOException {
return createNewRfcommSocketAndRecord(name, uuid, false, true);
return true;
}
+ @UnsupportedAppUsage
/*package*/ IBluetoothManager getBluetoothManager() {
return mManagerService;
}
private final ArrayList<IBluetoothManagerCallback> mProxyServiceStateCallbacks =
new ArrayList<IBluetoothManagerCallback>();
+ @UnsupportedAppUsage
/*package*/ IBluetooth getBluetoothService(IBluetoothManagerCallback cb) {
synchronized (mProxyServiceStateCallbacks) {
if (cb == null) {