Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Syncing media notification getting stuck #17719

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

criticalAY
Copy link
Contributor

Purpose / Description

I found out that the notification gets stuck after the exception is thrown and not cleared at times, hence force clear the notification once the worker has stopped

Fixes

Approach

Force clear the sync notification in case the worker is not running

How Has This Been Tested?

Google emulator API 35

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@criticalAY
Copy link
Contributor Author

We can also move it only to catch block instead of finally

@@ -111,6 +116,11 @@ class SyncMediaWorker(
}
}

private fun clearNotification() {
Timber.i("SyncMediaWorker notification cleared")
notificationManager.cancel(NotificationId.SYNC_MEDIA)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. This seems like an unexpectedly simple fix for this issue.
I admit I don't see the point of adding clearNotification, and not just inling this funciton where it's used, unless you plan to reuse it.
You add two Timber, where once seems probably sufficient.

I don't know this part of the code. My main qustion is: when the code works normally, what cause the notification to disappear? Because I'd have assumed that this is the part of the code that could be put in a function and reused.
Except that I don't see any place that ever cancel/dlismiss the SYNC_MEDIA notification in our codebase

Copy link
Member

@BrayanDSO BrayanDSO Jan 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with inlining it.

And you probably don't need the isStopped check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main qustion is: when the code works normally, what cause the notification to disappear? Because I'd have assumed that this is the part of the code that could be put in a function and reused.
Except that I don't see any place that ever cancel/dlismiss the SYNC_MEDIA notification in our codebase

The notification itself was being marked as ongoing (setOngoing(true)), which prevents the user from manually dismissing it, further exacerbating the issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And you probably don't need the isStopped check

I would want to clear notifications only when the worker is stopped, adds a precaution step

Copy link
Member

@BrayanDSO BrayanDSO Jan 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But how the work can be stopped while running? I don't see it being stopped anywhere in the code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when the code works normally, what cause the notification to disappear?

The notification itself was being marked as ongoing (setOngoing(true)), which prevents the user from manually dismissing it, further exacerbating the issue.

I believe that Arthur's question wans't answered

Copy link
Member

@BrayanDSO BrayanDSO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sharing the reproduction steps would help. A test would be even better

@@ -111,6 +116,11 @@ class SyncMediaWorker(
}
}

private fun clearNotification() {
Timber.i("SyncMediaWorker notification cleared")
notificationManager.cancel(NotificationId.SYNC_MEDIA)
Copy link
Member

@BrayanDSO BrayanDSO Jan 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with inlining it.

And you probably don't need the isStopped check

@criticalAY
Copy link
Contributor Author

Sharing the reproduction steps would help. A test would be even better

I reproduced this issue by following the steps mentioned by the OP of the issue

@criticalAY criticalAY added the Needs Author Reply Waiting for a reply from the original author label Jan 5, 2025
@criticalAY
Copy link
Contributor Author

Key Problem(my investigation): ForegroundServiceStartNotAllowedException:

android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false

This exception occurs because the SyncMediaWorker attempted to start a foreground service while the app was either in the background or the system disallowed starting foreground services at that moment.

Modern Android versions (particularly from Android 12 onwards) impose stricter limitations on starting foreground services while the app is in the background. The system prevents such actions unless they are triggered by user interactions or explicitly whitelisted.

@Arthur-Milchior the apps works normally when this sort of exc is not thrown, not sure how this works in Android background but clearing the notification seems like a reasonable solution

I have logs of both the cases, i.e. when the notification was cleared and when it was stuck

Logs

Stopping foreground work for Intent { act=ACTION_CANCEL_WORK dat=workspec://985888c6-c8bc-4a3a-88bf-e73214a08cea/... flg=0x10000000 cmp=com.ichi2.anki.debug/androidx.work.impl.foreground.SystemForegroundService bnds=[147,841][301,967] (has extras) }
2025-01-05 22:51:34.534  1952-2077  WM-Processor            com.ichi2.anki.debug                 D  Processor cancelling 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:34.534  1952-1952  WM-SystemFgDispatcher   com.ichi2.anki.debug                 I  Stopping foreground service
2025-01-05 22:51:34.534  1952-1952  WM-SystemFgService      com.ichi2.anki.debug                 D  Shutting down.
2025-01-05 22:51:34.536  1952-1952  LeakCanary              com.ichi2.anki.debug                 D  Watching instance of androidx.work.impl.foreground.SystemForegroundService (androidx.work.impl.foreground.SystemForegroundService received Service#onDestroy() callback) with key fdc30e6f-3004-436a-8953-8d283e7349ef
2025-01-05 22:51:34.542  1952-2077  WM-Processor            com.ichi2.anki.debug                 D  WorkerWrapper interrupted for 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:34.544  1952-3577  SyncMediaWorker         com.ichi2.anki.debug                 W  kotlinx.coroutines.JobCancellationException: Job was cancelled; job=JobImpl{Cancelling}@15cd6c
2025-01-05 22:51:34.546  1952-3577  SyncMediaWorker         com.ichi2.anki.debug                 I  SyncMediaWorker stopped, notification cleared
2025-01-05 22:51:34.547  1952-2077  WM-GreedyScheduler      com.ichi2.anki.debug                 D  Cancelling work ID 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:34.548  1952-1952  WM-SystemJobService     com.ichi2.anki.debug                 D  onStopJob for WorkGenerationalId(workSpecId=985888c6-c8bc-4a3a-88bf-e73214a08cea, generation=0)
2025-01-05 22:51:34.554  1952-1952  LeakCanary              com.ichi2.anki.debug                 D  Watching instance of androidx.work.impl.background.systemjob.SystemJobService (androidx.work.impl.background.systemjob.SystemJobService received Service#onDestroy() callback) with key 9d9b334e-a3e1-4648-afc9-5f805f8cd1d5
2025-01-05 22:51:34.554  1952-2085  WM-WorkerWrapper        com.ichi2.anki.debug                 I  Work [ id=985888c6-c8bc-4a3a-88bf-e73214a08cea, tags={ com.ichi2.anki.worker.SyncMediaWorker } ] was cancelled (Ask Gemini)
                                                                                                    androidx.work.impl.WorkerStoppedException
                                                                                                    	at androidx.work.impl.WorkerWrapper.interrupt(WorkerWrapper.kt:348)
                                                                                                    	at androidx.work.impl.Processor.interrupt(Processor.java:439)
                                                                                                    	at androidx.work.impl.Processor.stopAndCancelWork(Processor.java:280)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable.cancel(CancelWorkRunnable.kt:33)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable.access$cancel(CancelWorkRunnable.kt:1)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable$forId$1.invoke$lambda$0(CancelWorkRunnable.kt:76)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable$forId$1.$r8$lambda$c6ckNuSXH3At6SBb4mDMZynE_5I(Unknown Source:0)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable$forId$1$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                                                                                                    	at androidx.room.RoomDatabase.runInTransaction(RoomDatabase.kt:585)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable$forId$1.invoke(CancelWorkRunnable.kt:76)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable$forId$1.invoke(CancelWorkRunnable.kt:70)
                                                                                                    	at androidx.work.OperationKt.launchOperation$lambda$2$lambda$1(Operation.kt:50)
                                                                                                    	at androidx.work.OperationKt.$r8$lambda$XKAkIiEN7OgIvwuLUZRQpJhjmyE(Unknown Source:0)
                                                                                                    	at androidx.work.OperationKt$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0)
                                                                                                    	at androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
                                                                                                    	at java.lang.Thread.run(Thread.java:1012)
2025-01-05 22:51:34.555  1952-2085  WM-WorkerWrapper        com.ichi2.anki.debug                 D  Status for 985888c6-c8bc-4a3a-88bf-e73214a08cea is CANCELLED ; not doing any work
2025-01-05 22:51:34.557  1952-2085  WM-StopWorkRunnable     com.ichi2.anki.debug                 D  StopWorkRunnable for 985888c6-c8bc-4a3a-88bf-e73214a08cea; Processor.stopWork = false
2025-01-05 22:51:34.557  1952-2085  WM-StopWorkRunnable     com.ichi2.anki.debug                 D  StopWorkRunnable for 985888c6-c8bc-4a3a-88bf-e73214a08cea; Processor.stopWork = false
2025-01-05 22:51:34.558  1952-1952  WM-Processor            com.ichi2.anki.debug                 D  Processor 985888c6-c8bc-4a3a-88bf-e73214a08cea executed; reschedule = false
2025-01-05 22:51:34.558  1952-1952  WM-GreedyScheduler      com.ichi2.anki.debug                 D  Stopping tracking for WorkGenerationalId(workSpecId=985888c6-c8bc-4a3a-88bf-e73214a08cea, generation=0)
2025-01-05 22:51:34.561  1952-2077  WM-GreedyScheduler      com.ichi2.anki.debug                 D  Cancelling work ID 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:34.563  1952-2085  WM-NetworkStateTracker  com.ichi2.anki.debug                 D  Unregistering network callback
2025-01-05 22:51:31.635  1952-6511  anki::sync::media::da.. com.ichi2.anki.debug                 D  mark clean fname="12-54.mp3"
2025-01-05 22:51:31.635  1952-6511  anki::sync::media::da.. com.ichi2.anki.debug                 D  mark clean fname="12-55.mp3"
2025-01-05 22:51:31.635  1952-6511  anki::sync::media::da.. com.ichi2.anki.debug                 D  mark clean fname="12-56.mp3"

2025-01-05 22:51:31.635  1952-6511  anki::sync::media::da.. com.ichi2.anki.debug                 D  mark clean fname="12-61.mp3"

2025-01-05 22:51:31.638  1952-6511  anki::sync::media::sy.. com.ichi2.anki.debug                 D  fetching record batch start_usn=Usn(79184)
2025-01-05 22:51:31.797  1952-6511  anki::sync::media::sy.. com.ichi2.anki.debug                 D  empty batch, done
2025-01-05 22:51:31.797  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="12-75.mp3" kind="addition"
2025-01-05 22:51:31.797  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="12-76.mp3" kind="addition"

2025-01-05 22:51:31.798  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="12-92.mp3" kind="addition"
2025-01-05 22:51:31.798  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="12-93.mp3" kind="addition"
2025-01-05 22:51:31.798  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="12-94.mp3" kind="addition"
2025-01-05 22:51:31.798  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="12-95.mp3" kind="addition"
2025-01-05 22:51:31.798  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="12-96.mp3" kind="addition"
2025-01-05 22:51:31.798  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="12-97.mp3" kind="addition"
2025-01-05 22:51:31.798  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="12-98.mp3" kind="addition"
2025-01-05 22:51:31.799  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="12-99.mp3" kind="addition"
2025-01-05 22:51:31.988  1952-3577  SyncMediaWorker         com.ichi2.anki.debug                 I  Showing SyncMediaWorker's notification
2025-01-05 22:51:31.989  1952-2085  WM-Processor            com.ichi2.anki.debug                 I  Moving WorkSpec (985888c6-c8bc-4a3a-88bf-e73214a08cea) to the foreground
2025-01-05 22:51:31.994  1952-3577  CoroutineWorkerKt       com.ichi2.anki.debug                 W  android.app.ForegroundServiceStartNotAllowedException: startForegroundService() not allowed due to mAllowStartForeground false: service com.ichi2.anki.debug/androidx.work.impl.foreground.SystemForegroundService (Ask Gemini)
                                                                                                    	at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:54)
                                                                                                    	at android.app.ForegroundServiceStartNotAllowedException$1.createFromParcel(ForegroundServiceStartNotAllowedException.java:50)
                                                                                                    	at android.os.Parcel.readParcelableInternal(Parcel.java:5075)
                                                                                                    	at android.os.Parcel.readParcelable(Parcel.java:5057)
                                                                                                    	at android.os.Parcel.createExceptionOrNull(Parcel.java:3237)
                                                                                                    	at android.os.Parcel.createException(Parcel.java:3226)
                                                                                                    	at android.os.Parcel.readException(Parcel.java:3209)
                                                                                                    	at android.os.Parcel.readException(Parcel.java:3151)
                                                                                                    	at android.app.IActivityManager$Stub$Proxy.startService(IActivityManager.java:6393)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at leakcanary.ServiceWatcher$install$4$2.invoke(ServiceWatcher.kt:93)
                                                                                                    	at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
                                                                                                    	at $Proxy4.startService(Unknown Source)
                                                                                                    	at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1960)
                                                                                                    	at android.app.ContextImpl.startForegroundService(ContextImpl.java:1935)
                                                                                                    	at android.content.ContextWrapper.startForegroundService(ContextWrapper.java:832)
                                                                                                    	at androidx.core.content.ContextCompat$Api26Impl.startForegroundService(ContextCompat.java:1130)
                                                                                                    	at androidx.core.content.ContextCompat.startForegroundService(ContextCompat.java:711)
                                                                                                    	at androidx.work.impl.Processor.startForeground(Processor.java:205)
                                                                                                    	at androidx.work.impl.utils.WorkForegroundUpdater.lambda$setForegroundAsync$0$androidx-work-impl-utils-WorkForegroundUpdater(WorkForegroundUpdater.java:94)
                                                                                                    	at androidx.work.impl.utils.WorkForegroundUpdater$$ExternalSyntheticLambda0.invoke(D8$$SyntheticClass:0)
                                                                                                    	at androidx.work.ListenableFutureKt.executeAsync$lambda$4$lambda$3(ListenableFuture.kt:59)
                                                                                                    	at androidx.work.ListenableFutureKt.$r8$lambda$2J7WTnmfyHeSyx3GGU57K1DCNjw(Unknown Source:0)
                                                                                                    	at androidx.work.ListenableFutureKt$$ExternalSyntheticLambda3.run(D8$$SyntheticClass:0)
                                                                                                    	at androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
                                                                                                    	at java.lang.Thread.run(Thread.java:1012)
2025-01-05 22:51:32.896  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="13-113.mp3" kind="addition"

2025-01-05 22:51:34.135  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="13-167.mp3" kind="addition"
2025-01-05 22:51:34.135  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="13-168.mp3" kind="addition"
2025-01-05 22:51:34.135  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="13-169.mp3" kind="addition"

2025-01-05 22:51:34.470  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="13-22.mp3" kind="addition"
2025-01-05 22:51:34.470  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="13-23.mp3" kind="addition"
2025-01-05 22:51:34.470  1952-6511  anki::sync::media::up.. com.ichi2.anki.debug                 D  will upload file.fname="13-24.mp3" kind="addition"
2025-01-05 22:51:34.532  1952-1952  WM-SystemFgDispatcher   com.ichi2.anki.debug                 I  Stopping foreground work for Intent { act=ACTION_CANCEL_WORK dat=workspec://985888c6-c8bc-4a3a-88bf-e73214a08cea/... flg=0x10000000 cmp=com.ichi2.anki.debug/androidx.work.impl.foreground.SystemForegroundService bnds=[147,841][301,967] (has extras) }
2025-01-05 22:51:34.534  1952-2077  WM-Processor            com.ichi2.anki.debug                 D  Processor cancelling 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:34.534  1952-1952  WM-SystemFgDispatcher   com.ichi2.anki.debug                 I  Stopping foreground service
2025-01-05 22:51:34.534  1952-1952  WM-SystemFgService      com.ichi2.anki.debug                 D  Shutting down.
2025-01-05 22:51:34.536  1952-1952  LeakCanary              com.ichi2.anki.debug                 D  Watching instance of androidx.work.impl.foreground.SystemForegroundService (androidx.work.impl.foreground.SystemForegroundService received Service#onDestroy() callback) with key fdc30e6f-3004-436a-8953-8d283e7349ef
2025-01-05 22:51:34.542  1952-2077  WM-Processor            com.ichi2.anki.debug                 D  WorkerWrapper interrupted for 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:34.544  1952-3577  SyncMediaWorker         com.ichi2.anki.debug                 W  kotlinx.coroutines.JobCancellationException: Job was cancelled; job=JobImpl{Cancelling}@15cd6c
2025-01-05 22:51:34.546  1952-3577  SyncMediaWorker         com.ichi2.anki.debug                 I  SyncMediaWorker stopped, notification cleared
2025-01-05 22:51:34.547  1952-2077  WM-GreedyScheduler      com.ichi2.anki.debug                 D  Cancelling work ID 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:34.548  1952-1952  WM-SystemJobService     com.ichi2.anki.debug                 D  onStopJob for WorkGenerationalId(workSpecId=985888c6-c8bc-4a3a-88bf-e73214a08cea, generation=0)
2025-01-05 22:51:34.554  1952-1952  LeakCanary              com.ichi2.anki.debug                 D  Watching instance of androidx.work.impl.background.systemjob.SystemJobService (androidx.work.impl.background.systemjob.SystemJobService received Service#onDestroy() callback) with key 9d9b334e-a3e1-4648-afc9-5f805f8cd1d5
2025-01-05 22:51:34.554  1952-2085  WM-WorkerWrapper        com.ichi2.anki.debug                 I  Work [ id=985888c6-c8bc-4a3a-88bf-e73214a08cea, tags={ com.ichi2.anki.worker.SyncMediaWorker } ] was cancelled (Ask Gemini)
                                                                                                    androidx.work.impl.WorkerStoppedException
                                                                                                    	at androidx.work.impl.WorkerWrapper.interrupt(WorkerWrapper.kt:348)
                                                                                                    	at androidx.work.impl.Processor.interrupt(Processor.java:439)
                                                                                                    	at androidx.work.impl.Processor.stopAndCancelWork(Processor.java:280)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable.cancel(CancelWorkRunnable.kt:33)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable.access$cancel(CancelWorkRunnable.kt:1)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable$forId$1.invoke$lambda$0(CancelWorkRunnable.kt:76)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable$forId$1.$r8$lambda$c6ckNuSXH3At6SBb4mDMZynE_5I(Unknown Source:0)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable$forId$1$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                                                                                                    	at androidx.room.RoomDatabase.runInTransaction(RoomDatabase.kt:585)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable$forId$1.invoke(CancelWorkRunnable.kt:76)
                                                                                                    	at androidx.work.impl.utils.CancelWorkRunnable$forId$1.invoke(CancelWorkRunnable.kt:70)
                                                                                                    	at androidx.work.OperationKt.launchOperation$lambda$2$lambda$1(Operation.kt:50)
                                                                                                    	at androidx.work.OperationKt.$r8$lambda$XKAkIiEN7OgIvwuLUZRQpJhjmyE(Unknown Source:0)
                                                                                                    	at androidx.work.OperationKt$$ExternalSyntheticLambda1.run(D8$$SyntheticClass:0)
                                                                                                    	at androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
                                                                                                    	at java.lang.Thread.run(Thread.java:1012)
2025-01-05 22:51:34.555  1952-2085  WM-WorkerWrapper        com.ichi2.anki.debug                 D  Status for 985888c6-c8bc-4a3a-88bf-e73214a08cea is CANCELLED ; not doing any work
2025-01-05 22:51:34.557  1952-2085  WM-StopWorkRunnable     com.ichi2.anki.debug                 D  StopWorkRunnable for 985888c6-c8bc-4a3a-88bf-e73214a08cea; Processor.stopWork = false
2025-01-05 22:51:34.557  1952-2085  WM-StopWorkRunnable     com.ichi2.anki.debug                 D  StopWorkRunnable for 985888c6-c8bc-4a3a-88bf-e73214a08cea; Processor.stopWork = false
2025-01-05 22:51:34.558  1952-1952  WM-Processor            com.ichi2.anki.debug                 D  Processor 985888c6-c8bc-4a3a-88bf-e73214a08cea executed; reschedule = false
2025-01-05 22:51:34.558  1952-1952  WM-GreedyScheduler      com.ichi2.anki.debug                 D  Stopping tracking for WorkGenerationalId(workSpecId=985888c6-c8bc-4a3a-88bf-e73214a08cea, generation=0)
2025-01-05 22:51:34.561  1952-2077  WM-GreedyScheduler      com.ichi2.anki.debug                 D  Cancelling work ID 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:34.563  1952-2085  WM-NetworkStateTracker  com.ichi2.anki.debug                 D  Unregistering network callback
2025-01-05 22:51:34.567  1952-2077  WM-PackageManagerHelper com.ichi2.anki.debug                 D  androidx.work.impl.background.systemalarm.RescheduleReceiver disabled
2025-01-05 22:51:37.444  1952-1952  WM-SystemFgDispatcher   com.ichi2.anki.debug                 I  Stopping foreground work for Intent { act=ACTION_CANCEL_WORK dat=workspec://985888c6-c8bc-4a3a-88bf-e73214a08cea/... flg=0x10000000 cmp=com.ichi2.anki.debug/androidx.work.impl.foreground.SystemForegroundService bnds=[147,841][301,967] (has extras) }
2025-01-05 22:51:37.444  1952-2085  WM-Processor            com.ichi2.anki.debug                 D  Processor cancelling 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:37.444  1952-2085  WM-Processor            com.ichi2.anki.debug                 D  WorkerWrapper could not be found for 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:37.445  1952-2085  WM-GreedyScheduler      com.ichi2.anki.debug                 D  Cancelling work ID 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:38.777  1952-1952  WM-SystemFgDispatcher   com.ichi2.anki.debug                 I  Stopping foreground work for Intent { act=ACTION_CANCEL_WORK dat=workspec://985888c6-c8bc-4a3a-88bf-e73214a08cea/... flg=0x10000000 cmp=com.ichi2.anki.debug/androidx.work.impl.foreground.SystemForegroundService bnds=[147,841][301,967] (has extras) }
2025-01-05 22:51:38.779  1952-2085  WM-Processor            com.ichi2.anki.debug                 D  Processor cancelling 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:38.780  1952-2085  WM-Processor            com.ichi2.anki.debug                 D  WorkerWrapper could not be found for 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:38.780  1952-2085  WM-GreedyScheduler      com.ichi2.anki.debug                 D  Cancelling work ID 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:39.581  1952-1975  chi2.anki.debug         com.ichi2.anki.debug                 I  Explicit concurrent mark compact GC freed 1000KB AllocSpace bytes, 0(0B) LOS objects, 49% free, 10MB/20MB, paused 141us,2.557ms total 42.681ms
2025-01-05 22:51:39.794  1952-1952  WM-SystemFgDispatcher   com.ichi2.anki.debug                 I  Stopping foreground work for Intent { act=ACTION_CANCEL_WORK dat=workspec://985888c6-c8bc-4a3a-88bf-e73214a08cea/... flg=0x10000000 cmp=com.ichi2.anki.debug/androidx.work.impl.foreground.SystemForegroundService bnds=[147,841][301,967] (has extras) }
2025-01-05 22:51:39.795  1952-2085  WM-Processor            com.ichi2.anki.debug                 D  Processor cancelling 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:39.795  1952-2085  WM-Processor            com.ichi2.anki.debug                 D  WorkerWrapper could not be found for 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:51:39.795  1952-2085  WM-GreedyScheduler      com.ichi2.anki.debug                 D  Cancelling work ID 985888c6-c8bc-4a3a-88bf-e73214a08cea
2025-01-05 22:52:00.505  1952-1952  DayRolloverHandler      com.ichi2.anki.debug                 V  received android.intent.action.TIME_TICK

@@ -84,6 +84,9 @@ class SyncMediaWorker(
setContentTitle(CollectionManager.TR.syncMediaFailed())
}
return Result.failure()
} finally {
Timber.i("SyncMediaWorker stopped, notification cleared")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The worker stops when it returns. Just log that the notification is being cleared

Copy link
Contributor

Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Author Reply Waiting for a reply from the original author Needs Review Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Syncing media notification gets stuck sometimes
3 participants