Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: simple timer restart after 15 minutes#39

Merged
PranavPurwar merged 2 commits intoaload0:main from
alv-cor:fix/simple-timer-autorestarts
Jan 28, 2026
Merged

fix: simple timer restart after 15 minutes #39
PranavPurwar merged 2 commits intoaload0:main from
alv-cor:fix/simple-timer-autorestarts

Conversation

@alv-cor
Copy link
Contributor

@alv-cor alv-cor commented Jan 27, 2026
edited
Loading

This pull request refines how the FocusModeService is started and managed, ensuring that the service is only initiated with explicit intent actions and improving the clarity and safety of service lifecycle management. The changes primarily affect how the service is started from MainActivity and how it handles incoming intents.

Service Start and Intent Handling Improvements:

  • MainActivity.kt: Updated the call to startForegroundService to include the ACTION_START intent action, ensuring the service is always started with a clear action.
  • FocusModeService.kt: Added a new constant ACTION_START for the explicit start action.
  • FocusModeService.kt: Changed onStartCommand to stop the service immediately if the intent action is null, using stopSelfResult(startId), and only start the timer when the ACTION_START action is received.

Minor Code Quality Improvements:

Android checks every 15 minutes if service is alive with an intent whose action is null. MainActivity now starts FocusModeService with the ACTION_START intent action. FocusModeService handles ACTION_START explicitly in onStartCommand, improving intent handling and service control.
Updated onStartCommand to call promoteToForeground only when the intent action is not ACTION_PAUSE, preventing unnecessary foreground promotion when pausing the timer.
Removes unnecessary stopSelf that killed the timer on null actions.
@PranavPurwar PranavPurwar merged commit b895ab5 into aload0:main Jan 28, 2026
1 check passed
@alv-cor alv-cor deleted the fix/simple-timer-autorestarts branch January 29, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /