1 /* 2 * Copyright 2008 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.bluetooth.BluetoothDevice; 20 import android.content.AttributionSource; 21 22 /** 23 * API for Bluetooth Headset service 24 * 25 * Note before adding anything new: 26 * Internal interactions within com.android.bluetooth should be handled through 27 * HeadsetService directly instead of going through binder 28 * 29 * {@hide} 30 */ 31 interface IBluetoothHeadset { 32 // Public API 33 @UnsupportedAppUsage 34 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getConnectedDevices()35 List<BluetoothDevice> getConnectedDevices(); 36 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getConnectedDevicesWithAttribution(in AttributionSource attributionSource)37 List<BluetoothDevice> getConnectedDevicesWithAttribution(in AttributionSource attributionSource); 38 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getDevicesMatchingConnectionStates(in int[] states, in AttributionSource attributionSource)39 List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states, in AttributionSource attributionSource); 40 @UnsupportedAppUsage 41 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getConnectionState(in BluetoothDevice device)42 int getConnectionState(in BluetoothDevice device); 43 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getConnectionStateWithAttribution(in BluetoothDevice device, in AttributionSource attributionSource)44 int getConnectionStateWithAttribution(in BluetoothDevice device, in AttributionSource attributionSource); 45 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.MODIFY_PHONE_STATE})") startVoiceRecognition(in BluetoothDevice device, in AttributionSource attributionSource)46 boolean startVoiceRecognition(in BluetoothDevice device, in AttributionSource attributionSource); 47 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") stopVoiceRecognition(in BluetoothDevice device, in AttributionSource attributionSource)48 boolean stopVoiceRecognition(in BluetoothDevice device, in AttributionSource attributionSource); 49 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") isAudioConnected(in BluetoothDevice device, in AttributionSource attributionSource)50 boolean isAudioConnected(in BluetoothDevice device, in AttributionSource attributionSource); 51 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") sendVendorSpecificResultCode(in BluetoothDevice device, in String command, in String arg, in AttributionSource attributionSource)52 boolean sendVendorSpecificResultCode(in BluetoothDevice device, in String command, in String arg, in AttributionSource attributionSource); 53 54 // Hidden API 55 @UnsupportedAppUsage 56 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.MODIFY_PHONE_STATE})") connect(in BluetoothDevice device)57 boolean connect(in BluetoothDevice device); 58 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.MODIFY_PHONE_STATE})") connectWithAttribution(in BluetoothDevice device, in AttributionSource attributionSource)59 boolean connectWithAttribution(in BluetoothDevice device, in AttributionSource attributionSource); 60 @UnsupportedAppUsage 61 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") disconnect(in BluetoothDevice device)62 boolean disconnect(in BluetoothDevice device); 63 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") disconnectWithAttribution(in BluetoothDevice device, in AttributionSource attributionSource)64 boolean disconnectWithAttribution(in BluetoothDevice device, in AttributionSource attributionSource); 65 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED,android.Manifest.permission.MODIFY_PHONE_STATE})") setConnectionPolicy(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource)66 boolean setConnectionPolicy(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource); 67 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") getConnectionPolicy(in BluetoothDevice device, in AttributionSource attributionSource)68 int getConnectionPolicy(in BluetoothDevice device, in AttributionSource attributionSource); 69 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getAudioState(in BluetoothDevice device, in AttributionSource attributionSource)70 int getAudioState(in BluetoothDevice device, in AttributionSource attributionSource); 71 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") isAudioOn(in AttributionSource attributionSource)72 boolean isAudioOn(in AttributionSource attributionSource); 73 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") connectAudio(in AttributionSource attributionSource)74 boolean connectAudio(in AttributionSource attributionSource); 75 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") disconnectAudio(in AttributionSource attributionSource)76 boolean disconnectAudio(in AttributionSource attributionSource); 77 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") setAudioRouteAllowed(boolean allowed, in AttributionSource attributionSource)78 void setAudioRouteAllowed(boolean allowed, in AttributionSource attributionSource); 79 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getAudioRouteAllowed(in AttributionSource attributionSource)80 boolean getAudioRouteAllowed(in AttributionSource attributionSource); 81 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") setForceScoAudio(boolean forced, in AttributionSource attributionSource)82 void setForceScoAudio(boolean forced, in AttributionSource attributionSource); 83 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.MODIFY_PHONE_STATE})") startScoUsingVirtualVoiceCall(in AttributionSource attributionSource)84 boolean startScoUsingVirtualVoiceCall(in AttributionSource attributionSource); 85 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.MODIFY_PHONE_STATE})") stopScoUsingVirtualVoiceCall(in AttributionSource attributionSource)86 boolean stopScoUsingVirtualVoiceCall(in AttributionSource attributionSource); 87 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.MODIFY_PHONE_STATE})") phoneStateChanged(int numActive, int numHeld, int callState, String number, int type, String name, in AttributionSource attributionSource)88 oneway void phoneStateChanged(int numActive, int numHeld, int callState, String number, int type, String name, in AttributionSource attributionSource); 89 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.MODIFY_PHONE_STATE})") clccResponse(int index, int direction, int status, int mode, boolean mpty, String number, int type, in AttributionSource attributionSource)90 void clccResponse(int index, int direction, int status, int mode, boolean mpty, String number, int type, in AttributionSource attributionSource); 91 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.MODIFY_PHONE_STATE})") setActiveDevice(in BluetoothDevice device, in AttributionSource attributionSource)92 boolean setActiveDevice(in BluetoothDevice device, in AttributionSource attributionSource); 93 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getActiveDevice(in AttributionSource attributionSource)94 BluetoothDevice getActiveDevice(in AttributionSource attributionSource); 95 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") isInbandRingingEnabled(in AttributionSource attributionSource)96 boolean isInbandRingingEnabled(in AttributionSource attributionSource); 97 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.MODIFY_PHONE_STATE})") setPriority(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource)98 boolean setPriority(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource); 99 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") getPriority(in BluetoothDevice device, in AttributionSource attributionSource)100 int getPriority(in BluetoothDevice device, in AttributionSource attributionSource); 101 102 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") isNoiseReductionSupported(in BluetoothDevice device, in AttributionSource attributionSource)103 boolean isNoiseReductionSupported(in BluetoothDevice device, in AttributionSource attributionSource); 104 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)") isVoiceRecognitionSupported(in BluetoothDevice device, in AttributionSource attributionSource)105 boolean isVoiceRecognitionSupported(in BluetoothDevice device, in AttributionSource attributionSource); 106 } 107