Skip to content

fix(onboarding): relaunch MainActivity after onboarding finishes - #298

Open
0xbrayo wants to merge 1 commit into
ActivityWatch:masterfrom
0xbrayo:fix/onboarding-start-main
Open

0xbrayo wants to merge 1 commit into
ActivityWatch:masterfrom
0xbrayo:fix/onboarding-start-main

Conversation

@0xbrayo

@0xbrayo 0xbrayo commented Sep 19, 2026

Copy link
Copy Markdown
Member

MainActivity.onCreate starts OnboardingActivity and then calls finish() on itself. When the user grants Usage Access during onboarding and taps FINISH, OnboardingActivity only called finish(), leaving nothing on the back stack: the user lands on the launcher and no BackgroundService (aw-server-rust, sync scheduler) starts until the app is opened a second time.

This starts MainActivity explicitly before finishing onboarding so the normal startup path runs right away.

Fixes #170.

Validation: :mobile:compileStandardDebugKotlin passes. Not yet exercised on a device.

MainActivity finishes itself when it hands off to OnboardingActivity, so
when the user granted Usage Access during onboarding and tapped FINISH,
the task simply ended and the user landed on the launcher. Nothing
started the BackgroundService (aw-server-rust, sync scheduler) until the
app was opened a second time.

Start MainActivity explicitly before finishing onboarding so the normal
startup path (service start, alarms, initial fragment) runs immediately.
@greptile-apps

greptile-apps Bot commented Sep 19, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the new launch follows the existing onboarding state and permission checks and restores the intended startup flow.

Summary

This PR fixes onboarding completion by explicitly relaunching MainActivity after recording completion, allowing the normal service and scheduler startup path to run immediately.

  • Starts MainActivity after the user grants usage access and finishes onboarding.
  • Preserves the existing permission gate and first-run preference update.
  • Closes OnboardingActivity after initiating the replacement activity.

Diagram

sequenceDiagram
    participant U as User
    participant O as OnboardingActivity
    participant P as AWPreferences
    participant M as MainActivity
    participant B as BackgroundService

    U->>O: Tap FINISH
    O->>O: Verify usage access
    O->>P: Clear first-run flag
    O->>M: startActivity(MainActivity)
    O->>O: finish()
    M->>M: Run normal startup path
    M->>B: Start foreground service
Loading

Reviews (1) · Last reviewed commit: "fix(onboarding): relaunch MainActivity a..."

@0xbrayo
0xbrayo marked this pull request as draft September 19, 2026 17:59
@ErikBjare
ErikBjare marked this pull request as ready for review September 19, 2026 18:29
@ErikBjare

Copy link
Copy Markdown
Member

@0xbrayo ready?

@0xbrayo

0xbrayo commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

Tested on device, ready to merge 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BackgroundService not starting when Usage Access is granted during onboarding (requires re-launch)

2 participants