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 public static final String EXTRA_NEED_AUTH = 40 "android.bluetooth.devicepicker.extra.NEED_AUTH"; 41 42 /** 43 * Extra for filter type used with {@link #ACTION_LAUNCH}. 44 * This extra must contain the filter type that will be applied to the device list. 45 * Possible values are {@link #FILTER_TYPE_ALL}, {@link #FILTER_TYPE_AUDIO}, 46 * {@link #FILTER_TYPE_TRANSFER}, {@link #FILTER_TYPE_PANU}, and {@link #FILTER_TYPE_NAP}. 47 */ 48 @SuppressLint("ActionValue") 49 public static final String EXTRA_FILTER_TYPE = 50 "android.bluetooth.devicepicker.extra.FILTER_TYPE"; 51 52 /** 53 * Extra for filter type used with {@link #ACTION_LAUNCH}. 54 * This extra must contain the package name that called {@link #ACTION_LAUNCH}. 55 */ 56 @SuppressLint("ActionValue") 57 public static final String EXTRA_LAUNCH_PACKAGE = 58 "android.bluetooth.devicepicker.extra.LAUNCH_PACKAGE"; 59 60 /** 61 * Extra for filter type used with {@link #ACTION_LAUNCH}. 62 * This extra must contain the class name that called {@link #ACTION_LAUNCH}. 63 */ 64 @SuppressLint("ActionValue") 65 public static final String EXTRA_LAUNCH_CLASS = 66 "android.bluetooth.devicepicker.extra.DEVICE_PICKER_LAUNCH_CLASS"; 67 68 /** 69 * Broadcast when one BT device is selected from BT device picker screen. 70 * Selected {@link BluetoothDevice} is returned in extra data named 71 * {@link BluetoothDevice#EXTRA_DEVICE}. 72 */ 73 @RequiresBluetoothConnectPermission 74 @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) 75 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 76 @SuppressLint("ActionValue") 77 public static final String ACTION_DEVICE_SELECTED = 78 "android.bluetooth.devicepicker.action.DEVICE_SELECTED"; 79 80 /** 81 * Broadcast when someone want to select one BT device from devices list. 82 * This intent contains below extra data: 83 * - {@link #EXTRA_NEED_AUTH} (boolean): if need authentication 84 * - {@link #EXTRA_FILTER_TYPE} (int): what kinds of device should be 85 * listed 86 * - {@link #EXTRA_LAUNCH_PACKAGE} (string): where(which package) this 87 * intent come from 88 * - {@link #EXTRA_LAUNCH_CLASS} (string): where(which class) this intent 89 * come from 90 */ 91 @RequiresBluetoothConnectPermission 92 @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) 93 @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION) 94 @SuppressLint("ActionValue") 95 public static final String ACTION_LAUNCH = 96 "android.bluetooth.devicepicker.action.LAUNCH"; 97 98 /** Ask device picker to show all kinds of BT devices */ 99 public static final int FILTER_TYPE_ALL = 0; 100 /** Ask device picker to show BT devices that support AUDIO profiles */ 101 public static final int FILTER_TYPE_AUDIO = 1; 102 /** Ask device picker to show BT devices that support Object Transfer */ 103 public static final int FILTER_TYPE_TRANSFER = 2; 104 /** 105 * Ask device picker to show BT devices that support 106 * Personal Area Networking User (PANU) profile 107 */ 108 public static final int FILTER_TYPE_PANU = 3; 109 /** Ask device picker to show BT devices that support Network Access Point (NAP) profile */ 110 public static final int FILTER_TYPE_NAP = 4; 111 } 112