Skip to content

Commit

Permalink
Fix bug where stopwatch was not cleared before/after task execution.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 686578732
  • Loading branch information
Chris Rawles authored and The android_world Authors committed Oct 16, 2024
1 parent 990d2e1 commit 4959cf8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions android_world/task_evals/single/clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,27 @@ def _is_timer_set(
return False


def _close_clock_app(env: interface.AsyncEnv):
"""Closes the clock app."""
adb_utils.clear_app_data(
adb_utils.extract_package_name(adb_utils.get_adb_activity("clock")),
env.controller,
)


class _ClockEval(task_eval.TaskEval):
"""Base class for clock tasks."""

app_names = ("clock",)

def initialize_task(self, env: interface.AsyncEnv):
super().initialize_task(env)
_close_clock_app(env)

def tear_down(self, env: interface.AsyncEnv):
super().tear_down(env)
_close_clock_app(env)


class ClockTimerEntry(_ClockEval):
"""Task for checking if timer is set (but not started)."""
Expand Down

0 comments on commit 4959cf8

Please sign in to comment.