• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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 com.android.settings.bluetooth;
18 
19 import android.bluetooth.BluetoothAdapter;
20 import android.bluetooth.BluetoothDevice;
21 import android.content.ComponentName;
22 import android.content.Context;
23 import android.media.Spatializer;
24 import android.net.Uri;
25 
26 import androidx.annotation.NonNull;
27 import androidx.preference.Preference;
28 
29 import com.android.settings.bluetooth.ui.view.DeviceDetailsFragmentFormatter;
30 import com.android.settings.dashboard.DashboardFragment;
31 import com.android.settingslib.bluetooth.CachedBluetoothDevice;
32 import com.android.settingslib.bluetooth.devicesettings.data.repository.DeviceSettingRepository;
33 import com.android.settingslib.core.AbstractPreferenceController;
34 
35 import kotlinx.coroutines.CoroutineScope;
36 
37 import java.util.List;
38 import java.util.Set;
39 
40 /** Provider for bluetooth related features. */
41 public interface BluetoothFeatureProvider {
42 
43     /**
44      * Gets the {@link Uri} that represents extra settings for a specific bluetooth device
45      *
46      * @param bluetoothDevice bluetooth device
47      * @return {@link Uri} for extra settings
48      */
getBluetoothDeviceSettingsUri(BluetoothDevice bluetoothDevice)49     Uri getBluetoothDeviceSettingsUri(BluetoothDevice bluetoothDevice);
50 
51     /**
52      * Gets the {@link Uri} that represents extra control for a specific bluetooth device
53      *
54      * @param bluetoothDevice bluetooth device
55      * @return {@link String} uri string for extra control
56      */
getBluetoothDeviceControlUri(BluetoothDevice bluetoothDevice)57     String getBluetoothDeviceControlUri(BluetoothDevice bluetoothDevice);
58 
59     /**
60      * Gets the {@link ComponentName} of services or activities that need to be shown in related
61      * tools.
62      *
63      * @return list of {@link ComponentName}
64      */
getRelatedTools()65     List<ComponentName> getRelatedTools();
66 
67     /**
68      * Gets the instance of {@link Spatializer}.
69      *
70      * @param context Context
71      * @return the Spatializer instance
72      */
getSpatializer(Context context)73     Spatializer getSpatializer(Context context);
74 
75     /**
76      * Gets bluetooth device extra options
77      *
78      * @param context Context
79      * @param device the bluetooth device
80      * @return the extra bluetooth preference list
81      */
getBluetoothExtraOptions(Context context, CachedBluetoothDevice device)82     List<Preference> getBluetoothExtraOptions(Context context, CachedBluetoothDevice device);
83 
84     /**
85      * Gets the bluetooth profile preference keys which should be hidden in the device details page.
86      *
87      * @param context Context
88      * @param bluetoothDevice the bluetooth device
89      * @return the profiles which should be hidden
90      */
getInvisibleProfilePreferenceKeys(Context context, BluetoothDevice bluetoothDevice)91     Set<String> getInvisibleProfilePreferenceKeys(Context context, BluetoothDevice bluetoothDevice);
92 
93     /** Gets DeviceSettingRepository. */
94     @NonNull
getDeviceSettingRepository( @onNull Context context, @NonNull BluetoothAdapter bluetoothAdapter, @NonNull CoroutineScope scope)95     DeviceSettingRepository getDeviceSettingRepository(
96             @NonNull Context context,
97             @NonNull BluetoothAdapter bluetoothAdapter,
98             @NonNull CoroutineScope scope);
99 
100     /** Gets device details fragment layout formatter. */
101     @NonNull
getDeviceDetailsFragmentFormatter( @onNull Context context, @NonNull DashboardFragment fragment, @NonNull BluetoothAdapter bluetoothAdapter, @NonNull CachedBluetoothDevice cachedDevice, @NonNull List<AbstractPreferenceController> controllers)102     DeviceDetailsFragmentFormatter getDeviceDetailsFragmentFormatter(
103             @NonNull Context context,
104             @NonNull DashboardFragment fragment,
105             @NonNull BluetoothAdapter bluetoothAdapter,
106             @NonNull CachedBluetoothDevice cachedDevice,
107             @NonNull List<AbstractPreferenceController> controllers);
108 }
109