Loading api/current.txt +31 −29 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading @@ -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 core/java/android/bluetooth/BluetoothAdapter.java +10 −17 Original line number Diff line number Diff line Loading @@ -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}, Loading Loading @@ -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 */ Loading Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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 core/java/android/bluetooth/BluetoothHealth.java +136 −347 File changed.Preview size limit exceeded, changes collapsed. Show changes core/java/android/bluetooth/BluetoothHealthAppConfiguration.java +34 −88 Original line number Diff line number Diff line Loading @@ -25,72 +25,14 @@ import android.os.Parcelable; * the {@link BluetoothHealth} class. This class represents an application configuration * that the Bluetooth Health third party application will register to communicate with the * remote Bluetooth health device. */ public final class BluetoothHealthAppConfiguration implements Parcelable { private final String mName; private final int mDataType; private final int mRole; private final int mChannelType; /** * Constructor to register the SINK role * * @param name Friendly name associated with the application configuration * @param dataType Data Type of the remote Bluetooth Health device * @hide */ BluetoothHealthAppConfiguration(String name, int dataType) { mName = name; mDataType = dataType; mRole = BluetoothHealth.SINK_ROLE; mChannelType = BluetoothHealth.CHANNEL_TYPE_ANY; } /** * Constructor to register the application configuration. * * @param name Friendly name associated with the application configuration * @param dataType Data Type of the remote Bluetooth Health device * @param role {@link BluetoothHealth#SOURCE_ROLE} or {@link BluetoothHealth#SINK_ROLE} * @hide * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ BluetoothHealthAppConfiguration(String name, int dataType, int role, int channelType) { mName = name; mDataType = dataType; mRole = role; mChannelType = channelType; } @Override public boolean equals(Object o) { if (o instanceof BluetoothHealthAppConfiguration) { BluetoothHealthAppConfiguration config = (BluetoothHealthAppConfiguration) o; if (mName == null) return false; return mName.equals(config.getName()) && mDataType == config.getDataType() && mRole == config.getRole() && mChannelType == config.getChannelType(); } return false; } @Override public int hashCode() { int result = 17; result = 31 * result + (mName != null ? mName.hashCode() : 0); result = 31 * result + mDataType; result = 31 * result + mRole; result = 31 * result + mChannelType; return result; } @Override public String toString() { return "BluetoothHealthAppConfiguration [mName = " + mName + ",mDataType = " + mDataType + ", mRole = " + mRole + ",mChannelType = " + mChannelType + "]"; } @Deprecated public final class BluetoothHealthAppConfiguration implements Parcelable { @Override public int describeContents() { return 0; Loading @@ -100,50 +42,59 @@ public final class BluetoothHealthAppConfiguration implements Parcelable { * Return the data type associated with this application configuration. * * @return dataType * * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ @Deprecated public int getDataType() { return mDataType; return 0; } /** * Return the name of the application configuration. * * @return String name * * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ @Deprecated public String getName() { return mName; return null; } /** * Return the role associated with this application configuration. * * @return One of {@link BluetoothHealth#SOURCE_ROLE} or {@link BluetoothHealth#SINK_ROLE} * * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ @Deprecated public int getRole() { return mRole; return 0; } /** * Return the channel type associated with this application configuration. * * @return One of {@link BluetoothHealth#CHANNEL_TYPE_RELIABLE} or {@link * BluetoothHealth#CHANNEL_TYPE_STREAMING} or {@link BluetoothHealth#CHANNEL_TYPE_ANY}. * @hide * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ public int getChannelType() { return mChannelType; } @Deprecated public static final Parcelable.Creator<BluetoothHealthAppConfiguration> CREATOR = new Parcelable.Creator<BluetoothHealthAppConfiguration>() { @Override public BluetoothHealthAppConfiguration createFromParcel(Parcel in) { String name = in.readString(); int type = in.readInt(); int role = in.readInt(); int channelType = in.readInt(); return new BluetoothHealthAppConfiguration(name, type, role, channelType); return new BluetoothHealthAppConfiguration(); } @Override Loading @@ -153,10 +104,5 @@ public final class BluetoothHealthAppConfiguration implements Parcelable { }; @Override public void writeToParcel(Parcel out, int flags) { out.writeString(mName); out.writeInt(mDataType); out.writeInt(mRole); out.writeInt(mChannelType); } public void writeToParcel(Parcel out, int flags) {} } core/java/android/bluetooth/BluetoothHealthCallback.java +18 −0 Original line number Diff line number Diff line Loading @@ -23,7 +23,13 @@ import android.util.Log; /** * This abstract class is used to implement {@link BluetoothHealth} callbacks. * * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ @Deprecated public abstract class BluetoothHealthCallback { private static final String TAG = "BluetoothHealthCallback"; Loading @@ -38,8 +44,14 @@ public abstract class BluetoothHealthCallback { * BluetoothHealth#APP_CONFIG_REGISTRATION_FAILURE} or * {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_SUCCESS} * or {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_FAILURE} * * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ @BinderThread @Deprecated public void onHealthAppConfigurationStatusChange(BluetoothHealthAppConfiguration config, int status) { Log.d(TAG, "onHealthAppConfigurationStatusChange: " + config + "Status: " + status); Loading @@ -58,8 +70,14 @@ public abstract class BluetoothHealthCallback { * @param fd The Parcel File Descriptor when the channel state is connected. * @param channelId The id associated with the channel. This id will be used in future calls * like when disconnecting the channel. * * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ @BinderThread @Deprecated public void onHealthChannelStateChange(BluetoothHealthAppConfiguration config, BluetoothDevice device, int prevState, int newState, ParcelFileDescriptor fd, int channelId) { Loading Loading
api/current.txt +31 −29 Original line number Diff line number Diff line Loading @@ -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 { Loading Loading @@ -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
core/java/android/bluetooth/BluetoothAdapter.java +10 −17 Original line number Diff line number Diff line Loading @@ -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}, Loading Loading @@ -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 */ Loading Loading @@ -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; Loading Loading @@ -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 Loading Loading @@ -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
core/java/android/bluetooth/BluetoothHealth.java +136 −347 File changed.Preview size limit exceeded, changes collapsed. Show changes
core/java/android/bluetooth/BluetoothHealthAppConfiguration.java +34 −88 Original line number Diff line number Diff line Loading @@ -25,72 +25,14 @@ import android.os.Parcelable; * the {@link BluetoothHealth} class. This class represents an application configuration * that the Bluetooth Health third party application will register to communicate with the * remote Bluetooth health device. */ public final class BluetoothHealthAppConfiguration implements Parcelable { private final String mName; private final int mDataType; private final int mRole; private final int mChannelType; /** * Constructor to register the SINK role * * @param name Friendly name associated with the application configuration * @param dataType Data Type of the remote Bluetooth Health device * @hide */ BluetoothHealthAppConfiguration(String name, int dataType) { mName = name; mDataType = dataType; mRole = BluetoothHealth.SINK_ROLE; mChannelType = BluetoothHealth.CHANNEL_TYPE_ANY; } /** * Constructor to register the application configuration. * * @param name Friendly name associated with the application configuration * @param dataType Data Type of the remote Bluetooth Health device * @param role {@link BluetoothHealth#SOURCE_ROLE} or {@link BluetoothHealth#SINK_ROLE} * @hide * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ BluetoothHealthAppConfiguration(String name, int dataType, int role, int channelType) { mName = name; mDataType = dataType; mRole = role; mChannelType = channelType; } @Override public boolean equals(Object o) { if (o instanceof BluetoothHealthAppConfiguration) { BluetoothHealthAppConfiguration config = (BluetoothHealthAppConfiguration) o; if (mName == null) return false; return mName.equals(config.getName()) && mDataType == config.getDataType() && mRole == config.getRole() && mChannelType == config.getChannelType(); } return false; } @Override public int hashCode() { int result = 17; result = 31 * result + (mName != null ? mName.hashCode() : 0); result = 31 * result + mDataType; result = 31 * result + mRole; result = 31 * result + mChannelType; return result; } @Override public String toString() { return "BluetoothHealthAppConfiguration [mName = " + mName + ",mDataType = " + mDataType + ", mRole = " + mRole + ",mChannelType = " + mChannelType + "]"; } @Deprecated public final class BluetoothHealthAppConfiguration implements Parcelable { @Override public int describeContents() { return 0; Loading @@ -100,50 +42,59 @@ public final class BluetoothHealthAppConfiguration implements Parcelable { * Return the data type associated with this application configuration. * * @return dataType * * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ @Deprecated public int getDataType() { return mDataType; return 0; } /** * Return the name of the application configuration. * * @return String name * * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ @Deprecated public String getName() { return mName; return null; } /** * Return the role associated with this application configuration. * * @return One of {@link BluetoothHealth#SOURCE_ROLE} or {@link BluetoothHealth#SINK_ROLE} * * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ @Deprecated public int getRole() { return mRole; return 0; } /** * Return the channel type associated with this application configuration. * * @return One of {@link BluetoothHealth#CHANNEL_TYPE_RELIABLE} or {@link * BluetoothHealth#CHANNEL_TYPE_STREAMING} or {@link BluetoothHealth#CHANNEL_TYPE_ANY}. * @hide * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ public int getChannelType() { return mChannelType; } @Deprecated public static final Parcelable.Creator<BluetoothHealthAppConfiguration> CREATOR = new Parcelable.Creator<BluetoothHealthAppConfiguration>() { @Override public BluetoothHealthAppConfiguration createFromParcel(Parcel in) { String name = in.readString(); int type = in.readInt(); int role = in.readInt(); int channelType = in.readInt(); return new BluetoothHealthAppConfiguration(name, type, role, channelType); return new BluetoothHealthAppConfiguration(); } @Override Loading @@ -153,10 +104,5 @@ public final class BluetoothHealthAppConfiguration implements Parcelable { }; @Override public void writeToParcel(Parcel out, int flags) { out.writeString(mName); out.writeInt(mDataType); out.writeInt(mRole); out.writeInt(mChannelType); } public void writeToParcel(Parcel out, int flags) {} }
core/java/android/bluetooth/BluetoothHealthCallback.java +18 −0 Original line number Diff line number Diff line Loading @@ -23,7 +23,13 @@ import android.util.Log; /** * This abstract class is used to implement {@link BluetoothHealth} callbacks. * * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ @Deprecated public abstract class BluetoothHealthCallback { private static final String TAG = "BluetoothHealthCallback"; Loading @@ -38,8 +44,14 @@ public abstract class BluetoothHealthCallback { * BluetoothHealth#APP_CONFIG_REGISTRATION_FAILURE} or * {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_SUCCESS} * or {@link BluetoothHealth#APP_CONFIG_UNREGISTRATION_FAILURE} * * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ @BinderThread @Deprecated public void onHealthAppConfigurationStatusChange(BluetoothHealthAppConfiguration config, int status) { Log.d(TAG, "onHealthAppConfigurationStatusChange: " + config + "Status: " + status); Loading @@ -58,8 +70,14 @@ public abstract class BluetoothHealthCallback { * @param fd The Parcel File Descriptor when the channel state is connected. * @param channelId The id associated with the channel. This id will be used in future calls * like when disconnecting the channel. * * @deprecated Health Device Profile (HDP) and MCAP protocol are no longer used. New * apps should use Bluetooth Low Energy based solutions such as {@link BluetoothGatt}, * {@link BluetoothAdapter#listenUsingL2capChannel()(int)}, or * {@link BluetoothDevice#createL2capChannel(int)} */ @BinderThread @Deprecated public void onHealthChannelStateChange(BluetoothHealthAppConfiguration config, BluetoothDevice device, int prevState, int newState, ParcelFileDescriptor fd, int channelId) { Loading