ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.67k stars 2.24k forks source link

Samsung: Too many alarms (500) registered #6332

Closed david-allison closed 4 years ago

david-allison commented 4 years ago

Reported on Reddit

https://couchdb.ankidroid.org/acralyzer/_design/acralyzer/index.html#/report-details/c956c3d3-f8aa-4406-82ac-cd79d848b596

java.lang.RuntimeException: Unable to create application com.ichi2.anki.AnkiDroidApp: java.lang.SecurityException: !@Too many alarms (500) registered from uid 10215
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6163)
at android.app.ActivityThread.access$1200(ActivityThread.java:235)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:6986)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
Caused by: java.lang.SecurityException: !@Too many alarms (500) registered from uid 10215
at android.os.Parcel.createException(Parcel.java:1966)
at android.os.Parcel.readException(Parcel.java:1934)
at android.os.Parcel.readException(Parcel.java:1884)
at android.app.IAlarmManager$Stub$Proxy.set(IAlarmManager.java:240)
at android.app.AlarmManager.setImpl(AlarmManager.java:722)
at android.app.AlarmManager.setRepeating(AlarmManager.java:468)
at com.ichi2.anki.services.BootService.scheduleDeckReminder(BootService.java:19)
at com.ichi2.anki.services.BootService.onReceive(BootService.java:8)
at com.ichi2.anki.AnkiDroidApp.onCreate(AnkiDroidApp.java:31)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6158)
... 8 more

https://stackoverflow.com/questions/29344971/java-lang-securityexception-too-many-alarms-500-registered-from-pid-10790-u

david-allison commented 4 years ago

I'm going to hotpatch this for now, with a planned follow-up fix, this means users can't open the app.

david-allison commented 4 years ago

Likely cause: notifications enabled with over 500 decks?

>>> pp(len(self.col.decks.all())) 1027