kraigs-android / kraigsandroid

Kraig's android applications
26 stars 26 forks source link

Crash with android.permission.SCHEDULE_EXACT_ALARM #158

Open asmith15 opened 2 days ago

asmith15 commented 2 days ago

Hello

Thanks a lot for Alarm Klock, I love it.

I switched to a new phone recently, running Lineage OS build 21-20241102-microG-akita. That's Android 14.

I restored Alarm Klock from a NeoBackup on my old phone, which was running Lineage OS build 21-2024-1001-microG-redfin. Also Android 14.

On the new phone Alarm Klock never rang, and I discovered it crashes as soon as I check the box next to any of the alarms. This is what I get in the logcat when I check the box:

11-22 14:39:01.462 2036 2057 I deeptouch: I0000 00:00:1732304341.461933 2057 tf_lite_classifier.cc:413] Event stream classified as kNone 11-22 14:39:01.544 1333 28579 D CompatibilityChangeReporter: Compat change id reported: 171306433; UID 10267; state: ENABLED 11-22 14:39:01.545 1333 28579 D CompatibilityChangeReporter: Compat change id reported: 218533173; UID 10267; state: ENABLED 11-22 14:39:01.545 1333 28579 D CompatibilityChangeReporter: Compat change id reported: 226439802; UID 10267; state: ENABLED 11-22 14:39:01.547 19537 19537 D AndroidRuntime: Shutting down VM 11-22 14:39:01.548 19537 19537 E AndroidRuntime: FATAL EXCEPTION: main 11-22 14:39:01.548 19537 19537 E AndroidRuntime: Process: com.angrydoughnuts.android.alarmclock, PID: 19537 11-22 14:39:01.548 19537 19537 E AndroidRuntime: java.lang.SecurityException: Caller com.angrydoughnuts.android.alarmclock needs to hold android.permission.SCHEDULE_EXACT_ALARM or android.permission.USE_EXACT_ALARM to set exact alarms. 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.os.Parcel.createExceptionOrNull(Parcel.java:3183) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.os.Parcel.createException(Parcel.java:3167) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:3150) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.os.Parcel.readException(Parcel.java:3092) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.app.IAlarmManager$Stub$Proxy.set(IAlarmManager.java:319) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.app.AlarmManager.setImpl(AlarmManager.java:1084) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.app.AlarmManager.setImpl(AlarmManager.java:1044) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.app.AlarmManager.setAlarmClock(AlarmManager.java:912) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at com.angrydoughnuts.android.alarmclock.AlarmNotificationService.scheduleAlarmTrigger(AlarmNotificationService.java:91) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at com.angrydoughnuts.android.alarmclock.AlarmClockActivity$3.onItemClick(AlarmClockActivity.java:123) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.widget.AdapterView.performItemClick(AdapterView.java:330) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.widget.AbsListView.performItemClick(AbsListView.java:1271) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.widget.AbsListView$PerformClick.run(AbsListView.java:3284) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.widget.AbsListView$3.run(AbsListView.java:4250) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:959) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:100) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:232) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.os.Looper.loop(Looper.java:317) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8592) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:878) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: Caused by: android.os.RemoteException: Remote stack trace: 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at com.android.server.alarm.AlarmManagerService$4.set(AlarmManagerService.java:2964) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.app.IAlarmManager$Stub.onTransact(IAlarmManager.java:189) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.os.Binder.execTransactInternal(Binder.java:1500) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: at android.os.Binder.execTransact(Binder.java:1444) 11-22 14:39:01.548 19537 19537 E AndroidRuntime: 11-22 14:39:01.552 1333 19659 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2 11-22 14:39:01.552 1333 28579 W ActivityTaskManager: Force finishing activity com.angrydoughnuts.android.alarmclock/.AlarmClockActivity 11-22 14:39:01.553 1931 1956 V WindowManagerShell: Transition requested (#835): android.os.BinderProxy@870bd78 TransitionRequestInfo { type = CLOSE, triggerTask = null, pipTask = null, remoteTransition = null, displayChange = null, flags = 16, debugId = 835 } 11-22 14:39:01.560 1333 1522 I ActivityManager: Showing crash dialog for package com.angrydoughnuts.android.alarmclock u0 11-22 14:39:01.589 525 525 I BpBinder: onLastStrongRef automatically unlinking death recipients: 11-22 14:39:01.611 1333 1522 D CompatibilityChangeReporter: Compat change id reported: 168419799; UID 1000; state: DISABLED 11-22 14:39:01.611 1333 1522 D CompatibilityChangeReporter: Compat change id reported: 273564678; UID 1000; state: DISABLED 11-22 14:39:01.623 1333 1522 D CoreBackPreview: Window{3701997 u0 Application Error: com.angrydoughnuts.android.alarmclock}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.WindowOnBackInvokedDispatcher$OnBackInvokedCallbackWrapper@6c19b25, mPriority=0, mIsAnimationCallback=false} 11-22 14:39:01.629 527 548 W gralloc4: Unable to set buffer name VRI[alarmclock]#61(BLAST Consumer)61: File name too long 11-22 14:39:01.630 527 548 W gralloc4: Unable to set buffer name VRI[alarmclock]#61(BLAST Consumer)61: File name too long 11-22 14:39:01.631 527 548 W gralloc4: Unable to set buffer name VRI[alarmclock]#61(BLAST Consumer)61: File name too long 11-22 14:39:01.631 527 548 W gralloc4: Unable to set buffer name VRI[alarmclock]#61(BLAST Consumer)61: File name too long 11-22 14:39:01.632 527 548 W gralloc4: Unable to set buffer name VRI[alarmclock]#61(BLAST Consumer)61: File name too long 11-22 14:39:01.667 1333 1525 V WindowManager: Loading animations: layout params pkg=android resId=0x1030309 11-22 14:39:01.668 1333 1525 V WindowManager: Loading animations: picked package=android 11-22 14:39:02.054 1333 1524 W ActivityTaskManager: Activity top resumed state loss timeout for ActivityRecord{129069f u0 com.angrydoughnuts.android.alarmclock/.AlarmClockActivity t122 f}} 11-22 14:39:02.057 1333 1524 W ActivityTaskManager: Activity pause timeout for ActivityRecord{129069f u0 com.angrydoughnuts.android.alarmclock/.AlarmClockActivity t122 f}} 11-22 14:39:02.072 1333 13571 W ActivityManager: Unable to start service Intent { act=com.android.launcher3.WINDOW_OVERLAY dat=app://com.android.launcher3:10203/... pkg=com.google.android.googlequicksearchbox } U=0: not found 11-22 14:39:02.079 1931 1956 D WindowManagerShell: setLauncherKeepClearAreaHeight: visible=true, height=294 11-22 14:39:02.080 1333 1524 W ProcessStats: Tracking association SourceState{620ddb0 com.android.phone/1001 ImpFg #19598} whose proc state 5 is better than process ProcessState{88ef659 com.google.android.iwlan/1000 pkg=com.google.android.iwlan} proc state 14 (11 skipped) 11-22 14:39:02.083 2316 2316 D BaseDepthController: setSurface: 11-22 14:39:02.083 2316 2316 D BaseDepthController: mWaitingOnSurfaceValidity: false 11-22 14:39:02.083 2316 2316 D BaseDepthController: mSurface: Surface(name=com.android.launcher3/com.android.launcher3.uioverrides.QuickstepLauncher)/@0x5aa5d4c 11-22 14:39:02.085 527 548 W gralloc4: Unable to set buffer name VRI[QuickstepLauncher]#151(BLAST Consumer)151: File name too long 11-22 14:39:02.086 527 548 W gralloc4: Unable to set buffer name VRI[QuickstepLauncher]#151(BLAST Consumer)151: File name too long 11-22 14:39:02.086 1333 1728 D CompatibilityChangeReporter: Compat change id reported: 261072174; UID 1000; state: ENABLED 11-22 14:39:02.087 527 548 W gralloc4: Unable to set buffer name VRI[QuickstepLauncher]#151(BLAST Consumer)151: File name too long 11-22 14:39:02.087 527 548 W gralloc4: Unable to set buffer name VRI[QuickstepLauncher]#151(BLAST Consumer)151: File name too long 11-22 14:39:02.088 527 548 W gralloc4: Unable to set buffer name VRI[QuickstepLauncher]#151(BLAST Consumer)151: File name too long 11-22 14:39:02.089 2316 2316 D StatsLog: LAUNCHER_ONRESUME 11-22 14:39:02.093 2316 2420 D QuickstepModelDelegate: notifyAppTargetEvent action=1 launchLocation=workspace/0/[-1,-1]/[1,1] 11-22 14:39:02.096 2316 2316 D QuickstepLauncher: Bind extra container items. ContainerId = -111 11-22 14:39:02.108 1931 1956 V WindowManagerShell: onTransitionReady (#835) android.os.BinderProxy@870bd78: {id=835 t=CLOSE f=0x10 trk=0 r=[0@Point(0, 0)] c=[{WCT{android.window.IWindowContainerToken$Stub$Proxy@34b2e42} m=TO_FRONT f=SHOW_WALLPAPER|MOVE_TO_TOP leash=Surface(name=Task=1)/@0x203fcb6 sb=Rect(0, 0 - 1080, 2400) eb=Rect(0, 0 - 1080, 2400) d=0},{WCT{android.window.IWindowContainerToken$Stub$Proxy@826fe53} m=CLOSE f=NONE leash=Surface(name=Task=122)/@0xd763db7 sb=Rect(0, 0 - 1080, 2400) eb=Rect(0, 0 - 1080, 2400) d=0},{null m=TO_FRONT f=IS_WALLPAPER leash=Surface(name=WallpaperWindowToken{530a77d token=android.os.Binder@1be79d4})/@0x4b03924 sb=Rect(0, 0 - 1080, 2400) eb=Rect(0, 0 - 1080, 2400) d=0}]} 11-22 14:39:02.109 1931 1956 V WindowManagerShell: Playing animation for (#835) android.os.BinderProxy@870bd78@0 11-22 14:39:02.109 1931 1956 V WindowManagerShell: try handler com.android.wm.shell.transition.DefaultMixedHandler@4be9460 11-22 14:39:02.109 1931 1956 V WindowManagerShell: try handler com.android.wm.shell.keyguard.KeyguardTransitionHandler@89a9d19 11-22 14:39:02.109 1931 1956 V WindowManagerShell: try handler com.android.wm.shell.pip.PipTransition@d7972cf 11-22 14:39:02.109 1931 1956 V WindowManagerShell: try handler com.android.wm.shell.activityembedding.ActivityEmbeddingController@8cb245c 11-22 14:39:02.109 1931 1956 V WindowManagerShell: try handler com.android.wm.shell.recents.RecentsTransitionHandler@ebab365 11-22 14:39:02.109 1931 1956 V ShellRecents: RecentsTransitionHandler.startAnimation: no controller found 11-22 14:39:02.109 1931 1956 V WindowManagerShell: try handler com.android.wm.shell.splitscreen.StageCoordinator@b56e4f6 11-22 14:39:02.109 1931 1956 V WindowManagerShell: try handler com.android.wm.shell.transition.RemoteTransitionHandler@d45583a 11-22 14:39:02.109 1931 1956 V WindowManagerShell: Transition doesn't have explicit remote, search filters for match for {id=835 t=CLOSE f=0x10 trk=0 r=[0@Point(0, 0)] c=[{WCT{android.window.IWindowContainerToken$Stub$Proxy@34b2e42} m=TO_FRONT f=SHOW_WALLPAPER|MOVE_TO_TOP leash=Surface(name=Task=1)/@0x203fcb6 sb=Rect(0, 0 - 1080, 2400) eb=Rect(0, 0 - 1080, 2400) d=0},{WCT{android.window.IWindowContainerToken$Stub$Proxy@826fe53} m=CLOSE f=NONE leash=Surface(name=Task=122)/@0xd763db7 sb=Rect(0, 0 - 1080, 2400) eb=Rect(0, 0 - 1080, 2400) d=0},{null m=TO_FRONT f=IS_WALLPAPER leash=Surface(name=WallpaperWindowToken{530a77d token=android.os.Binder@1be79d4})/@0x4b03924 sb=Rect(0, 0 - 1080, 2400) eb=Rect(0, 0 - 1080, 2400) d=0}]}

In Android's "App premissions" it says "No permissions denied".

Removing the app and reinstalling it doesn't fix the problem. It's been a long time since I've done any Android development, so I have no idea what the problem is. But hopefully it's obvious to you what is causing this.

The phone is rooted, please let me know if I can help troubleshoot this.

kraigs-android commented 1 day ago

This permission requirement was added in Android 13 and I've not gotten around to building an update that has a dialog box to ask for it. It's a 'special' permission, so it doesn't show up in the normal app settings permission list. You can manually grant it in Settings > Apps > Special app access > Alarms & reminders.

More info at https://developer.android.com/about/versions/14/changes/schedule-exact-alarms

asmith15 commented 1 day ago

That did it!

Thanks again for making and maintaining the app. I've used it for years. I checked again in the last couple of days, and Alarm klock still has by far the best user interface of all the many other alarm clock apps.