1 /* 2 * Copyright (C) 2019 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 import java.util.List; 20 21 public interface IAutoDialHelper extends IAppHelper, Scrollable { 22 23 /** enum class for contact list order type. */ 24 enum OrderType { 25 FIRST_NAME, 26 LAST_NAME 27 } 28 /** enum class for phone call audio channel. */ 29 enum AudioSource { 30 PHONE, 31 CAR_SPEAKERS, 32 } 33 34 /** 35 * Setup expectations: The app is open and the dialpad is open 36 * 37 * <p>This method is used to dial the phonenumber on dialpad 38 * 39 * @param phoneNumber phone number to dial. 40 */ dialANumber(String phoneNumber)41 void dialANumber(String phoneNumber); 42 43 /** 44 * Setup expectations: A prompt allowing the user to select "Device" is open. 45 * 46 * <p>This method is meant to be used when contacts are being uploaded onto a device (the 47 * confirmation dialogue allows either the device to be selected for upload, or for 48 * cancellation. 49 */ pressDeviceOnPrompt()50 void pressDeviceOnPrompt(); 51 52 /** 53 * Setup expectations: The app is open and there is an ongoing call. 54 * 55 * <p>This method is used to end call using softkey. 56 */ endCall()57 void endCall(); 58 59 /** 60 * Setup expectations: The app is open. 61 * 62 * <p>This method is used to open call history details. 63 */ openCallHistory()64 void openCallHistory(); 65 66 /** 67 * Setup expectations: The app is open. 68 * 69 * <p>This method dials a contact from the contact list. 70 * 71 * @param contactName to dial. 72 */ callContact(String contactName)73 void callContact(String contactName); 74 75 /** 76 * Setup expectations: The app is open and in Dialpad. 77 * 78 * <p>This method is used to delete the number entered on dialpad using backspace 79 */ deleteDialedNumber()80 void deleteDialedNumber(); 81 82 /** 83 * Setup expectations: The app is open and in Dialpad 84 * 85 * <p>This method is used to get the number entered on dialing screen. 86 */ getDialedNumber()87 String getDialedNumber(); 88 89 /** 90 * Setup expectations: The app is open and in Dialpad 91 * 92 * <p>This method is used to get the number entered on dialpad 93 */ getDialInNumber()94 String getDialInNumber(); 95 96 /** 97 * Setup expectations: The app is open and there is an ongoing call. 98 * 99 * <p>This method is used to get the name of the contact for the ongoing call 100 */ getDialedContactName()101 String getDialedContactName(); 102 103 /** 104 * Setup expectations: The app is open and Call History is open. 105 * 106 * <p>This method is used to get the most recent call history. 107 */ getRecentCallHistory()108 String getRecentCallHistory(); 109 110 /** 111 * Setup expectations: The app is open and phonenumber is entered on the dialpad. 112 * 113 * <p>This method is used to make/receive a call using softkey. 114 */ makeCall()115 void makeCall(); 116 117 /** 118 * Setup expectations: The app is open. 119 * 120 * <p>This method is used to dial a number from a list (Favorites, Call History, Contact). 121 * 122 * @param contact (number or name) dial. 123 */ dialFromList(String contact)124 void dialFromList(String contact); 125 126 /** 127 * Setup expectations: The app is open and there is an ongoing call. 128 * 129 * <p>This method is used to enter number on the in-call dialpad. 130 * 131 * @param phoneNumber to dial. 132 */ inCallDialPad(String phoneNumber)133 void inCallDialPad(String phoneNumber); 134 135 /** 136 * Setup expectations: The app is open and there is an ongoing call. 137 * 138 * <p>This method is used to mute the ongoing call. 139 */ muteCall()140 void muteCall(); 141 142 /** 143 * Setup expectations: The app is open and there is an ongoing call. 144 * 145 * <p>This method is used to unmute the ongoing call. 146 */ unmuteCall()147 void unmuteCall(); 148 149 /** 150 * Setup expectations: The app is open and there is an ongoing call. 151 * 152 * <p>This method is used to change voice channel to handset/bluetooth. 153 * 154 * @param source to switch to. 155 */ changeAudioSource(AudioSource source)156 void changeAudioSource(AudioSource source); 157 158 /** 159 * Setup expectations: The app is open. 160 * 161 * <p>This method is used to make a call to the first history from Call History. 162 */ callMostRecentHistory()163 void callMostRecentHistory(); 164 165 /** 166 * Setup expectations: The app is open and there is an ongoing call. 167 * 168 * <p>This method is used to get the contact name being called. 169 */ getContactName()170 String getContactName(); 171 172 /** 173 * Setup expectations: The app is open and there is an ongoing call 174 * 175 * <p>This method is used to get the contact type (Mobile, Work, Home and etc.) being called. 176 */ getContactType()177 String getContactType(); 178 179 /** 180 * Setup expectations: The app is open. 181 * 182 * <p>This method is used to search a contact in the contact list. 183 * 184 * @param contact to search. 185 */ searchContactsByName(String contact)186 void searchContactsByName(String contact); 187 188 /** 189 * Setup expectations: The app is open. 190 * 191 * <p>This method is used to search a number in the contact list. 192 * 193 * @param number to search. 194 */ searchContactsByNumber(String number)195 void searchContactsByNumber(String number); 196 197 /** 198 * Setup expectations: The app is open. 199 * 200 * <p>This method is used to get the first search result for contact. 201 */ getFirstSearchResult()202 String getFirstSearchResult(); 203 204 /** 205 * Setup expectations: The app is open. 206 * 207 * <p>This method is used to order the contact list based on first/last name. 208 * 209 * @param orderType to use. 210 */ sortContactListBy(OrderType orderType)211 void sortContactListBy(OrderType orderType); 212 213 /** 214 * Setup expectations: The app is open. 215 * 216 * <p>This method is used to get the first contact name from contact list. 217 */ getFirstContactFromContactList()218 String getFirstContactFromContactList(); 219 220 /** 221 * Setup expectations: A Contact details page is open. 222 * 223 * <p>This method is used to get the home address from the currently-open contact. 224 */ getHomeAddress()225 String getHomeAddress(); 226 227 /** 228 * Setup expectations: The app is open. 229 * 230 * <p>This method is used to verify if a contact is added to Favorites. 231 * 232 * @param contact to check. 233 */ isContactInFavorites(String contact)234 boolean isContactInFavorites(String contact); 235 236 /** 237 * Setup expectations: The contact's details page is open. 238 * 239 * <p>This method is used to close the details page. 240 * 241 * @param contact Contact's details page to be opened. 242 */ openDetailsPage(String contact)243 void openDetailsPage(String contact); 244 /** 245 * Setup expectations: The app is open. 246 * 247 * <p>This method is used to check if phone is paired. 248 */ isPhonePaired()249 boolean isPhonePaired(); 250 /** 251 * Setup expectations: The app is open. 252 * 253 * <p>This method is used to open contact list 254 */ openContacts()255 void openContacts(); 256 257 /** 258 * Setup expectations: The contacts page is open. 259 * 260 * <p>This method is used to open the contact details page of the first visible contact. Throws 261 * an error if no contacts are visible. 262 */ openFirstContactDetails()263 void openFirstContactDetails(); 264 265 /** 266 * Setup expectations: The app is open and there is an ongoing call. 267 * 268 * <p>This method is used check if ongoing call is displayed on home. 269 */ isOngoingCallDisplayedOnHome()270 boolean isOngoingCallDisplayedOnHome(); 271 272 /** 273 * Setup expectations: The home screen is open 274 * 275 * <p>This method is used for opening phone app from homescreen 276 */ openPhoneAppFromHome()277 void openPhoneAppFromHome(); 278 279 /** 280 * Setup expectations: The app is open. 281 * 282 * <p>This method is used to get visible contacts list 283 */ getListOfAllVisibleContacts()284 List<String> getListOfAllVisibleContacts(); 285 286 /** 287 * Setup expectations: bluetooth is off 288 * 289 * <p>This method is used for checking if error message is displaye when bluetooth is off 290 */ isBluetoothHfpErrorDisplayed()291 boolean isBluetoothHfpErrorDisplayed(); 292 293 /** 294 * Setup expectations: The app is open 295 * 296 * <p>This method is adding favorites from the Favorites Tab 297 */ addFavoritesFromFavoritesTab(String contact)298 void addFavoritesFromFavoritesTab(String contact); 299 /** 300 * Setup expectations: The bluetooth palette is open 301 * 302 * <p>This method is used for clicking phone button from bluetooth palette 303 */ clickPhoneButton()304 void clickPhoneButton(); 305 /** 306 * Setup expectations: The dialer page is open 307 * 308 * <p>This method is used to check if Recents tab is present in dialer page 309 */ verifyDialerRecentsTab()310 boolean verifyDialerRecentsTab(); 311 /** 312 * Setup expectations: The dialer page is open 313 * 314 * <p>This method is used to check if Contacts tab is present in dialer page 315 */ verifyDialerContactsTab()316 boolean verifyDialerContactsTab(); 317 /** 318 * Setup expectations: The dialer page is open 319 * 320 * <p>This method is used to check if Favorites tab is present in dialer page 321 */ verifyDialerFavoritesTab()322 boolean verifyDialerFavoritesTab(); 323 /** 324 * Setup expectations: The dialer page is open 325 * 326 * <p>This method is used to check if Dialpad tab is present in dialer page 327 */ verifyDialerDialpadTab()328 boolean verifyDialerDialpadTab(); 329 } 330