• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 static android.Manifest.permission.BLUETOOTH_CONNECT;
20 
21 import android.annotation.FlaggedApi;
22 import android.annotation.RequiresPermission;
23 import android.annotation.SdkConstant;
24 import android.annotation.SdkConstant.SdkConstantType;
25 import android.annotation.SuppressLint;
26 import android.annotation.SystemApi;
27 import android.bluetooth.annotations.RequiresBluetoothConnectPermission;
28 
29 import com.android.bluetooth.flags.Flags;
30 
31 /**
32  * A helper to show a system "Device Picker" activity to the user.
33  *
34  * @hide
35  */
36 @SystemApi
37 public interface BluetoothDevicePicker {
38 
39     /**
40      * Extra for filter type used with {@link #ACTION_LAUNCH}. The value must be a boolean
41      * indicating whether the device should need authentication or not.
42      */
43     @SuppressLint("ActionValue")
44     String EXTRA_NEED_AUTH = "android.bluetooth.devicepicker.extra.NEED_AUTH";
45 
46     /**
47      * Extra for filter type used with {@link #ACTION_LAUNCH}. This extra must contain the filter
48      * type that will be applied to the device list. Possible values are {@link #FILTER_TYPE_ALL},
49      * {@link #FILTER_TYPE_AUDIO}, {@link #FILTER_TYPE_TRANSFER}, {@link #FILTER_TYPE_PANU}, and
50      * {@link #FILTER_TYPE_NAP}.
51      */
52     @SuppressLint("ActionValue")
53     String EXTRA_FILTER_TYPE = "android.bluetooth.devicepicker.extra.FILTER_TYPE";
54 
55     /**
56      * Extra for filter type used with {@link #ACTION_LAUNCH}. This extra must contain the package
57      * name that called {@link #ACTION_LAUNCH}.
58      */
59     @SuppressLint("ActionValue")
60     String EXTRA_LAUNCH_PACKAGE = "android.bluetooth.devicepicker.extra.LAUNCH_PACKAGE";
61 
62     /**
63      * Extra for filter type used with {@link #ACTION_LAUNCH}. This extra must contain the class
64      * name that called {@link #ACTION_LAUNCH}.
65      */
66     @SuppressLint("ActionValue")
67     String EXTRA_LAUNCH_CLASS = "android.bluetooth.devicepicker.extra.DEVICE_PICKER_LAUNCH_CLASS";
68 
69     /**
70      * Extra for the original ACTION_SEND or ACTION_SEND_MULTIPLE intent that triggered the BT
71      * sharing.
72      */
73     @FlaggedApi(Flags.FLAG_OPP_DEVICE_PICKER_EXTRA_INTENT_APIS)
74     String EXTRA_DEVICE_PICKER_ORIGINAL_SEND_INTENT =
75             "android.bluetooth.extra.DEVICE_PICKER_ORIGINAL_SEND_INTENT";
76 
77     /**
78      * Broadcast when one BT device is selected from BT device picker screen. Selected {@link
79      * BluetoothDevice} is returned in extra data named {@link BluetoothDevice#EXTRA_DEVICE}.
80      */
81     @RequiresBluetoothConnectPermission
82     @RequiresPermission(BLUETOOTH_CONNECT)
83     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
84     @SuppressLint("ActionValue")
85     String ACTION_DEVICE_SELECTED = "android.bluetooth.devicepicker.action.DEVICE_SELECTED";
86 
87     /**
88      * Broadcast when someone want to select one BT device from devices list. This intent contains
89      * below extra data: - {@link #EXTRA_NEED_AUTH} (boolean): if need authentication - {@link
90      * #EXTRA_FILTER_TYPE} (int): what kinds of device should be listed - {@link
91      * #EXTRA_LAUNCH_PACKAGE} (string): where(which package) this intent come from - {@link
92      * #EXTRA_LAUNCH_CLASS} (string): where(which class) this intent come from
93      */
94     @RequiresBluetoothConnectPermission
95     @RequiresPermission(BLUETOOTH_CONNECT)
96     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
97     @SuppressLint("ActionValue")
98     String ACTION_LAUNCH = "android.bluetooth.devicepicker.action.LAUNCH";
99 
100     /** Ask device picker to show all kinds of BT devices */
101     int FILTER_TYPE_ALL = 0;
102 
103     /** Ask device picker to show BT devices that support AUDIO profiles */
104     int FILTER_TYPE_AUDIO = 1;
105 
106     /** Ask device picker to show BT devices that support Object Transfer */
107     int FILTER_TYPE_TRANSFER = 2;
108 
109     /**
110      * Ask device picker to show BT devices that support Personal Area Networking User (PANU)
111      * profile
112      */
113     int FILTER_TYPE_PANU = 3;
114 
115     /** Ask device picker to show BT devices that support Network Access Point (NAP) profile */
116     int FILTER_TYPE_NAP = 4;
117 }
118