1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-18 12:06:08 +00:00

fw/uiauto: Update to handle additional permissions screen

On the latest version of android (currently Q) for applications that
are designed to run on older versions of android, an additional
screen asking to confirm the required permissions can popup.
Enable confirming of the granted permissions.
This commit is contained in:
Marc Bonnici 2020-12-08 15:24:22 +00:00 committed by setrofim
parent 751bbb19fe
commit c2725ffaa2
21 changed files with 23 additions and 2 deletions

View File

@ -573,9 +573,29 @@ public class BaseUiAutomation {
} }
} }
// If an an app is not designed for running on the latest version of android
// (currently Q) an additional screen can popup asking to confirm permissions.
public void dismissAndroidPermissionPopup() throws Exception {
UiObject permissionAccess =
mDevice.findObject(new UiSelector().textMatches(
".*Choose what to allow .* to access"));
UiObject continueButton =
mDevice.findObject(new UiSelector().resourceId("com.android.permissioncontroller:id/continue_button")
.textContains("Continue"));
if (permissionAccess.exists() && continueButton.exists()) {
continueButton.click();
}
}
// If an an app is not designed for running on the latest version of android // If an an app is not designed for running on the latest version of android
// (currently Q) dissmiss the warning popup if present. // (currently Q) dissmiss the warning popup if present.
public void dismissAndroidVersionPopup() throws Exception { public void dismissAndroidVersionPopup() throws Exception {
// Ensure we have dissmied any permission screens before looking for the version popup
dismissAndroidPermissionPopup();
UiObject warningText = UiObject warningText =
mDevice.findObject(new UiSelector().textContains( mDevice.findObject(new UiSelector().textContains(
"This app was built for an older version of Android")); "This app was built for an older version of Android"));
@ -586,7 +606,8 @@ public class BaseUiAutomation {
acceptButton.click(); acceptButton.click();
} }
} }
// If Chrome is a fresh install then these popups may be presented // If Chrome is a fresh install then these popups may be presented
// dismiss them if visible. // dismiss them if visible.
public void dismissChromePopup() throws Exception { public void dismissChromePopup() throws Exception {
@ -600,7 +621,7 @@ public class BaseUiAutomation {
.className("android.widget.Button")); .className("android.widget.Button"));
if (negative.waitForExists(10000)) { if (negative.waitForExists(10000)) {
negative.click(); negative.click();
} }
} }
UiObject lite = UiObject lite =
mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/button_secondary") mDevice.findObject(new UiSelector().resourceId("com.android.chrome:id/button_secondary")

Binary file not shown.