blob: c85cec70b79f182302cbf14cd843ccadeb6010a8 [file] [log] [blame]
Ram Periathiruvadi76a84892017-07-27 18:10:35 -07001/*
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 */
16package android.car;
17
18import android.Manifest;
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070019import android.annotation.RequiresPermission;
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070020import android.content.Context;
21import android.os.IBinder;
22import android.os.RemoteException;
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070023
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070024/**
Sal Savage703c46f2019-04-15 08:39:25 -070025 * CarBluetoothManager - Provides an API to interact with Car specific Bluetooth Device Management
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070026 *
27 * @hide
28 */
29public final class CarBluetoothManager implements CarManagerBase {
30 private static final String TAG = "CarBluetoothManager";
31 private final Context mContext;
32 private final ICarBluetooth mService;
33
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070034 /**
Sal Savage703c46f2019-04-15 08:39:25 -070035 * Initiate automatated connecting of devices based on the prioritized device lists for each
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070036 * profile.
37 *
Sal Savage703c46f2019-04-15 08:39:25 -070038 * The device lists for each profile are maintained by CarBluetoothService. Devices are added to
39 * the end of a profile's list when the device bonds, if the device supports the given profile.
40 * Devices are removed when unbond. These lists are specific to the current foreground user.
41 *
42 * If you are calling this function, you may want to disable CarBluetoothService's default
43 * device connection policy by setting the "useDefaultBluetoothConnectionPolicy" resource
44 * overlay flag to false.
45 *
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070046 * @hide
47 */
48 @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
Sal Savage703c46f2019-04-15 08:39:25 -070049 public void connectDevices() {
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070050 try {
Sal Savage703c46f2019-04-15 08:39:25 -070051 mService.connectDevices();
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070052 } catch (RemoteException e) {
Justin Paupore0dd31772019-02-07 21:22:34 -080053 throw e.rethrowFromSystemServer();
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070054 }
55 }
56
57 /**
Sal Savage703c46f2019-04-15 08:39:25 -070058 * Create an instance of CarBluetoothManager
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070059 *
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070060 * @hide
61 */
Ram Periathiruvadi76a84892017-07-27 18:10:35 -070062 public CarBluetoothManager(IBinder service, Context context) {
63 mContext = context;
64 mService = ICarBluetooth.Stub.asInterface(service);
65 }
66
67 @Override
68 public void onCarDisconnected() {
69 }
70}