1 /*
2  * Copyright (C) 2023 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.platform.helpers;
18 
19 /**
20  * Helper class for functional tests that use the Bluetooth settings page (and device-specific
21  * connection pages reached from the Bluetooth settings page)
22  */
23 public interface IAutoBluetoothSettingsHelper extends IAppHelper, Scrollable {
24 
25     /**
26      * Setup Expectations: The bluetooth settings view is open, and at least one device is listed
27      * under "Paired devices"
28      *
29      * @return - Whether the audio preference button is currently checked
30      */
isMediaPreferenceChecked()31     boolean isMediaPreferenceChecked();
32 
33     /**
34      * Setup Expectations: The bluetooth settings view is open, and at least one device is listed
35      * under "Paired devices"
36      *
37      * @return - Whether the bluetooth preference button is currently checked
38      */
isBluetoothPreferenceChecked()39     boolean isBluetoothPreferenceChecked();
40 
41     /**
42      * Setup Expectations: The bluetooth settings view is open, and at least one device is listed
43      * under "Paired devices"
44      *
45      * @return - Whether the phone preference button is currently checked
46      */
isPhonePreferenceChecked()47     boolean isPhonePreferenceChecked();
48 
49     /**
50      * Setup Expectations: The bluetooth settings view is open, and at least one device is listed
51      * under "Paired devices"
52      *
53      * @return - Whether the audio preference button is currently checked
54      */
isMediaPreferenceEnabled()55     boolean isMediaPreferenceEnabled();
56 
57     /**
58      * Setup Expectations: The bluetooth settings view is open, and at least one device is listed
59      * under "Paired devices"
60      *
61      * @return - Whether the phone preference button is currently checked
62      */
isPhonePreferenceEnabled()63     boolean isPhonePreferenceEnabled();
64 
65     /**
66      * Setup Expectations: The bluetooth settings view is open, and the looked-for device is present
67      * under "paired devices"
68      *
69      * @param deviceName - The name of the connected device to disconnect
70      */
pressBluetoothToggleOnDevice(String deviceName)71     void pressBluetoothToggleOnDevice(String deviceName);
72 
73     /**
74      * Setup Expectations: The bluetooth settings view is open, and the looked-for device is present
75      * under "paired devices"
76      *
77      * @param deviceName - The name of the connected device to disconnect
78      */
pressMediaToggleOnDevice(String deviceName)79     void pressMediaToggleOnDevice(String deviceName);
80 
81     /**
82      * Setup Expectations: The bluetooth settings view is open, and the looked-for device is present
83      * under "paired devices"
84      *
85      * @param deviceName - The name of the connected device whose phone connection should be
86      *     disabled
87      */
pressPhoneToggleOnDevice(String deviceName)88     void pressPhoneToggleOnDevice(String deviceName);
89 
90     /**
91      * Opens the device bluetooth view by clicking the device name.
92      *
93      * <p>Setup Expectations: The bluetooth settings view is open. and the looked-for device is
94      * present under "paired devices"
95      *
96      * @param deviceName - The name of the connected device to disconnect
97      */
pressDevice(String deviceName)98     void pressDevice(String deviceName);
99 
100     /**
101      * Setup Expectations: A connected device bluetooth view is open ('level two')
102      *
103      * @return - The exact text displayed as the device's connection status
104      */
getDeviceSummary()105     String getDeviceSummary();
106 
107     /**
108      * Setup Expectations: A connected device bluetooth view is open ('level two')
109      *
110      * @return - Whether the device shows that it is connected.
111      */
isConnected()112     boolean isConnected();
113 
114     /**
115      * Presses the 'forget' button.
116      *
117      * <p>Setup Expectations: A connected device bluetooth view is open ('level two') and the
118      * 'Forget' button is visible.
119      */
pressForget()120     void pressForget();
121 
122     /**
123      * Presses the 'Connect' or 'Disconnect' toggle button
124      *
125      * <p>Setup Expectations: A connected device bluetooth view is open ('level two')
126      */
pressConnectionToggle()127     void pressConnectionToggle();
128 
129     /**
130      * Presses the back button to return from a device's connection page to the Bluetooth settings
131      * page
132      *
133      * <p>Setup Expectations: A connected device bluetooth view is open ('level two')
134      */
goBackToBluetoothSettings()135     void goBackToBluetoothSettings();
136 }
137