Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b73b32c authored by Jack He's avatar Jack He
Browse files

Deprecate BluetoothHealth APIs

* Mark all BluetoothHealth related APIs as deprecated
* Make BluetoothAdapter#getProfileProxy(context, BluetoothProfile.HEALTH)
  always return false
* Remove all logic behind BluetoothHealth APIs and add deprecation error log
* Health Device Profile (HDP) and MCAP protocol has been largely
  replaced by BLE. New applications should use Bluetooth Low Energy
  instead of legacy Bluetooth Health Device Profile

Bug: 111562841
Test: make, unit test, use Bluetooth
Change-Id: If99a9d79e9e1b89b75b9b74bd3b1c965247a1892
Merged-In: If99a9d79e9e1b89b75b9b74bd3b1c965247a1892
(cherry picked from commit 2be70a11)
parent dcfef162
Loading
Loading
Loading
Loading
+31 −29
Original line number Diff line number Diff line
@@ -8339,42 +8339,44 @@ package android.bluetooth {
    field public static final java.lang.String VENDOR_SPECIFIC_HEADSET_EVENT_COMPANY_ID_CATEGORY = "android.bluetooth.headset.intent.category.companyid";
  }
  public final class BluetoothHealth implements android.bluetooth.BluetoothProfile {
    method public boolean connectChannelToSource(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothHealthAppConfiguration);
    method public boolean disconnectChannel(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothHealthAppConfiguration, int);
  public final deprecated class BluetoothHealth implements android.bluetooth.BluetoothProfile {
    ctor public BluetoothHealth();
    method public deprecated boolean connectChannelToSource(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothHealthAppConfiguration);
    method public deprecated boolean disconnectChannel(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothHealthAppConfiguration, int);
    method public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
    method public int getConnectionState(android.bluetooth.BluetoothDevice);
    method public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int[]);
    method public android.os.ParcelFileDescriptor getMainChannelFd(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothHealthAppConfiguration);
    method public boolean registerSinkAppConfiguration(java.lang.String, int, android.bluetooth.BluetoothHealthCallback);
    method public boolean unregisterAppConfiguration(android.bluetooth.BluetoothHealthAppConfiguration);
    field public static final int APP_CONFIG_REGISTRATION_FAILURE = 1; // 0x1
    field public static final int APP_CONFIG_REGISTRATION_SUCCESS = 0; // 0x0
    field public static final int APP_CONFIG_UNREGISTRATION_FAILURE = 3; // 0x3
    field public static final int APP_CONFIG_UNREGISTRATION_SUCCESS = 2; // 0x2
    field public static final int CHANNEL_TYPE_RELIABLE = 10; // 0xa
    field public static final int CHANNEL_TYPE_STREAMING = 11; // 0xb
    field public static final int SINK_ROLE = 2; // 0x2
    field public static final int SOURCE_ROLE = 1; // 0x1
    field public static final int STATE_CHANNEL_CONNECTED = 2; // 0x2
    field public static final int STATE_CHANNEL_CONNECTING = 1; // 0x1
    field public static final int STATE_CHANNEL_DISCONNECTED = 0; // 0x0
    field public static final int STATE_CHANNEL_DISCONNECTING = 3; // 0x3
  }
  public final class BluetoothHealthAppConfiguration implements android.os.Parcelable {
    method public deprecated android.os.ParcelFileDescriptor getMainChannelFd(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothHealthAppConfiguration);
    method public deprecated boolean registerSinkAppConfiguration(java.lang.String, int, android.bluetooth.BluetoothHealthCallback);
    method public deprecated boolean unregisterAppConfiguration(android.bluetooth.BluetoothHealthAppConfiguration);
    field public static final deprecated int APP_CONFIG_REGISTRATION_FAILURE = 1; // 0x1
    field public static final deprecated int APP_CONFIG_REGISTRATION_SUCCESS = 0; // 0x0
    field public static final deprecated int APP_CONFIG_UNREGISTRATION_FAILURE = 3; // 0x3
    field public static final deprecated int APP_CONFIG_UNREGISTRATION_SUCCESS = 2; // 0x2
    field public static final deprecated int CHANNEL_TYPE_RELIABLE = 10; // 0xa
    field public static final deprecated int CHANNEL_TYPE_STREAMING = 11; // 0xb
    field public static final deprecated int SINK_ROLE = 2; // 0x2
    field public static final deprecated int SOURCE_ROLE = 1; // 0x1
    field public static final deprecated int STATE_CHANNEL_CONNECTED = 2; // 0x2
    field public static final deprecated int STATE_CHANNEL_CONNECTING = 1; // 0x1
    field public static final deprecated int STATE_CHANNEL_DISCONNECTED = 0; // 0x0
    field public static final deprecated int STATE_CHANNEL_DISCONNECTING = 3; // 0x3
  }
  public final deprecated class BluetoothHealthAppConfiguration implements android.os.Parcelable {
    ctor public BluetoothHealthAppConfiguration();
    method public int describeContents();
    method public int getDataType();
    method public java.lang.String getName();
    method public int getRole();
    method public deprecated int getDataType();
    method public deprecated java.lang.String getName();
    method public deprecated int getRole();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothHealthAppConfiguration> CREATOR;
    field public static final deprecated android.os.Parcelable.Creator<android.bluetooth.BluetoothHealthAppConfiguration> CREATOR;
  }
  public abstract class BluetoothHealthCallback {
  public abstract deprecated class BluetoothHealthCallback {
    ctor public BluetoothHealthCallback();
    method public void onHealthAppConfigurationStatusChange(android.bluetooth.BluetoothHealthAppConfiguration, int);
    method public void onHealthChannelStateChange(android.bluetooth.BluetoothHealthAppConfiguration, android.bluetooth.BluetoothDevice, int, int, android.os.ParcelFileDescriptor, int);
    method public deprecated void onHealthAppConfigurationStatusChange(android.bluetooth.BluetoothHealthAppConfiguration, int);
    method public deprecated void onHealthChannelStateChange(android.bluetooth.BluetoothHealthAppConfiguration, android.bluetooth.BluetoothDevice, int, int, android.os.ParcelFileDescriptor, int);
  }
  public final class BluetoothHidDevice implements android.bluetooth.BluetoothProfile {
@@ -8471,7 +8473,7 @@ package android.bluetooth {
    field public static final int GATT = 7; // 0x7
    field public static final int GATT_SERVER = 8; // 0x8
    field public static final int HEADSET = 1; // 0x1
    field public static final int HEALTH = 3; // 0x3
    field public static final deprecated int HEALTH = 3; // 0x3
    field public static final int HID_DEVICE = 19; // 0x13
    field public static final int SAP = 10; // 0xa
    field public static final int STATE_CONNECTED = 2; // 0x2
+10 −17
Original line number Diff line number Diff line
@@ -2066,8 +2066,7 @@ public final class BluetoothAdapter {
     * Get the current connection state of a profile.
     * This function can be used to check whether the local Bluetooth adapter
     * is connected to any remote device for a specific profile.
     * Profile can be one of {@link BluetoothProfile#HEALTH}, {@link BluetoothProfile#HEADSET},
     * {@link BluetoothProfile#A2DP}.
     * Profile can be one of {@link BluetoothProfile#HEADSET}, {@link BluetoothProfile#A2DP}.
     *
     * <p> Return value can be one of
     * {@link BluetoothProfile#STATE_DISCONNECTED},
@@ -2441,16 +2440,15 @@ public final class BluetoothAdapter {
    /**
     * Get the profile proxy object associated with the profile.
     *
     * <p>Profile can be one of {@link BluetoothProfile#HEALTH}, {@link BluetoothProfile#HEADSET},
     * {@link BluetoothProfile#A2DP}, {@link BluetoothProfile#GATT}, or
     * {@link BluetoothProfile#GATT_SERVER}. Clients must implement
     * {@link BluetoothProfile.ServiceListener} to get notified of
     * the connection status and to get the proxy object.
     * <p>Profile can be one of {@link BluetoothProfile#HEADSET}, {@link BluetoothProfile#A2DP},
     * {@link BluetoothProfile#GATT}, or {@link BluetoothProfile#GATT_SERVER}. Clients must
     * implement {@link BluetoothProfile.ServiceListener} to get notified of the connection status
     * and to get the proxy object.
     *
     * @param context Context of the application
     * @param listener The service Listener for connection callbacks.
     * @param profile The Bluetooth profile; either {@link BluetoothProfile#HEALTH}, {@link
     * BluetoothProfile#HEADSET}, {@link BluetoothProfile#A2DP}. {@link BluetoothProfile#GATT} or
     * @param profile The Bluetooth profile; either {@link BluetoothProfile#HEADSET},
     * {@link BluetoothProfile#A2DP}. {@link BluetoothProfile#GATT} or
     * {@link BluetoothProfile#GATT_SERVER}.
     * @return true on success, false on error
     */
@@ -2479,8 +2477,8 @@ public final class BluetoothAdapter {
            BluetoothPan pan = new BluetoothPan(context, listener);
            return true;
        } else if (profile == BluetoothProfile.HEALTH) {
            BluetoothHealth health = new BluetoothHealth(context, listener);
            return true;
            Log.e(TAG, "getProfileProxy(): BluetoothHealth is deprecated");
            return false;
        } else if (profile == BluetoothProfile.MAP) {
            BluetoothMap map = new BluetoothMap(context, listener);
            return true;
@@ -2512,8 +2510,7 @@ public final class BluetoothAdapter {
     *
     * <p> Clients should call this when they are no longer using
     * the proxy obtained from {@link #getProfileProxy}.
     * Profile can be one of  {@link BluetoothProfile#HEALTH}, {@link BluetoothProfile#HEADSET} or
     * {@link BluetoothProfile#A2DP}
     * Profile can be one of  {@link BluetoothProfile#HEADSET} or {@link BluetoothProfile#A2DP}
     *
     * @param profile
     * @param proxy Profile proxy object
@@ -2548,10 +2545,6 @@ public final class BluetoothAdapter {
                BluetoothPan pan = (BluetoothPan) proxy;
                pan.close();
                break;
            case BluetoothProfile.HEALTH:
                BluetoothHealth health = (BluetoothHealth) proxy;
                health.close();
                break;
            case BluetoothProfile.GATT:
                BluetoothGatt gatt = (BluetoothGatt) proxy;
                gatt.close();
Loading