summaryrefslogtreecommitdiff
path: root/libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java')
-rw-r--r--libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java36
1 files changed, 31 insertions, 5 deletions
diff --git a/libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java b/libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java
index c547f0d7f..869d87019 100644
--- a/libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java
+++ b/libraries/launcher-helper/src/android/support/test/launcherhelper/AutoLauncherStrategy.java
@@ -23,14 +23,14 @@ import android.support.test.uiautomator.Direction;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;
+import android.system.helpers.CommandsHelper;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
-import java.util.stream.Stream;
import java.util.stream.Collectors;
-
+import java.util.stream.Stream;
public class AutoLauncherStrategy implements IAutoLauncherStrategy {
private static final String LOG_TAG = AutoLauncherStrategy.class.getSimpleName();
@@ -88,6 +88,7 @@ public class AutoLauncherStrategy implements IAutoLauncherStrategy {
protected UiDevice mDevice;
private Instrumentation mInstrumentation;
+ private CommandsHelper mCommandsHelper;
/**
* {@inheritDoc}
@@ -111,6 +112,7 @@ public class AutoLauncherStrategy implements IAutoLauncherStrategy {
@Override
public void setInstrumentation(Instrumentation instrumentation) {
mInstrumentation = instrumentation;
+ mCommandsHelper = CommandsHelper.getInstance(mInstrumentation);
}
/**
@@ -201,9 +203,21 @@ public class AutoLauncherStrategy implements IAutoLauncherStrategy {
openFacet("Notification");
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
+ @Override
+ public void openNotifications() {
+ String cmd = "cmd statusbar expand-notifications";
+ mCommandsHelper.executeShellCommand(cmd);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public void pressHome() {
+ String cmd = "input keyevent KEYCODE_HOME";
+ mCommandsHelper.executeShellCommand(cmd);
+ }
+
+ /** {@inheritDoc} */
@Override
public void openAssistantFacet() {
openFacet("Google Assistant");
@@ -326,6 +340,18 @@ public class AutoLauncherStrategy implements IAutoLauncherStrategy {
}
}
+ @Override
+ public void openBluetoothAudioApp() {
+ String appName = "Bluetooth Audio";
+ if (checkApplicationExists(appName)) {
+ UiObject2 app = mDevice.findObject(By.clickable(true).hasDescendant(By.text(appName)));
+ app.clickAndWait(Until.newWindow(), APP_LAUNCH_TIMEOUT);
+ mDevice.waitForIdle();
+ } else {
+ throw new RuntimeException(String.format("Application %s not found", appName));
+ }
+ }
+
private UiObject2 findApplication(String appName) {
BySelector appSelector = By.clickable(true).hasDescendant(By.text(appName));
if (mDevice.hasObject(SCROLLABLE_APP_LIST)) {