diff options
| author | 2017-10-04 17:42:26 +0000 | |
|---|---|---|
| committer | 2017-10-04 17:42:26 +0000 | |
| commit | 5dfce858ea04b7e5ec12e405a82242713fdd8aa6 (patch) | |
| tree | d8400dcede1c398a5fcf9286fe0422ae97f4fad9 | |
| parent | 2cc6819ebf430c5959c7a6f7636600730d818f91 (diff) | |
| parent | 8057ba832e55c747e57342b55284476cf9d8fd90 (diff) | |
Merge "PBAP: Use ACTION_CONNECTION_STATE_CHANGED intent" am: cfe51aabd2
am: 8057ba832e
Change-Id: I946cce466bb5e048ad7b19cd97caa466dab27a52
| -rw-r--r-- | core/java/android/bluetooth/BluetoothPbap.java | 46 | ||||
| -rw-r--r-- | core/java/android/bluetooth/BluetoothPbapClient.java | 2 | ||||
| -rw-r--r-- | core/res/AndroidManifest.xml | 2 |
3 files changed, 24 insertions, 26 deletions
diff --git a/core/java/android/bluetooth/BluetoothPbap.java b/core/java/android/bluetooth/BluetoothPbap.java index 19f5198ca71a..a1a9347df690 100644 --- a/core/java/android/bluetooth/BluetoothPbap.java +++ b/core/java/android/bluetooth/BluetoothPbap.java @@ -16,6 +16,7 @@ package android.bluetooth; +import android.annotation.SdkConstant; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -53,35 +54,32 @@ public class BluetoothPbap { private static final boolean DBG = true; private static final boolean VDBG = false; - /** int extra for PBAP_STATE_CHANGED_ACTION */ - public static final String PBAP_STATE = - "android.bluetooth.pbap.intent.PBAP_STATE"; - /** int extra for PBAP_STATE_CHANGED_ACTION */ - public static final String PBAP_PREVIOUS_STATE = - "android.bluetooth.pbap.intent.PBAP_PREVIOUS_STATE"; - /** - * Indicates the state of a pbap connection state has changed. - * This intent will always contain PBAP_STATE, PBAP_PREVIOUS_STATE and - * BluetoothIntent.ADDRESS extras. + * Intent used to broadcast the change in connection state of the PBAP + * profile. + * + * <p>This intent will have 3 extras: + * <ul> + * <li> {@link BluetoothProfile#EXTRA_STATE} - The current state of the profile. </li> + * <li> {@link BluetoothProfile#EXTRA_PREVIOUS_STATE}- The previous state of the profile. </li> + * <li> {@link BluetoothDevice#EXTRA_DEVICE} - The remote device. </li> + * </ul> + * <p>{@link BluetoothProfile#EXTRA_STATE} or {@link BluetoothProfile#EXTRA_PREVIOUS_STATE} + * can be any of {@link BluetoothProfile#STATE_DISCONNECTED}, + * {@link BluetoothProfile#STATE_CONNECTING}, {@link BluetoothProfile#STATE_CONNECTED}, + * {@link BluetoothProfile#STATE_DISCONNECTING}. + * <p>Requires {@link android.Manifest.permission#BLUETOOTH} permission to + * receive. */ - public static final String PBAP_STATE_CHANGED_ACTION = - "android.bluetooth.pbap.intent.action.PBAP_STATE_CHANGED"; + @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION) + public static final String ACTION_CONNECTION_STATE_CHANGED = + "android.bluetooth.pbap.profile.action.CONNECTION_STATE_CHANGED"; private volatile IBluetoothPbap mService; private final Context mContext; private ServiceListener mServiceListener; private BluetoothAdapter mAdapter; - /** There was an error trying to obtain the state */ - public static final int STATE_ERROR = -1; - /** No client currently connected */ - public static final int STATE_DISCONNECTED = 0; - /** Connection attempt in progress */ - public static final int STATE_CONNECTING = 1; - /** Client is currently connected */ - public static final int STATE_CONNECTED = 2; - public static final int RESULT_FAILURE = 0; public static final int RESULT_SUCCESS = 1; /** Connection canceled before completion. */ @@ -209,8 +207,8 @@ public class BluetoothPbap { /** * Get the current state of the BluetoothPbap service. * - * @return One of the STATE_ return codes, or STATE_ERROR if this proxy object is currently not - * connected to the Pbap service. + * @return One of the STATE_ return codes, or {@link BluetoothProfile#STATE_DISCONNECTED} + * if this proxy object is currently not connected to the Pbap service. */ public int getState() { if (VDBG) log("getState()"); @@ -225,7 +223,7 @@ public class BluetoothPbap { Log.w(TAG, "Proxy not attached to service"); if (DBG) log(Log.getStackTraceString(new Throwable())); } - return BluetoothPbap.STATE_ERROR; + return BluetoothProfile.STATE_DISCONNECTED; } /** diff --git a/core/java/android/bluetooth/BluetoothPbapClient.java b/core/java/android/bluetooth/BluetoothPbapClient.java index 00a15f3f7087..01b3f6e0e841 100644 --- a/core/java/android/bluetooth/BluetoothPbapClient.java +++ b/core/java/android/bluetooth/BluetoothPbapClient.java @@ -40,7 +40,7 @@ public final class BluetoothPbapClient implements BluetoothProfile { private static final boolean VDBG = false; public static final String ACTION_CONNECTION_STATE_CHANGED = - "android.bluetooth.pbap.profile.action.CONNECTION_STATE_CHANGED"; + "android.bluetooth.pbapclient.profile.action.CONNECTION_STATE_CHANGED"; private volatile IBluetoothPbapClient mService; private final Context mContext; diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index ee6a61d4d63c..9c7bfe7d49d1 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -203,8 +203,8 @@ android:name="com.android.bluetooth.BluetoothMapContentObserver.action.MESSAGE_DELIVERY" /> <protected-broadcast android:name="android.bluetooth.pan.profile.action.CONNECTION_STATE_CHANGED" /> - <protected-broadcast android:name="android.bluetooth.pbap.intent.action.PBAP_STATE_CHANGED" /> <protected-broadcast android:name="android.bluetooth.pbap.profile.action.CONNECTION_STATE_CHANGED" /> + <protected-broadcast android:name="android.bluetooth.pbapclient.profile.action.CONNECTION_STATE_CHANGED" /> <protected-broadcast android:name="android.bluetooth.sap.profile.action.CONNECTION_STATE_CHANGED" /> <protected-broadcast android:name="android.btopp.intent.action.INCOMING_FILE_NOTIFICATION" /> <protected-broadcast android:name="android.btopp.intent.action.USER_CONFIRMATION_TIMEOUT" /> |