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

Commit b8711b6c authored by Jack He's avatar Jack He Committed by android-build-merger
Browse files

Merge "PBAP: Use ACTION_CONNECTION_STATE_CHANGED intent"

am: bb67ea63

Change-Id: I6e2337a0b0f4722b82a91c53c340618b9277f3f6
parents deb4ec76 bb67ea63
Loading
Loading
Loading
Loading
+22 −24
Original line number Diff line number Diff line
@@ -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;
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -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;