Skip to content

Commit d2cb4ec

Browse files
committed
Only promote to foreground if not pausing timer
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.
1 parent 3558a5c commit d2cb4ec

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Reef/src/main/java/dev/pranav/reef/accessibility/FocusModeService.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,12 @@ class FocusModeService: Service() {
8181

8282
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
8383
if (intent?.action == null) {
84-
stopSelfResult(startId)
8584
return START_NOT_STICKY
8685
}
8786

88-
promoteToForeground()
87+
if (intent.action != ACTION_PAUSE) {
88+
promoteToForeground()
89+
}
8990

9091
when (intent.action) {
9192
ACTION_PAUSE -> pauseTimer()

0 commit comments

Comments
 (0)