• 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 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}.
36      * The value must be a boolean 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}.
43      * This extra must contain the filter type that will be applied to the device list.
44      * Possible values are {@link #FILTER_TYPE_ALL}, {@link #FILTER_TYPE_AUDIO},
45      * {@link #FILTER_TYPE_TRANSFER}, {@link #FILTER_TYPE_PANU}, and {@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}.
52      * This extra must contain the package 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}.
59      * This extra must contain the class 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.
66      * Selected {@link BluetoothDevice} is returned in extra data named
67      * {@link BluetoothDevice#EXTRA_DEVICE}.
68      */
69     @RequiresBluetoothConnectPermission
70     @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
71     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
72     @SuppressLint("ActionValue")
73     String ACTION_DEVICE_SELECTED = "android.bluetooth.devicepicker.action.DEVICE_SELECTED";
74 
75     /**
76      * Broadcast when someone want to select one BT device from devices list.
77      * This intent contains below extra data:
78      * - {@link #EXTRA_NEED_AUTH} (boolean): if need authentication
79      * - {@link #EXTRA_FILTER_TYPE} (int): what kinds of device should be
80      * listed
81      * - {@link #EXTRA_LAUNCH_PACKAGE} (string): where(which package) this
82      * intent come from
83      * - {@link #EXTRA_LAUNCH_CLASS} (string): where(which class) this intent
84      * come from
85      */
86     @RequiresBluetoothConnectPermission
87     @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
88     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
89     @SuppressLint("ActionValue")
90     String ACTION_LAUNCH = "android.bluetooth.devicepicker.action.LAUNCH";
91 
92     /** Ask device picker to show all kinds of BT devices */
93     int FILTER_TYPE_ALL = 0;
94     /** Ask device picker to show BT devices that support AUDIO profiles */
95     int FILTER_TYPE_AUDIO = 1;
96     /** Ask device picker to show BT devices that support Object Transfer */
97     int FILTER_TYPE_TRANSFER = 2;
98     /**
99      * Ask device picker to show BT devices that support
100      * Personal Area Networking User (PANU) profile
101      */
102     int FILTER_TYPE_PANU = 3;
103     /** Ask device picker to show BT devices that support Network Access Point (NAP) profile */
104     int FILTER_TYPE_NAP = 4;
105 }
106