MCPcopy
hub / github.com/budtmo/docker-android / wait_until_ready

Method wait_until_ready

cli/src/device/emulator.py:225–251  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

223 f"{readiness_check_type.value} is checked {_} times!")
224
225 def wait_until_ready(self) -> None:
226 super().wait_until_ready()
227 booting_cmd = f"adb -s {self.adb_name} wait-for-device shell getprop sys.boot_completed"
228 focus_cmd = f"adb -s {self.adb_name} shell dumpsys window | grep -i mCurrentFocus"
229 self.check_adb_command(self.ReadinessCheck.BOOTED,
230 booting_cmd, "1", 60, self.interval_waiting)
231 time.sleep(self.interval_after_booting)
232
233 interval_pop_up = 0
234 max_attempt_pop_up = 3
235 pop_up_system_ui = "Not Responding: com.android.systemui"
236 system_ui_cmd = f"adb shell su root 'kill $(pidof com.android.systemui)'"
237 pop_up_key_enter = {
238 "Not Responding: com.google.android.gms",
239 "Not Responding: system",
240 "ConversationListActivity"
241 }
242 key_enter_cmd = "adb shell input keyevent KEYCODE_ENTER"
243 self.check_adb_command(self.ReadinessCheck.POP_UP_WINDOW, focus_cmd, pop_up_system_ui,
244 max_attempt_pop_up, interval_pop_up, system_ui_cmd)
245 for pe in pop_up_key_enter:
246 self.check_adb_command(self.ReadinessCheck.POP_UP_WINDOW, focus_cmd, pe, max_attempt_pop_up,
247 interval_pop_up, key_enter_cmd)
248
249 self.check_adb_command(self.ReadinessCheck.WELCOME_SCREEN,
250 focus_cmd, "launcheractivity", 60, self.interval_waiting)
251 self.logger.info(f"{self.device_type} is ready to use")
252
253 def tear_down(self, *args) -> None:
254 self.logger.warning("Sigterm is detected! Nothing to do!")

Callers

nothing calls this directly

Calls 1

check_adb_commandMethod · 0.95

Tested by

no test coverage detected