summaryrefslogtreecommitdiff
path: root/framework/java/android/bluetooth/BluetoothDevicePicker.java
blob: d1fc0622e4d73f1e12c79cd7c2b4da8924328def (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
 * Copyright (C) 2009 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.bluetooth;

import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.bluetooth.annotations.RequiresBluetoothConnectPermission;

/**
 * A helper to show a system "Device Picker" activity to the user.
 *
 * @hide
 */
@SystemApi
public interface BluetoothDevicePicker {

    /**
     * Extra for filter type used with {@link #ACTION_LAUNCH}.
     * The value must be a boolean indicating whether the device should need authentication or not.
     */
    @SuppressLint("ActionValue")
    public static final String EXTRA_NEED_AUTH =
            "android.bluetooth.devicepicker.extra.NEED_AUTH";

    /**
     * Extra for filter type used with {@link #ACTION_LAUNCH}.
     * This extra must contain the filter type that will be applied to the device list.
     * Possible values are {@link #FILTER_TYPE_ALL}, {@link #FILTER_TYPE_AUDIO},
     * {@link #FILTER_TYPE_TRANSFER}, {@link #FILTER_TYPE_PANU}, and {@link #FILTER_TYPE_NAP}.
     */
    @SuppressLint("ActionValue")
    public static final String EXTRA_FILTER_TYPE =
            "android.bluetooth.devicepicker.extra.FILTER_TYPE";

    /**
     * Extra for filter type used with {@link #ACTION_LAUNCH}.
     * This extra must contain the package name that called {@link #ACTION_LAUNCH}.
     */
    @SuppressLint("ActionValue")
    public static final String EXTRA_LAUNCH_PACKAGE =
            "android.bluetooth.devicepicker.extra.LAUNCH_PACKAGE";

    /**
     * Extra for filter type used with {@link #ACTION_LAUNCH}.
     * This extra must contain the class name that called {@link #ACTION_LAUNCH}.
     */
    @SuppressLint("ActionValue")
    public static final String EXTRA_LAUNCH_CLASS =
            "android.bluetooth.devicepicker.extra.DEVICE_PICKER_LAUNCH_CLASS";

    /**
     * Broadcast when one BT device is selected from BT device picker screen.
     * Selected {@link BluetoothDevice} is returned in extra data named
     * {@link BluetoothDevice#EXTRA_DEVICE}.
     */
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @SuppressLint("ActionValue")
    public static final String ACTION_DEVICE_SELECTED =
            "android.bluetooth.devicepicker.action.DEVICE_SELECTED";

    /**
     * Broadcast when someone want to select one BT device from devices list.
     * This intent contains below extra data:
     * - {@link #EXTRA_NEED_AUTH} (boolean): if need authentication
     * - {@link #EXTRA_FILTER_TYPE} (int): what kinds of device should be
     * listed
     * - {@link #EXTRA_LAUNCH_PACKAGE} (string): where(which package) this
     * intent come from
     * - {@link #EXTRA_LAUNCH_CLASS} (string): where(which class) this intent
     * come from
     */
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    @SuppressLint("ActionValue")
    public static final String ACTION_LAUNCH =
            "android.bluetooth.devicepicker.action.LAUNCH";

    /** Ask device picker to show all kinds of BT devices */
    public static final int FILTER_TYPE_ALL = 0;
    /** Ask device picker to show BT devices that support AUDIO profiles */
    public static final int FILTER_TYPE_AUDIO = 1;
    /** Ask device picker to show BT devices that support Object Transfer */
    public static final int FILTER_TYPE_TRANSFER = 2;
    /**
     * Ask device picker to show BT devices that support
     * Personal Area Networking User (PANU) profile
     */
    public static final int FILTER_TYPE_PANU = 3;
    /** Ask device picker to show BT devices that support Network Access Point (NAP) profile */
    public static final int FILTER_TYPE_NAP = 4;
}