Note: I did not build unit-tests (yet) since this requires quite some restructuring. Also, some discussion is required regarding the 'unlock' bucket (it seems total screentime, where each event is an unlock, is perhaps better).
:rocket:
This description was created by Ellipsis for commit b843e4563445065d489de8e76744719620ac3588
Summary:
Fixes event duration issue by updating Event and UsageStatsWatcher to handle app activity more accurately, ensuring correct heartbeat timing.
Key points:
Modified Event.fromUsageEvent in mobile/src/main/java/net/activitywatch/android/models/Event.kt to accept customTimestamp for precise timing.
Updated SendHeartbeatsTask in mobile/src/main/java/net/activitywatch/android/watcher/UsageStatsWatcher.kt to handle ACTIVITY_RESUMED and ACTIVITY_PAUSED events.
Added logic to skip launcher events and handle app switching correctly.
Ensured heartbeats are sent with appropriate pulse times to reflect actual app usage duration.
Note: I did not build unit-tests (yet) since this requires quite some restructuring. Also, some discussion is required regarding the 'unlock' bucket (it seems total screentime, where each event is an unlock, is perhaps better).
Summary:
Fixes event duration issue by updating
Event
andUsageStatsWatcher
to handle app activity more accurately, ensuring correct heartbeat timing.Key points:
Event.fromUsageEvent
inmobile/src/main/java/net/activitywatch/android/models/Event.kt
to acceptcustomTimestamp
for precise timing.SendHeartbeatsTask
inmobile/src/main/java/net/activitywatch/android/watcher/UsageStatsWatcher.kt
to handleACTIVITY_RESUMED
andACTIVITY_PAUSED
events.Generated with :heart: by ellipsis.dev