1 /* 2 * Copyright (C) 2017 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 package android.car; 17 18 import android.Manifest; 19 import android.annotation.RequiresPermission; 20 import android.os.IBinder; 21 import android.os.RemoteException; 22 23 /** 24 * CarBluetoothManager - Provides an API to interact with Car specific Bluetooth Device Management 25 * 26 * @hide 27 */ 28 public final class CarBluetoothManager extends CarManagerBase { 29 private static final String TAG = "CarBluetoothManager"; 30 private final ICarBluetooth mService; 31 32 /** 33 * Initiate automatated connecting of devices based on the prioritized device lists for each 34 * profile. 35 * 36 * The device lists for each profile are maintained by CarBluetoothService. Devices are added to 37 * the end of a profile's list when the device bonds, if the device supports the given profile. 38 * Devices are removed when unbond. These lists are specific to the current foreground user. 39 * 40 * If you are calling this function, you may want to disable CarBluetoothService's default 41 * device connection policy by setting the "useDefaultBluetoothConnectionPolicy" resource 42 * overlay flag to false. 43 * 44 * @hide 45 */ 46 @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) connectDevices()47 public void connectDevices() { 48 try { 49 mService.connectDevices(); 50 } catch (RemoteException e) { 51 handleRemoteExceptionFromCarService(e); 52 } 53 } 54 55 /** 56 * Create an instance of CarBluetoothManager 57 * 58 * @hide 59 */ CarBluetoothManager(Car car, IBinder service)60 public CarBluetoothManager(Car car, IBinder service) { 61 super(car); 62 mService = ICarBluetooth.Stub.asInterface(service); 63 } 64 65 @Override onCarDisconnected()66 public void onCarDisconnected() { 67 } 68 } 69