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 /** Interface class for privacy setting helper */
20 public interface IAutoPrivacySettingsHelper extends IAppHelper {
21     /** enum for permission allow or don't allow state */
22     enum Permission {
23         ALLOW,
24         ALLOW_ALL_THE_TIME,
25         ALLOW_WHILE_USING_APP,
26         DONT_ALLOW
27     }
28 
29     /**
30      * Setup expectation: MicroPhone settings is open.
31      *
32      * <p>This method turns on and Off the MicroPhone.
33      */
turnOnOffMicroPhone(boolean onOff)34     void turnOnOffMicroPhone(boolean onOff);
35 
36     /**
37      * Setup expectation: MicroPhone settings is open.
38      *
39      * <p>This method checks if MicroPhone is turned on or off.
40      */
isMicroPhoneOn()41     boolean isMicroPhoneOn();
42 
43     /**
44      * Setup expectation: MicroPhone Muted.
45      *
46      * <p>This method checks if muted MicroPhone Chip is present on Status bar.
47      */
isMutedMicChipPresentOnStatusBar()48     boolean isMutedMicChipPresentOnStatusBar();
49 
50     /**
51      * Setup expectation: MicroPhone unMuted.
52      *
53      * <p>This method checks if muted MicroPhone Chip is present on Status bar when micphrone panel
54      * is opened .
55      */
isMutedMicChipPresentWithMicPanel()56     boolean isMutedMicChipPresentWithMicPanel();
57 
58     /**
59      * Setup expectation: None.
60      *
61      * <p>This method checks if MicroPhone Chip(dark/light) is present on Status bar.
62      */
isMicChipPresentOnStatusBar()63     boolean isMicChipPresentOnStatusBar();
64 
65     /**
66      * Setup expectation: MicroPhone settings is open.
67      *
68      * <p>This method taps microphone button in status bar.
69      */
clickMicroPhoneStatusBar()70     void clickMicroPhoneStatusBar();
71 
72     /**
73      * Setup expectation: MicroPhone panel is open.
74      *
75      * <p>This method checks if Micro Phone Settings links is present in the micro phone panel
76      */
isMicroPhoneSettingsLinkPresent()77     boolean isMicroPhoneSettingsLinkPresent();
78 
79     /**
80      * Setup expectation: MicroPhone panel is open.
81      *
82      * <p>This method taos on Micro Phone Settings links is present in the micro phone panel
83      */
clickMicroPhoneSettingsLink()84     void clickMicroPhoneSettingsLink();
85 
86     /**
87      * Setup expectation: MicroPhone panel is open.
88      *
89      * <p>This method checks if Micro Phone Toggle is present in the panel
90      */
isMicroPhoneTogglePresent()91     boolean isMicroPhoneTogglePresent();
92 
93     /**
94      * Setup expectation: MicroPhone panel is open.
95      *
96      * <p>This method taps on micro phone toggle
97      */
clickMicroPhoneToggleStatusBar()98     void clickMicroPhoneToggleStatusBar();
99 
100     /**
101      * Setup expectation: MicroPhone Settings is open and no apps has used microphone recently.
102      *
103      * <p>This method checks if no recent apps is present.
104      */
verifyNoRecentAppsPresent()105     boolean verifyNoRecentAppsPresent();
106 
107     /**
108      * Setup expectation: Micro Phone Panel is open
109      *
110      * <p>This method checks correct micro phone status is displayed in Micro Phone Panel.
111      */
isMicroPhoneStatusMessageUpdated(String status)112     boolean isMicroPhoneStatusMessageUpdated(String status);
113 
114     /**
115      * Setup expectation: MicroPhone settings is open
116      *
117      * <p>This method taps on Micro Phone Permissions
118      */
clickManageMicroPhonePermissions()119     void clickManageMicroPhonePermissions();
120 
121     /**
122      * Setup expectation: MicroPhone settings is open, google account is added.
123      *
124      * <p>This method checks if Activity Control Page is displayed.
125      */
isManageActivityControlOpen()126     boolean isManageActivityControlOpen();
127 
128     /**
129      * Setup expectation: MicroPhone settings is open, no google account is added
130      *
131      * <p>This method checks if No account added dialog is displayed.
132      */
isNoAccountAddedDialogOpen()133     boolean isNoAccountAddedDialogOpen();
134 
135     /**
136      * Setup expectation: MicroPhone settings is open, no google account is added
137      *
138      * <p>This method checks if add account text is displayed on Autofill Page
139      */
isAccountAddedAutofill()140     boolean isAccountAddedAutofill();
141 
142     /**
143      * Setup expectation: None
144      *
145      * <p>This method checks if Recently accessed apps is displayed in MicroPhone settings with
146      * timestamp
147      */
isRecentAppDisplayedWithStamp(String app)148     boolean isRecentAppDisplayedWithStamp(String app);
149 
150     /**
151      * Setup expectation: MicroPhone Settings is open
152      *
153      * <p>This method clicks on ViewAll Link.
154      */
clickViewAllLink()155     void clickViewAllLink();
156 
157     /**
158      * Setup expectation: open Google assistant app, microphone is on
159      *
160      * <p>Tap on unmuted microphone status bar
161      */
clickUnMutedMicroPhoneStatusBar()162     void clickUnMutedMicroPhoneStatusBar();
163 
164     /**
165      * Setup expectation: Microphone status bar is opened
166      *
167      * <p>This method clicks on microphone on status bar
168      *
169      * @param target is config constant of the Status message
170      */
verifyMicrophoneStatusMessage(String target)171     boolean verifyMicrophoneStatusMessage(String target);
172 
173     /**
174      * Setup expectation: Privacy Dashboard/Permission is open for given app
175      *
176      * <p>This method opens Privacy Dashboard/permissions page for given app
177      *
178      * @param target app name to open permission page in Privacy dashboard/permission
179      */
privacyDashboardPermissionPage(String target)180     void privacyDashboardPermissionPage(String target);
181 
182     /**
183      * Setup expectation: Get the Permission decision
184      *
185      * <p>This method will get the text from App Permission
186      *
187      * @param appName of the app that decision message need to be verified
188      */
getRecentPermissionDecisionMessage(String appName)189     String getRecentPermissionDecisionMessage(String appName);
190 
191     /**
192      * Setup expectation: Get the Permission decision
193      *
194      * <p>This method will click on given permission
195      *
196      * @param permission Permission status allow or don't allow
197      */
changePermissions(Permission permission)198     void changePermissions(Permission permission);
199 
200     /**
201      * Setup expectation: Message should be displayed
202      *
203      * <p>This method will click while changing permission message is displayed
204      */
isMessageDisplayed()205     boolean isMessageDisplayed();
206 
207     /**
208      * Setup expectation: Cancel the Message displayed
209      *
210      * <p>This method will click on cancel button
211      */
cancelButton()212     void cancelButton();
213 
214     /**
215      * Setup expectation: Permission Allow
216      *
217      * <p>To verify if Permission default status is Allow
218      */
isAllowDefaultPermission()219     boolean isAllowDefaultPermission();
220 
221     /**
222      * Setup expectation: verify microphone manage permissions page
223      *
224      * <p>To verify if microphone manage permissions page is displayed
225      */
verifyMicrophoneManagePermissionsPage()226     boolean verifyMicrophoneManagePermissionsPage();
227 
228     /**
229      * Setup expectation: Start Android Auto pop-up displayed
230      *
231      * <p>To verify if Start Android Auto pop-up displayed
232      */
isStartAndroidAutoPopUpPresent()233     boolean isStartAndroidAutoPopUpPresent();
234 
235     /**
236      * Setup expectation: Assistant improvement pop-up displayed
237      *
238      * <p>To verify if Assistant improvement pop-up displayed
239      */
isAssistantImprovementPopUpPresent()240     boolean isAssistantImprovementPopUpPresent();
241 
242     /**
243      * Setup expectation: Start Android Auto pop-up displayed
244      *
245      * <p>This method will click on Not Now button
246      */
skipStartAndroidAutoPopUp()247     void skipStartAndroidAutoPopUp();
248 
249     /**
250      * Setup expectation: Use contact names pop-uo displayed
251      *
252      * <p>This method will click on Not Now button
253      */
skipImprovementCallingAndTextingPopUp()254     void skipImprovementCallingAndTextingPopUp();
255 
256 }
257