1 /*
2  * Copyright (C) 2009 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.bluetooth;
18 
19 import android.annotation.RequiresPermission;
20 import android.annotation.SdkConstant;
21 import android.annotation.SdkConstant.SdkConstantType;
22 import android.annotation.SuppressLint;
23 import android.annotation.SystemApi;
24 import android.bluetooth.annotations.RequiresBluetoothConnectPermission;
25 
26 /**
27  * A helper to show a system "Device Picker" activity to the user.
28  *
29  * @hide
30  */
31 @SystemApi
32 public interface BluetoothDevicePicker {
33 
34     /**
35      * Extra for filter type used with {@link #ACTION_LAUNCH}. The value must be a boolean
36      * indicating whether the device should need authentication or not.
37      */
38     @SuppressLint("ActionValue")
39     String EXTRA_NEED_AUTH = "android.bluetooth.devicepicker.extra.NEED_AUTH";
40 
41     /**
42      * Extra for filter type used with {@link #ACTION_LAUNCH}. This extra must contain the filter
43      * type that will be applied to the device list. Possible values are {@link #FILTER_TYPE_ALL},
44      * {@link #FILTER_TYPE_AUDIO}, {@link #FILTER_TYPE_TRANSFER}, {@link #FILTER_TYPE_PANU}, and
45      * {@link #FILTER_TYPE_NAP}.
46      */
47     @SuppressLint("ActionValue")
48     String EXTRA_FILTER_TYPE = "android.bluetooth.devicepicker.extra.FILTER_TYPE";
49 
50     /**
51      * Extra for filter type used with {@link #ACTION_LAUNCH}. This extra must contain the package
52      * name that called {@link #ACTION_LAUNCH}.
53      */
54     @SuppressLint("ActionValue")
55     String EXTRA_LAUNCH_PACKAGE = "android.bluetooth.devicepicker.extra.LAUNCH_PACKAGE";
56 
57     /**
58      * Extra for filter type used with {@link #ACTION_LAUNCH}. This extra must contain the class
59      * name that called {@link #ACTION_LAUNCH}.
60      */
61     @SuppressLint("ActionValue")
62     String EXTRA_LAUNCH_CLASS = "android.bluetooth.devicepicker.extra.DEVICE_PICKER_LAUNCH_CLASS";
63 
64     /**
65      * Broadcast when one BT device is selected from BT device picker screen. Selected {@link
66      * BluetoothDevice} is returned in extra data named {@link BluetoothDevice#EXTRA_DEVICE}.
67      */
68     @RequiresBluetoothConnectPermission
69     @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
70     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
71     @SuppressLint("ActionValue")
72     String ACTION_DEVICE_SELECTED = "android.bluetooth.devicepicker.action.DEVICE_SELECTED";
73 
74     /**
75      * Broadcast when someone want to select one BT device from devices list. This intent contains
76      * below extra data: - {@link #EXTRA_NEED_AUTH} (boolean): if need authentication - {@link
77      * #EXTRA_FILTER_TYPE} (int): what kinds of device should be listed - {@link
78      * #EXTRA_LAUNCH_PACKAGE} (string): where(which package) this intent come from - {@link
79      * #EXTRA_LAUNCH_CLASS} (string): where(which class) this intent come from
80      */
81     @RequiresBluetoothConnectPermission
82     @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
83     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
84     @SuppressLint("ActionValue")
85     String ACTION_LAUNCH = "android.bluetooth.devicepicker.action.LAUNCH";
86 
87     /** Ask device picker to show all kinds of BT devices */
88     int FILTER_TYPE_ALL = 0;
89 
90     /** Ask device picker to show BT devices that support AUDIO profiles */
91     int FILTER_TYPE_AUDIO = 1;
92 
93     /** Ask device picker to show BT devices that support Object Transfer */
94     int FILTER_TYPE_TRANSFER = 2;
95 
96     /**
97      * Ask device picker to show BT devices that support Personal Area Networking User (PANU)
98      * profile
99      */
100     int FILTER_TYPE_PANU = 3;
101 
102     /** Ask device picker to show BT devices that support Network Access Point (NAP) profile */
103     int FILTER_TYPE_NAP = 4;
104 }
105