Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

silent mode without flash #985

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions uiautomator2/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def launch_uiautomator(dev: adbutils.AdbDevice) -> MockAdbProcess:
"""Launch uiautomator2 server on device"""
logger.debug("launch uiautomator")
dev.shell("am force-stop com.github.uiautomator")
dev.shell("am start -n com.github.uiautomator/.ToastActivity")
# silent
# dev.shell("am start -n com.github.uiautomator/.ToastActivity")
# use command to see if uiautomator is running: ps -A | grep uiautomator
conn = dev.shell("am instrument -w -r -e debug false -e class com.github.uiautomator.stub.Stub com.github.uiautomator.test/androidx.test.runner.AndroidJUnitRunner", stream=True)
process = MockAdbProcess(conn)
Expand Down Expand Up @@ -272,10 +273,13 @@ def _wait_ready(self, launch_timeout=30, service_timeout=30):
"""Wait until uiautomator2 server is ready"""
# wait am instrument start
self._wait_instrument_ready(launch_timeout)

# silent mode
# launch a toast window to make sure uiautomator is alive
logger.debug("show float window")
# logger.debug("show float window")
self._dev.shell("am startservice -a com.github.uiautomator.ACTION_START")
self._dev.shell("am start -n com.github.uiautomator/.ToastActivity -e showFloatWindow true")
# self._dev.shell("am start -n com.github.uiautomator/.ToastActivity -e showFloatWindow true")

self._wait_stub_ready(service_timeout)
time.sleep(1) # wait ATX goto background

Expand Down