Provides access to state information about the device. You can also use this class to simulate user actions on the device, such as pressing the d-pad or pressing the Home and Menu buttons.
| 1345 | |
| 1346 | |
| 1347 | class UiDevice(): |
| 1348 | """ |
| 1349 | Provides access to state information about the device. You can also use this class to simulate |
| 1350 | user actions on the device, such as pressing the d-pad or pressing the Home and Menu buttons. |
| 1351 | """ |
| 1352 | |
| 1353 | def __init__(self, vc): |
| 1354 | self.vc = vc |
| 1355 | self.device = self.vc.device |
| 1356 | |
| 1357 | def openNotification(self): |
| 1358 | """ |
| 1359 | Opens the notification shade. |
| 1360 | """ |
| 1361 | |
| 1362 | # the tablet has a different Notification/Quick Settings bar depending on x |
| 1363 | w13 = self.device.display['width'] / 3 |
| 1364 | s = (w13, 0) |
| 1365 | e = (w13, self.device.display['height'] / 2) |
| 1366 | self.device.drag(s, e, 500, 20, -1) |
| 1367 | self.vc.sleep(1) |
| 1368 | self.vc.dump(-1) |
| 1369 | |
| 1370 | def openQuickSettings(self): |
| 1371 | """ |
| 1372 | Opens the Quick Settings shade. |
| 1373 | """ |
| 1374 | |
| 1375 | # the tablet has a different Notification/Quick Settings bar depending on x |
| 1376 | w23 = 2 * self.device.display['width'] / 3 |
| 1377 | s = (w23, 0) |
| 1378 | e = (w23, self.device.display['height'] / 2) |
| 1379 | self.device.drag(s, e, 500, 20, -1) |
| 1380 | self.vc.sleep(1) |
| 1381 | if self.vc.getSdkVersion() >= 20: |
| 1382 | self.device.drag(s, e, 500, 20, -1) |
| 1383 | self.vc.sleep(1) |
| 1384 | self.vc.dump(-1) |
| 1385 | |
| 1386 | def openQuickSettingsSettings(self): |
| 1387 | """ |
| 1388 | Opens the Quick Settings shade and then tries to open Settings from there. |
| 1389 | """ |
| 1390 | |
| 1391 | STATUS_BAR_SETTINGS_SETTINGS_BUTTON = [ |
| 1392 | "Settings", "Cài đặt", "Instellingen", "Կարգավորումներ", "设置", "Nastavitve", "සැකසීම්", "Ayarlar", |
| 1393 | "Setelan", "Настройки", "تنظیمات", "Mga Setting", "Тохиргоо", "Configuració", "Setări", "Налады", |
| 1394 | "Einstellungen", "პარამეტრები", "सेटिङहरू", "Կարգավորումներ", "Nustatymai", "Beállítások", "設定", |
| 1395 | "सेटिंग", "Настройки", "Inställningar", "設定", "ການຕັ້ງຄ່າ", "Configurações", "Tetapan", "설정", |
| 1396 | "ការកំណត់", "Ajustes", "הגדרות", "Ustawienia", "Nastavení", "Ρυθμίσεις", "Тохиргоо", "Ayarlar", |
| 1397 | "Indstillinger", "Налаштування", "Mipangilio", "Izilungiselelo", "設定", "Nastavenia", "Paramètres", |
| 1398 | "ቅንብሮች", "การตั้งค่า", "Seaded", "Iestatījumi", "Innstillinger", "Подешавања", "الإعدادات", "සැකසීම්", |
| 1399 | "Definições", "Configuración", "პარამეტრები", "Postavke", "Ayarlar", "Impostazioni", "Asetukset", |
| 1400 | "Instellings", "Seaded", "ការកំណត់", "सेटिङहरू", "Tetapan" |
| 1401 | ] |
| 1402 | |
| 1403 | self.openQuickSettings() |
| 1404 |