Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3360)

Unified Diff: build/android/pylib/device/device_utils.py

Issue 354863003: [Android] Switch to DeviceUtils versions of GoHome, ForceStop, etc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/device_utils.py
diff --git a/build/android/pylib/device/device_utils.py b/build/android/pylib/device/device_utils.py
index e4c66525d193bf972989dd889a04672d0f8f04f4..c87ca5143b4495fb34f11c51b14916e7576bd513 100644
--- a/build/android/pylib/device/device_utils.py
+++ b/build/android/pylib/device/device_utils.py
@@ -390,6 +390,51 @@ class DeviceUtils(object):
for k, v in intent.extras.items() if len(k) > 0]
self.old_interface.BroadcastIntent(package, old_intent, *args)
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def GoHome(self, timeout=None, retries=None):
+ """Return to the home screen.
+
+ Args:
+ timeout: Same as for |IsOnline|.
+ retries: Same as for |IsOnline|.
+ """
+ self.old_interface.GoHome()
+
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def ForceStop(self, package, timeout=None, retries=None):
+ """Close the application.
+
+ Args:
+ package: A string containing the name of the package to stop.
+ timeout: Same as for |IsOnline|.
+ retries: Same as for |IsOnline|.
+ """
+ self.old_interface.CloseApplication(package)
+
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def ClearApplicationState(self, package, timeout=None, retries=None):
+ """Clear all state for the given package.
+
+ Args:
+ package: A string containing the name of the package to stop.
+ timeout: Same as for |IsOnline|.
+ retries: Same as for |IsOnline|.
+ """
+ self.old_interface.ClearApplicationState(package)
+
+ @decorators.WithTimeoutAndRetriesFromInstance()
+ def SendKeyEvent(self, keycode, timeout=None, retries=None):
+ """Sends a keycode to the device.
+
+ See: http://developer.android.com/reference/android/view/KeyEvent.html
+
+ Args:
+ keycode: A integer keycode to send to the device.
+ timeout: Same as for |IsOnline|.
+ retries: Same as for |IsOnline|.
+ """
+ self.old_interface.SendKeyEvent(keycode)
+
def __str__(self):
"""Returns the device serial."""
return self.old_interface.GetDevice()
« no previous file with comments | « no previous file | build/android/pylib/device/device_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698