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
51      *
52      * @return - Whether the use bluetooth toggle is currently checked
53      */
isUseBluetoothToggleChecked()54     boolean isUseBluetoothToggleChecked();
55 
56     /**
57      * Setup Expectations: The bluetooth settings view is open, and at least one device is listed
58      * under "Paired devices"
59      *
60      * @return - Whether the audio preference button is currently checked
61      */
isMediaPreferenceEnabled()62     boolean isMediaPreferenceEnabled();
63 
64     /**
65      * Setup Expectations: The bluetooth settings view is open, and at least one device is listed
66      * under "Paired devices"
67      *
68      * @return - Whether the phone preference button is currently checked
69      */
isPhonePreferenceEnabled()70     boolean isPhonePreferenceEnabled();
71 
72     /**
73      * Setup Expectations: The bluetooth settings view is open, and the looked-for device is present
74      * under "paired devices"
75      *
76      * @param deviceName - The name of the connected device to disconnect
77      */
pressBluetoothToggleOnDevice(String deviceName)78     void pressBluetoothToggleOnDevice(String deviceName);
79 
80     /**
81      * Setup Expectations: The bluetooth settings view is open, and the looked-for device is present
82      * under "paired devices"
83      *
84      * @param deviceName - The name of the connected device to disconnect
85      */
pressMediaToggleOnDevice(String deviceName)86     void pressMediaToggleOnDevice(String deviceName);
87 
88     /**
89      * Setup Expectations: The bluetooth settings view is open, and the looked-for device is present
90      * under "paired devices"
91      *
92      * @param deviceName - The name of the connected device whose phone connection should be
93      *     disabled
94      */
pressPhoneToggleOnDevice(String deviceName)95     void pressPhoneToggleOnDevice(String deviceName);
96 
97     /**
98      * Opens the device bluetooth view by clicking the device name.
99      *
100      * <p>Setup Expectations: The bluetooth settings view is open. and the looked-for device is
101      * present under "paired devices"
102      *
103      * @param deviceName - The name of the connected device to disconnect
104      */
pressDevice(String deviceName)105     void pressDevice(String deviceName);
106 
107     /**
108      * Setup Expectations: A connected device bluetooth view is open ('level two')
109      *
110      * @return - The exact text displayed as the device's connection status
111      */
getDeviceSummary()112     String getDeviceSummary();
113 
114     /**
115      * Setup Expectations: A connected device bluetooth view is open ('level two')
116      *
117      * @return - Whether the device shows that it is connected.
118      */
isConnected()119     boolean isConnected();
120 
121     /**
122      * Presses the 'forget' button.
123      *
124      * <p>Setup Expectations: A connected device bluetooth view is open ('level two') and the
125      * 'Forget' button is visible.
126      */
pressForget()127     void pressForget();
128 
129     /**
130      * Presses the 'Connect' or 'Disconnect' toggle button
131      *
132      * <p>Setup Expectations: A connected device bluetooth view is open ('level two')
133      */
pressConnectionToggle()134     void pressConnectionToggle();
135 
136     /**
137      * Presses the back button to return from a device's connection page to the Bluetooth settings
138      * page
139      *
140      * <p>Setup Expectations: A connected device bluetooth view is open ('level two')
141      */
goBackToBluetoothSettings()142     void goBackToBluetoothSettings();
143 }
144