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

Alarm won't go off after restart of the device (screen locked state) #398

Open
lune856 opened this issue Dec 30, 2021 · 4 comments
Open
Assignees
Labels
Milestone

Comments

@lune856
Copy link

lune856 commented Dec 30, 2021

Support Direct Boot mode

Android 7.0+ runs in a secure, Direct Boot mode when the device has been powered on but the user has not unlocked the device.

Normal apps are not launched until the user unlocks the device. If your app needs to access data while running in Direct Boot mode, use device encrypted storage.

Support Direct Boot mode on developer.android.com

Concept

User interaction is limited to Alerts and Notifications when the device is locked. To support direct mode we can save some date to device storage and use it when device is booted locked to scheduler alarms.

Describe the bug

Upon testing with the most current version of the app (3.07.00) the alarm won't work if the device is restarted and the phone is not unlocked (i.e No pattern or pin was entered to properly unlock and boot the device)
This can be an issue if a user scheduled a system update while asleep and the device was in a lock status.
When tested with Android's built-in clock app (https://play.google.com/store/apps/details?id=com.google.android.deskclock), the alarm would still go off when the device was restarted and the user has not unlocked the device.

To Reproduce

Describe the steps to reproduce the behavior:

  • Set an alarm (20~30 mins from now on)
  • Restart the device
  • Do nothing (if the device is unlocked and rebooted properly, the alarm would work)

Expected and observed behavior

The alarm should still work even when the device is restarted and the user has not entered the system

Screenshots

N/A

Logs

N/A

@lune856 lune856 added the bug label Dec 30, 2021
@yuriykulikov
Copy link
Owner

Hello @lune856 ,

I am sorry that you have had an issue with the app. Could you please help me to find the root cause?

If you are willing to help:

  1. Join the beta program via this link: https://play.google.com/store/apps/details?id=com.better.alarm
  2. Install the newest version (3.10.03)
  3. Reproduce the issue
  4. Unlock the phone
  5. Go the the app
  6. Click above on "Bugreport"
  7. Optionally change the email address to reply+AAGKDERBK6KFKB4QPAHMNEV73GAQDEVBNHHECCCLM4@reply.github.com

@yuriykulikov
Copy link
Owner

Neverming, I was able to reproduce this.
For whatever reason we are getting android.intent.action.BOOT_COMPLETED way too late after the phone reboots.

2021-12-30 15:31:43.363 [main] DEBUG AlarmCore - [Alarm 1] entering [RootState, EnabledState, SetState, NormalSetState]
2021-12-30 15:31:43.367 [main] DEBUG AlarmSetter - setInexactAlarm id: 1 on 31-12-21 09:00:00
2021-12-30 15:31:43.371 [main] DEBUG AlarmCore - [Alarm 2] entering [RootState, EnabledState, SetState, NormalSetState]
2021-12-30 15:31:43.374 [main] DEBUG AlarmSetter - setInexactAlarm id: 2 on 01-01-22 09:00:00
2021-12-30 15:31:43.376 [main] DEBUG Alarms - Started alarms, SDK is 31
2021-12-30 15:31:43.377 [main] DEBUG AlarmSetter - Set 1 (NORMAL) on 31-12-21 09:30:00
2021-12-30 15:31:43.381 [main] DEBUG Alarms - 1 [x] 9:30 mtwtf__ 
2021-12-30 15:31:43.381 [main] DEBUG Alarms - 2 [x] 9:30 _____ss 
2021-12-30 15:31:45.567 [main] DEBUG AlarmCore - [Alarm 3] entering [RootState, DisabledState]
2021-12-30 15:31:45.567 [main] DEBUG Alarms - 3 [ ] 15:31 _______ 
2021-12-30 15:31:50.924 [main] DEBUG AlarmDetailsFragment - Performing modification because of Picker
2021-12-30 15:31:51.795 [main] DEBUG AlarmCore - [Alarm 3] event Change(value=3 [x] 15:35 _______ ) -> (DisabledState > RootState)
2021-12-30 15:31:51.803 [main] DEBUG Alarms - 3 [x] 15:35 _______ 
2021-12-30 15:31:51.804 [main] DEBUG AlarmCore - [Alarm 3] transition [DisabledState] => [EnableTransition]
2021-12-30 15:31:51.805 [main] DEBUG AlarmCore - [Alarm 3] transition [EnableTransition] => [EnabledState, SetState, NormalSetState]
2021-12-30 15:31:51.828 [main] DEBUG AlarmSetter - Set 3 (NORMAL) on 30-12-21 15:35:00
2021-12-30 15:31:51.835 [main] DEBUG AlarmCore - Alarm 3 is due in less than 30 minutes - show notification
2021-12-30 15:38:48.444 [main] DEBUG AlarmCore - [Alarm 1] entering [RootState, EnabledState, SetState, NormalSetState]

REBOOT

... nothing happened ...

OPENED THE APP MANUALLY

2021-12-30 15:38:48.457 [main] DEBUG AlarmSetter - setInexactAlarm id: 1 on 31-12-21 09:00:00
2021-12-30 15:38:48.467 [main] DEBUG AlarmCore - [Alarm 2] entering [RootState, EnabledState, SetState, NormalSetState]
2021-12-30 15:38:48.476 [main] DEBUG AlarmSetter - setInexactAlarm id: 2 on 01-01-22 09:00:00
2021-12-30 15:38:48.492 [main] DEBUG AlarmCore - [Alarm 3] entering [RootState, EnabledState, SetState, NormalSetState]
2021-12-30 15:38:48.523 [main] DEBUG AlarmSetter - setInexactAlarm id: 3 on 31-12-21 15:05:00
2021-12-30 15:38:48.536 [main] DEBUG Alarms - Started alarms, SDK is 31
2021-12-30 15:38:48.540 [main] DEBUG AlarmSetter - Set 1 (NORMAL) on 31-12-21 09:30:00
2021-12-30 15:38:48.570 [main] DEBUG Alarms - 1 [x] 9:30 mtwtf__ 
2021-12-30 15:38:48.574 [main] DEBUG Alarms - 2 [x] 9:30 _____ss 
2021-12-30 15:38:48.581 [main] DEBUG Alarms - 3 [x] 15:35 _______ 

This is coming way too late:

2021-12-30 15:38:48.591 [main] DEBUG AlarmsReceiver - Refreshing alarms because of android.intent.action.BOOT_COMPLETED
2021-12-30 15:38:48.597 [main] DEBUG AlarmCore - [Alarm 1] event Refresh -> (NormalSetState > SetState > EnabledState > RootState)
2021-12-30 15:38:48.602 [main] DEBUG AlarmCore - [Alarm 1] transition [NormalSetState, SetState, EnabledState] => [EnableTransition]
2021-12-30 15:38:48.624 [main] DEBUG AlarmSetter - Set 3 (NORMAL) on 31-12-21 15:35:00
2021-12-30 15:38:48.640 [main] DEBUG AlarmCore - [Alarm 1] transition [EnableTransition] => [EnabledState, SetState, NormalSetState]
2021-12-30 15:38:48.649 [main] DEBUG Alarms - 1 [x] 9:30 mtwtf__ 
2021-12-30 15:38:48.681 [main] DEBUG AlarmSetter - Set 1 (NORMAL) on 31-12-21 09:30:00
2021-12-30 15:38:48.697 [main] DEBUG AlarmSetter - setInexactAlarm id: 1 on 31-12-21 09:00:00
2021-12-30 15:38:48.715 [main] DEBUG AlarmCore - [Alarm 2] event Refresh -> (NormalSetState > SetState > EnabledState > RootState)
2021-12-30 15:38:48.726 [main] DEBUG AlarmCore - [Alarm 2] transition [NormalSetState, SetState, EnabledState] => [EnableTransition]
2021-12-30 15:38:48.746 [main] DEBUG AlarmCore - [Alarm 2] transition [EnableTransition] => [EnabledState, SetState, NormalSetState]
2021-12-30 15:38:48.760 [main] DEBUG Alarms - 2 [x] 9:30 _____ss 
2021-12-30 15:38:48.783 [main] DEBUG AlarmSetter - setInexactAlarm id: 2 on 01-01-22 09:00:00
2021-12-30 15:38:48.795 [main] DEBUG AlarmCore - [Alarm 3] event Refresh -> (NormalSetState > SetState > EnabledState > RootState)
2021-12-30 15:38:48.798 [main] DEBUG AlarmCore - [Alarm 3] transition [NormalSetState, SetState, EnabledState] => [EnableTransition]
2021-12-30 15:38:48.806 [main] DEBUG AlarmCore - [Alarm 3] transition [EnableTransition] => [EnabledState, SetState, NormalSetState]
2021-12-30 15:38:48.829 [main] DEBUG Alarms - 3 [x] 15:35 _______ 
2021-12-30 15:38:48.844 [main] DEBUG AlarmSetter - setInexactAlarm id: 3 on 31-12-21 15:05:00
2021-12-30 15:39:29.017 [main] DEBUG AlarmCore - [Alarm 1] entering [RootState, EnabledState, SetState, NormalSetState]
2021-12-30 15:39:29.022 [main] DEBUG AlarmSetter - setInexactAlarm id: 1 on 31-12-21 09:00:00
2021-12-30 15:39:29.027 [main] DEBUG AlarmCore - [Alarm 2] entering [RootState, EnabledState, SetState, NormalSetState]
2021-12-30 15:39:29.029 [main] DEBUG AlarmSetter - setInexactAlarm id: 2 on 01-01-22 09:00:00
2021-12-30 15:39:29.031 [main] DEBUG AlarmCore - [Alarm 3] entering [RootState, EnabledState, SetState, NormalSetState]
2021-12-30 15:39:29.034 [main] DEBUG AlarmSetter - setInexactAlarm id: 3 on 31-12-21 15:05:00
2021-12-30 15:39:29.036 [main] DEBUG Alarms - Started alarms, SDK is 31
2021-12-30 15:39:29.036 [main] DEBUG AlarmSetter - Set 1 (NORMAL) on 31-12-21 09:30:00
2021-12-30 15:39:29.039 [main] DEBUG Alarms - 1 [x] 9:30 mtwtf__ 
2021-12-30 15:39:29.039 [main] DEBUG Alarms - 2 [x] 9:30 _____ss 
2021-12-30 15:39:29.040 [main] DEBUG Alarms - 3 [x] 15:35 _______ 

@yuriykulikov yuriykulikov self-assigned this Dec 31, 2021
@yuriykulikov yuriykulikov added this to the Features 2021 milestone Dec 31, 2021
@lune856
Copy link
Author

lune856 commented Jan 1, 2022

Hi Yuriykulikov, thanks for your prompt message. I'm out of town for a few days but we'll check the codes simultaneously to see if there's anything I can contribute. Thanks!

@yuriykulikov yuriykulikov removed the bug label Jan 11, 2022
@lune856
Copy link
Author

lune856 commented Feb 12, 2022

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Someday
Development

No branches or pull requests

2 participants