Skip to content

Alert User of Pending Reboot When Manual Update Check Is Blocked#102

Draft
haok1402 wants to merge 11 commits intoGrapheneOS:16from
haok1402:fix-pending-reboot
Draft

Alert User of Pending Reboot When Manual Update Check Is Blocked#102
haok1402 wants to merge 11 commits intoGrapheneOS:16from
haok1402:fix-pending-reboot

Conversation

@haok1402
Copy link
Contributor

@haok1402 haok1402 commented Apr 8, 2025

Description:

This PR improves the system updater by notifying users when they attempt a manual update check while an update is already prepared and awaiting a reboot. Instead of ignoring the user’s tap on the “Check for updates” button, the system now displays an alert, prompting the user to reboot.

Due to the critical nature of System Updater, this proposed change is the smallest imagined code change. If desired, it could be expanded on. For example, it would be possible to store the build number of the pending update and include that in the displayed alert.

Changes:

  • Previously, if KEY_WAITING_FOR_REBOOT was true inside the clickListener, the update check was ignored without notifying the user.
  • Now, an alert dialog is shown to inform the user that a reboot is required before another update check can be performed.

Testing:

Tested on Pixel 6a, 2025032100 release to ensure:

  • Update check works normally when no reboot is pending.
  • Alert dialog correctly appears when a reboot is required.
  • No regressions or unexpected behavior.

Screenshot from the testing can be found here.

Expected Behavior:

When the user checks for updates:

  • If no reboot is pending, the system initiates the update check.
  • If a reboot is pending, an alert dialog informs the user before proceeding.

I am happy to revise and resubmit the code if any changes are desired.

Resolves #101

@haok1402 haok1402 marked this pull request as ready for review April 8, 2025 01:47
…an update is already available and awaiting a reboot to complete installation.
@haok1402 haok1402 force-pushed the fix-pending-reboot branch from 18faa2f to 3046508 Compare April 11, 2025 02:14
@thestinger
Copy link
Member

@haok1402 It would be very helpful to prevent fully disabling System Updater notifications and reboot notifications while still allowing explicitly disabling the others (disabling errors is sketchy but it would need to support automatically retrying before reporting errors at least for automatic updates prior to prevent disabling it). This is done for some other system app notifications but these are easily the most important and should be done for it too. It seems many users try to disable the Already up-to-date notifications or the progress notification and accidentally end up disabling all of them instead.

@de0u
Copy link

de0u commented May 15, 2025

@thestinger I believe @haok1402 is traveling and may not be able to respond for a few days. Meanwhile, is it easy to indicate one of the system apps that currently prevents notification disabling?

@thestinger
Copy link
Member

It's done for GmsCompat. I'm not sure exactly where. I think there are cases where overall notifications can't be disabled but specific channels can be disabled.

@haok1402
Copy link
Contributor Author

@thestinger Thanks for the info! I'm interested and will start looking into it.

@haok1402
Copy link
Contributor Author

I've investigated how GmsCompat handles this and confirmed that it uses fixed notifications, with certain channels marked as blockable — users can't disable notifications entirely but a few specific channels. Based on that, I plan to make and test similar changes to System Updater: mark its notifications as fixed and set the reboot channel as non-blockable.

@thestinger Would you prefer these changes as part of this PR (to retain the current discussion/context), or submitted in a new PR that references this one?

@thestinger
Copy link
Member

Just as a new fully separate PR.

@haok1402
Copy link
Contributor Author

haok1402 commented May 27, 2025

I have an implementation that seems to work on the old release.
Planning to test on 2025052000 and submit the PR in the next few days.

@thestinger
Copy link
Member

This might still be useful since I think there are still ways to clear away the reboot notification despite it being marked persistent, the permission being marked fixed and the channel not being opted into being blockable.

@thestinger
Copy link
Member

@haok1402 Can you rebase it instead of merging? git rebase upstream/16

@haok1402
Copy link
Contributor Author

@thestinger Yes, fixing it.

@haok1402 haok1402 force-pushed the fix-pending-reboot branch from 3821d98 to b6b5c42 Compare July 23, 2025 16:36
haok1402 and others added 7 commits July 23, 2025 12:44
Statically grant Updater permission for "fixed" notifications;
set most notifications to be blockable by users, but set
notifications on the REBOOT channel to be non-blockable.

Some users have gotten "stuck" by disabling the notification
to reboot the system to install a new release.  Updater can't
download and prepare a later release until the previously-prepared
release has been installed, so it is important to avoid losing
the please-reboot notification.
This worked as intended for most users but caused an unexpected issue
blocking changing all of the notification channels for several users.

This reverts commit 4e69487.
@haok1402 haok1402 changed the base branch from 15-qpr2 to 16 September 24, 2025 16:38
@thestinger
Copy link
Member

@haok1402 Needs to be rebased again.

@haok1402
Copy link
Contributor Author

@thestinger Sorry, my bad; I thought the GitHub button can do the trick; Let me pull down and run the rebase.

@de0u
Copy link

de0u commented Oct 25, 2025

@thestinger I believe @haok1402 will also be re-testing. If either of you can flip the PR back to "draft", that might be appropriate?

@haok1402 haok1402 marked this pull request as draft October 25, 2025 21:12
@haok1402
Copy link
Contributor Author

@de0u Yes; I flipped it back to draft. #105 was flipped to draft as well; also need some re-testeing on that.

@thestinger
Copy link
Member

We did successfully ship a variant of @haok1402's earlier changes making the notification channels fixed, so that's good. I considered that a lot more important. We also got rid of the 3 day timeout introduced with Android 15 QPR1. There are still some other issues such as what happens if an update check occurs in early boot after an existing update is having post-boot code run, which should just delay doing the new update until that finishes.

@de0u
Copy link

de0u commented Oct 28, 2025

@thestinger Two questions...

  1. Given that the problem of users accidentally disabling/disabling "please reboot" notifications was solved "the other way" in PR Make System Updater notifications “fixed”, with the REBOOT channel configured as non-blockable. #107 and PR notification timeout fix + block users from disabling reboot, security preview, and failure notifications #118, is this PR (to encourage a user to reboot if an update is pending) still wanted? If so I believe @haok1402 is willing to rebase it and retest it. Or would you prefer to just leave it open for now in case at some later point it is thought to be useful?

  2. Are you interested in a new PR to address cases where an automatic check or even possibly a manual check might happen too early, such as right after a reboot while optimization is still running from a previous update? If so, do you want me to file an issue for that? I believe @haok1402 is willing to work on that too (after PR Add Confirmation Dialog for Manual Updates on Metered/Roaming Networks #105 is sorted out, I suspect).

@thestinger
Copy link
Member

@de0u This would still be useful because the notification can still be lost including via Do Not Disturb.

@thestinger
Copy link
Member

It would probably good if the app had a generic status display in the settings.

@thestinger
Copy link
Member

Are you interested in a new PR to address cases where an automatic check or even possibly a manual check might happen too early, such as right after a reboot while optimization is still running from a previous update?

Yes, but note it's not the app optimization which is relevant. The app optimization is our own thing unrelated to update_engine. The issue is that it seems update_engine does some post-update work which can sometimes take longer than it used to and opens up a real window where weird behavior can happen because our app both gets an error but also gets progress updates and then thinks the update finished when the post-update stuff from what it was already doing is done.

@thestinger
Copy link
Member

In that case, it asks people to reboot to update, when it's for the last update which was doing post-boot work, and it has deleted the downloaded update from the error. After people reboot, it has to do it again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alert user of a pending update when “Check for updates” is pressed

3 participants