Summary
When a user grants the Usage Access permission during the onboarding flow (via the Permissions screen), the BackgroundService and aw-server-rust do not start after FINISH is tapped. The user sees the home screen but no tracking is active.
Steps to Reproduce
- Fresh install of aw-android
- Launch app → OnboardingActivity → Permissions screen
- Grant Usage Access permission (either via the system settings dialog or programmatically)
- Tap FINISH
- App returns to home screen
Expected: BackgroundService starts, aw-server-rust comes up on 127.0.0.1:5600, sync scheduler starts.
Actual: Process gets frozen/backgrounded. No BackgroundService, no aw-server-rust, no sync scheduler. Logcat shows:
ActivityManager: freezing <pid> net.activitywatch.android.debug
Workaround
Re-launching the app after granting usage access works correctly. On second launch, MainActivity detects that usage access is now granted and starts BackgroundService normally.
Root Cause (Suspected)
In MainActivity, the check if (firstTime || !isUsageAllowed()) runs at activity creation. When usage access is granted during the onboarding flow (after MainActivity has already started OnboardingActivity), the OnboardingActivity.FINISH callback doesn't re-check permissions and doesn't start the service — it just finishes.
Suggested fix: in OnboardingActivity's FINISH callback (or the activity result handler in MainActivity), call startService(BackgroundService) explicitly if usage access is now granted.
Environment
Related
Summary
When a user grants the Usage Access permission during the onboarding flow (via the Permissions screen), the
BackgroundServiceandaw-server-rustdo not start after FINISH is tapped. The user sees the home screen but no tracking is active.Steps to Reproduce
Expected: BackgroundService starts, aw-server-rust comes up on 127.0.0.1:5600, sync scheduler starts.
Actual: Process gets frozen/backgrounded. No BackgroundService, no aw-server-rust, no sync scheduler. Logcat shows:
Workaround
Re-launching the app after granting usage access works correctly. On second launch,
MainActivitydetects that usage access is now granted and starts BackgroundService normally.Root Cause (Suspected)
In
MainActivity, the checkif (firstTime || !isUsageAllowed())runs at activity creation. When usage access is granted during the onboarding flow (afterMainActivityhas already startedOnboardingActivity), theOnboardingActivity.FINISHcallback doesn't re-check permissions and doesn't start the service — it just finishes.Suggested fix: in
OnboardingActivity's FINISH callback (or the activity result handler inMainActivity), callstartService(BackgroundService)explicitly if usage access is now granted.Environment
adb installRelated