summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/api/current.txt7
-rw-r--r--framework/api/system-current.txt18
-rwxr-xr-xframework/java/android/bluetooth/BluetoothClass.java16
-rw-r--r--framework/java/android/bluetooth/BluetoothCodecConfig.java3
-rw-r--r--framework/java/android/bluetooth/BluetoothDevice.java8
-rw-r--r--framework/java/android/bluetooth/BluetoothSap.java24
-rw-r--r--framework/java/android/bluetooth/le/ScanCallback.java27
7 files changed, 49 insertions, 54 deletions
diff --git a/framework/api/current.txt b/framework/api/current.txt
index d5746acbd0..b2dc4367f1 100644
--- a/framework/api/current.txt
+++ b/framework/api/current.txt
@@ -367,6 +367,10 @@ package android.bluetooth {
field public static final int HEALTH_THERMOMETER = 2312; // 0x908
field public static final int HEALTH_UNCATEGORIZED = 2304; // 0x900
field public static final int HEALTH_WEIGHING = 2316; // 0x90c
+ field public static final int PERIPHERAL_KEYBOARD = 1344; // 0x540
+ field public static final int PERIPHERAL_KEYBOARD_POINTING = 1472; // 0x5c0
+ field public static final int PERIPHERAL_NON_KEYBOARD_NON_POINTING = 1280; // 0x500
+ field public static final int PERIPHERAL_POINTING = 1408; // 0x580
field public static final int PHONE_CELLULAR = 516; // 0x204
field public static final int PHONE_CORDLESS = 520; // 0x208
field public static final int PHONE_ISDN = 532; // 0x214
@@ -427,6 +431,7 @@ package android.bluetooth {
method public long getCodecSpecific4();
method public int getCodecType();
method public int getSampleRate();
+ method public boolean isMandatoryCodec();
method public void writeToParcel(android.os.Parcel, int);
field public static final int BITS_PER_SAMPLE_16 = 1; // 0x1
field public static final int BITS_PER_SAMPLE_24 = 2; // 0x2
@@ -1238,6 +1243,8 @@ package android.bluetooth.le {
field public static final int SCAN_FAILED_APPLICATION_REGISTRATION_FAILED = 2; // 0x2
field public static final int SCAN_FAILED_FEATURE_UNSUPPORTED = 4; // 0x4
field public static final int SCAN_FAILED_INTERNAL_ERROR = 3; // 0x3
+ field public static final int SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES = 5; // 0x5
+ field public static final int SCAN_FAILED_SCANNING_TOO_FREQUENTLY = 6; // 0x6
}
public final class ScanFilter implements android.os.Parcelable {
diff --git a/framework/api/system-current.txt b/framework/api/system-current.txt
index b2186f53a5..cbc73461a9 100644
--- a/framework/api/system-current.txt
+++ b/framework/api/system-current.txt
@@ -121,17 +121,6 @@ package android.bluetooth {
field public static final int PROFILE_PANU = 4; // 0x4
}
- public static class BluetoothClass.Device {
- field public static final int PERIPHERAL_KEYBOARD = 1344; // 0x540
- field public static final int PERIPHERAL_KEYBOARD_POINTING = 1472; // 0x5c0
- field public static final int PERIPHERAL_NON_KEYBOARD_NON_POINTING = 1280; // 0x500
- field public static final int PERIPHERAL_POINTING = 1408; // 0x580
- }
-
- public final class BluetoothCodecConfig implements android.os.Parcelable {
- method public boolean isMandatoryCodec();
- }
-
public final class BluetoothCsipSetCoordinator implements java.lang.AutoCloseable android.bluetooth.BluetoothProfile {
method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public java.util.List<java.lang.Integer> getAllGroupIds(@Nullable android.os.ParcelUuid);
method @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public int getConnectionPolicy(@Nullable android.bluetooth.BluetoothDevice);
@@ -627,7 +616,7 @@ package android.bluetooth {
field public static final int VOLUME_CONTROL = 23; // 0x17
}
- public final class BluetoothSap implements android.bluetooth.BluetoothProfile {
+ public final class BluetoothSap implements java.lang.AutoCloseable android.bluetooth.BluetoothProfile {
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public int getConnectionPolicy(@NonNull android.bluetooth.BluetoothDevice);
method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean setConnectionPolicy(@NonNull android.bluetooth.BluetoothDevice, int);
field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.sap.profile.action.CONNECTION_STATE_CHANGED";
@@ -848,11 +837,6 @@ package android.bluetooth.le {
field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.ResultStorageDescriptor> CREATOR;
}
- public abstract class ScanCallback {
- field public static final int SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES = 5; // 0x5
- field public static final int SCAN_FAILED_SCANNING_TOO_FREQUENTLY = 6; // 0x6
- }
-
public final class ScanFilter implements android.os.Parcelable {
method public int getAddressType();
method @Nullable public byte[] getIrk();
diff --git a/framework/java/android/bluetooth/BluetoothClass.java b/framework/java/android/bluetooth/BluetoothClass.java
index bd281fc236..146b627147 100755
--- a/framework/java/android/bluetooth/BluetoothClass.java
+++ b/framework/java/android/bluetooth/BluetoothClass.java
@@ -242,25 +242,9 @@ public final class BluetoothClass implements Parcelable {
public static final int HEALTH_DATA_DISPLAY = 0x091C;
// Devices in PERIPHERAL major class
- /**
- * @hide
- */
- @SystemApi
public static final int PERIPHERAL_NON_KEYBOARD_NON_POINTING = 0x0500;
- /**
- * @hide
- */
- @SystemApi
public static final int PERIPHERAL_KEYBOARD = 0x0540;
- /**
- * @hide
- */
- @SystemApi
public static final int PERIPHERAL_POINTING = 0x0580;
- /**
- * @hide
- */
- @SystemApi
public static final int PERIPHERAL_KEYBOARD_POINTING = 0x05C0;
}
diff --git a/framework/java/android/bluetooth/BluetoothCodecConfig.java b/framework/java/android/bluetooth/BluetoothCodecConfig.java
index b7609c5d64..d0e426853c 100644
--- a/framework/java/android/bluetooth/BluetoothCodecConfig.java
+++ b/framework/java/android/bluetooth/BluetoothCodecConfig.java
@@ -19,7 +19,6 @@ package android.bluetooth;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
-import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@@ -485,9 +484,7 @@ public final class BluetoothCodecConfig implements Parcelable {
* See {@link #SOURCE_CODEC_TYPE_SBC}.
*
* @return {@code true} if the codec is mandatory, {@code false} otherwise
- * @hide
*/
- @SystemApi
public boolean isMandatoryCodec() {
return mCodecType == SOURCE_CODEC_TYPE_SBC;
}
diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java
index 71e15f0063..710a428aff 100644
--- a/framework/java/android/bluetooth/BluetoothDevice.java
+++ b/framework/java/android/bluetooth/BluetoothDevice.java
@@ -264,7 +264,8 @@ public final class BluetoothDevice implements Parcelable, Attributable {
* Used as an Integer extra field in {@link #ACTION_BATTERY_LEVEL_CHANGED}
* intent. It contains the most recently retrieved battery level information
* ranging from 0% to 100% for a remote device, {@link #BATTERY_LEVEL_UNKNOWN}
- * when the valid is unknown or there is an error
+ * when the valid is unknown or there is an error, {@link #BATTERY_LEVEL_BLUETOOTH_OFF} when the
+ * bluetooth is off
*
* @hide
*/
@@ -415,7 +416,10 @@ public final class BluetoothDevice implements Parcelable, Attributable {
/**
* Used as an int extra field in {@link #ACTION_PAIRING_REQUEST}
- * intents as the value of passkey.
+ * intents as the location of initiator. Possible value are:
+ * {@link #EXTRA_PAIRING_INITIATOR_FOREGROUND},
+ * {@link #EXTRA_PAIRING_INITIATOR_BACKGROUND},
+ *
* @hide
*/
@SystemApi
diff --git a/framework/java/android/bluetooth/BluetoothSap.java b/framework/java/android/bluetooth/BluetoothSap.java
index 7a6ba025c2..50c0edf442 100644
--- a/framework/java/android/bluetooth/BluetoothSap.java
+++ b/framework/java/android/bluetooth/BluetoothSap.java
@@ -34,6 +34,7 @@ import android.content.Context;
import android.os.Build;
import android.os.IBinder;
import android.os.RemoteException;
+import android.util.CloseGuard;
import android.util.Log;
import com.android.modules.utils.SynchronousResultReceiver;
@@ -56,17 +57,18 @@ import java.util.concurrent.TimeoutException;
* @hide
*/
@SystemApi
-@SuppressLint("NotCloseable")
-public final class BluetoothSap implements BluetoothProfile {
+public final class BluetoothSap implements BluetoothProfile, AutoCloseable {
private static final String TAG = "BluetoothSap";
private static final boolean DBG = true;
private static final boolean VDBG = false;
+ private CloseGuard mCloseGuard;
+
/**
* Intent used to broadcast the change in connection state of the profile.
*
- * <p>This intent will have 4 extras:
+ * <p>This intent will have 3 extras:
* <ul>
* <li> {@link #EXTRA_STATE} - The current state of the profile. </li>
* <li> {@link #EXTRA_PREVIOUS_STATE}- The previous state of the profile.</li>
@@ -129,15 +131,19 @@ public final class BluetoothSap implements BluetoothProfile {
mAdapter = adapter;
mAttributionSource = adapter.getAttributionSource();
mProfileConnector.connect(context, listener);
+ mCloseGuard = new CloseGuard();
+ mCloseGuard.open("close");
}
- @SuppressLint("GenericException")
- protected void finalize() throws Throwable {
- try {
- close();
- } finally {
- super.finalize();
+ /**
+ *
+ * @hide
+ */
+ protected void finalize() {
+ if (mCloseGuard != null) {
+ mCloseGuard.warnIfOpen();
}
+ close();
}
/**
diff --git a/framework/java/android/bluetooth/le/ScanCallback.java b/framework/java/android/bluetooth/le/ScanCallback.java
index 322f2425cc..45d72ef784 100644
--- a/framework/java/android/bluetooth/le/ScanCallback.java
+++ b/framework/java/android/bluetooth/le/ScanCallback.java
@@ -15,8 +15,11 @@
*/
package android.bluetooth.le;
-import android.annotation.SystemApi;
+import android.annotation.IntDef;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.util.List;
/**
@@ -25,6 +28,21 @@ import java.util.List;
* @see BluetoothLeScanner#startScan
*/
public abstract class ScanCallback {
+ // Le Roles
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(
+ prefix = { "SCAN_FAILED_" },
+ value = {
+ SCAN_FAILED_ALREADY_STARTED,
+ SCAN_FAILED_APPLICATION_REGISTRATION_FAILED,
+ SCAN_FAILED_INTERNAL_ERROR,
+ SCAN_FAILED_FEATURE_UNSUPPORTED,
+ SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES,
+ SCAN_FAILED_SCANNING_TOO_FREQUENTLY,
+ }
+ )
+ public @interface ScanFailed {}
/**
* Fails to start scan as BLE scan with the same settings is already started by the app.
*/
@@ -47,17 +65,12 @@ public abstract class ScanCallback {
/**
* Fails to start scan as it is out of hardware resources.
- *
- * @hide
*/
- @SystemApi
public static final int SCAN_FAILED_OUT_OF_HARDWARE_RESOURCES = 5;
/**
* Fails to start scan as application tries to scan too frequently.
- * @hide
*/
- @SystemApi
public static final int SCAN_FAILED_SCANNING_TOO_FREQUENTLY = 6;
static final int NO_ERROR = 0;
@@ -86,6 +99,6 @@ public abstract class ScanCallback {
*
* @param errorCode Error code (one of SCAN_FAILED_*) for scan failure.
*/
- public void onScanFailed(int errorCode) {
+ public void onScanFailed(@ScanFailed int errorCode) {
}
}