From 3046508e02f4d62f9c557a1720a1f440ecdcaec0 Mon Sep 17 00:00:00 2001 From: haok1402 Date: Sun, 6 Apr 2025 11:29:19 -0400 Subject: [PATCH 1/7] Show an alert dialog when the user manually checks for updates, but an update is already available and awaiting a reboot to complete installation. --- res/values/strings.xml | 1 + src/app/seamlessupdate/client/Settings.java | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/res/values/strings.xml b/res/values/strings.xml index 994494f..c974d63 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -47,4 +47,5 @@ Tap to check for updates Notification settings Modify notification channel settings + An update was previously downloaded and is ready to install, so it is not possible to download another update. Please reboot to install the pending update. diff --git a/src/app/seamlessupdate/client/Settings.java b/src/app/seamlessupdate/client/Settings.java index 11a304a..598cafd 100644 --- a/src/app/seamlessupdate/client/Settings.java +++ b/src/app/seamlessupdate/client/Settings.java @@ -9,6 +9,7 @@ import android.os.UserManager; import android.util.Log; import android.view.MenuItem; +import android.app.AlertDialog; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -83,6 +84,13 @@ public static class SettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener { private static String TAG = "SettingsFragment"; + private void showAlertDialogForPendingReboot(final Context context) { + new AlertDialog.Builder(context) + .setTitle(android.R.string.dialog_alert_title) + .setMessage(R.string.alert_pending_reboot) + .show(); + } + @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { getPreferenceManager().setStorageDeviceProtected(); @@ -100,6 +108,8 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { intent.putExtra(Service.INTENT_EXTRA_IS_USER_INITIATED, true); intent.putExtra(Service.INTENT_EXTRA_NETWORK, network); context.startForegroundService(intent); + } else { + showAlertDialogForPendingReboot(context); } return true; }; From 3df3640f79a98d6e0cbc24173204cc05681b1e76 Mon Sep 17 00:00:00 2001 From: haok1402 Date: Sun, 25 May 2025 17:54:41 -0400 Subject: [PATCH 2/7] block users from disabling the please-reboot notification 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. --- Android.bp | 8 ++++++++ .../app.seamlessupdate.client.xml | 6 ++++++ .../client/NotificationHandler.java | 19 +++++++++++++------ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 etc/default-permissions/app.seamlessupdate.client.xml diff --git a/Android.bp b/Android.bp index 46a6a4b..6e85647 100644 --- a/Android.bp +++ b/Android.bp @@ -10,11 +10,19 @@ android_app { platform_apis: true, privileged: true, required: [ + "etc_default-permissions_app.seamlessupdate.client.xml", "etc_permissions_app.seamlessupdate.client.xml", "etc_sysconfig_app.seamlessupdate.client.xml", ] } +prebuilt_etc { + name: "etc_default-permissions_app.seamlessupdate.client.xml", + src: "etc/default-permissions/app.seamlessupdate.client.xml", + sub_dir: "default-permissions", + filename_from_src: true, +} + prebuilt_etc { name: "etc_permissions_app.seamlessupdate.client.xml", src: "etc/permissions/app.seamlessupdate.client.xml", diff --git a/etc/default-permissions/app.seamlessupdate.client.xml b/etc/default-permissions/app.seamlessupdate.client.xml new file mode 100644 index 0000000..0883db5 --- /dev/null +++ b/etc/default-permissions/app.seamlessupdate.client.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/app/seamlessupdate/client/NotificationHandler.java b/src/app/seamlessupdate/client/NotificationHandler.java index 8b23c16..b227d41 100644 --- a/src/app/seamlessupdate/client/NotificationHandler.java +++ b/src/app/seamlessupdate/client/NotificationHandler.java @@ -44,20 +44,27 @@ private static enum Phase { final List channels = new ArrayList<>(); - channels.add(new NotificationChannel(NOTIFICATION_CHANNEL_ID_PROGRESS, - service.getString(R.string.notification_channel_progress), IMPORTANCE_LOW)); + final NotificationChannel progress = new NotificationChannel(NOTIFICATION_CHANNEL_ID_PROGRESS, + service.getString(R.string.notification_channel_progress), IMPORTANCE_LOW); + progress.setBlockable(true); + channels.add(progress); final NotificationChannel reboot = new NotificationChannel(NOTIFICATION_CHANNEL_ID_REBOOT, service.getString(R.string.notification_channel_reboot), IMPORTANCE_HIGH); reboot.enableLights(true); reboot.enableVibration(true); + reboot.setBlockable(false); channels.add(reboot); - channels.add(new NotificationChannel(NOTIFICATION_CHANNEL_ID_FAILURE, - service.getString(R.string.notification_channel_failure), IMPORTANCE_LOW)); + final NotificationChannel failure = new NotificationChannel(NOTIFICATION_CHANNEL_ID_FAILURE, + service.getString(R.string.notification_channel_failure), IMPORTANCE_LOW); + failure.setBlockable(true); + channels.add(failure); - channels.add(new NotificationChannel(NOTIFICATION_CHANNEL_ID_UPDATED, - service.getString(R.string.notification_channel_updated), IMPORTANCE_MIN)); + final NotificationChannel updated = new NotificationChannel(NOTIFICATION_CHANNEL_ID_UPDATED, + service.getString(R.string.notification_channel_updated), IMPORTANCE_MIN); + updated.setBlockable(true); + channels.add(updated); notificationManager.createNotificationChannels(channels); } From f284360bcc5117205439696b9c4f15321bfcfc1a Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 1 Jun 2025 13:13:26 -0400 Subject: [PATCH 3/7] Revert "block users from disabling 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 4e69487837c7724e580044ed9c37d1b16e5ae1b5. --- Android.bp | 8 -------- .../app.seamlessupdate.client.xml | 6 ------ .../client/NotificationHandler.java | 19 ++++++------------- 3 files changed, 6 insertions(+), 27 deletions(-) delete mode 100644 etc/default-permissions/app.seamlessupdate.client.xml diff --git a/Android.bp b/Android.bp index 6e85647..46a6a4b 100644 --- a/Android.bp +++ b/Android.bp @@ -10,19 +10,11 @@ android_app { platform_apis: true, privileged: true, required: [ - "etc_default-permissions_app.seamlessupdate.client.xml", "etc_permissions_app.seamlessupdate.client.xml", "etc_sysconfig_app.seamlessupdate.client.xml", ] } -prebuilt_etc { - name: "etc_default-permissions_app.seamlessupdate.client.xml", - src: "etc/default-permissions/app.seamlessupdate.client.xml", - sub_dir: "default-permissions", - filename_from_src: true, -} - prebuilt_etc { name: "etc_permissions_app.seamlessupdate.client.xml", src: "etc/permissions/app.seamlessupdate.client.xml", diff --git a/etc/default-permissions/app.seamlessupdate.client.xml b/etc/default-permissions/app.seamlessupdate.client.xml deleted file mode 100644 index 0883db5..0000000 --- a/etc/default-permissions/app.seamlessupdate.client.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/app/seamlessupdate/client/NotificationHandler.java b/src/app/seamlessupdate/client/NotificationHandler.java index b227d41..8b23c16 100644 --- a/src/app/seamlessupdate/client/NotificationHandler.java +++ b/src/app/seamlessupdate/client/NotificationHandler.java @@ -44,27 +44,20 @@ private static enum Phase { final List channels = new ArrayList<>(); - final NotificationChannel progress = new NotificationChannel(NOTIFICATION_CHANNEL_ID_PROGRESS, - service.getString(R.string.notification_channel_progress), IMPORTANCE_LOW); - progress.setBlockable(true); - channels.add(progress); + channels.add(new NotificationChannel(NOTIFICATION_CHANNEL_ID_PROGRESS, + service.getString(R.string.notification_channel_progress), IMPORTANCE_LOW)); final NotificationChannel reboot = new NotificationChannel(NOTIFICATION_CHANNEL_ID_REBOOT, service.getString(R.string.notification_channel_reboot), IMPORTANCE_HIGH); reboot.enableLights(true); reboot.enableVibration(true); - reboot.setBlockable(false); channels.add(reboot); - final NotificationChannel failure = new NotificationChannel(NOTIFICATION_CHANNEL_ID_FAILURE, - service.getString(R.string.notification_channel_failure), IMPORTANCE_LOW); - failure.setBlockable(true); - channels.add(failure); + channels.add(new NotificationChannel(NOTIFICATION_CHANNEL_ID_FAILURE, + service.getString(R.string.notification_channel_failure), IMPORTANCE_LOW)); - final NotificationChannel updated = new NotificationChannel(NOTIFICATION_CHANNEL_ID_UPDATED, - service.getString(R.string.notification_channel_updated), IMPORTANCE_MIN); - updated.setBlockable(true); - channels.add(updated); + channels.add(new NotificationChannel(NOTIFICATION_CHANNEL_ID_UPDATED, + service.getString(R.string.notification_channel_updated), IMPORTANCE_MIN)); notificationManager.createNotificationChannels(channels); } From 57fa296196b8458700d74c37250debf6123e9616 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 1 Jun 2025 13:13:36 -0400 Subject: [PATCH 4/7] remove unnecessary use of `this` --- src/app/seamlessupdate/client/NotificationHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/seamlessupdate/client/NotificationHandler.java b/src/app/seamlessupdate/client/NotificationHandler.java index 8b23c16..a80832f 100644 --- a/src/app/seamlessupdate/client/NotificationHandler.java +++ b/src/app/seamlessupdate/client/NotificationHandler.java @@ -40,7 +40,7 @@ private static enum Phase { NotificationHandler(Service service) { this.service = service; - this.notificationManager = service.getSystemService(NotificationManager.class); + notificationManager = service.getSystemService(NotificationManager.class); final List channels = new ArrayList<>(); From 00b9c2ac0954922b1f926b3510bfebb094b37402 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 1 Jun 2025 13:17:59 -0400 Subject: [PATCH 5/7] disable badge for already update notifications by default --- src/app/seamlessupdate/client/NotificationHandler.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/seamlessupdate/client/NotificationHandler.java b/src/app/seamlessupdate/client/NotificationHandler.java index a80832f..bf94211 100644 --- a/src/app/seamlessupdate/client/NotificationHandler.java +++ b/src/app/seamlessupdate/client/NotificationHandler.java @@ -56,8 +56,10 @@ private static enum Phase { channels.add(new NotificationChannel(NOTIFICATION_CHANNEL_ID_FAILURE, service.getString(R.string.notification_channel_failure), IMPORTANCE_LOW)); - channels.add(new NotificationChannel(NOTIFICATION_CHANNEL_ID_UPDATED, - service.getString(R.string.notification_channel_updated), IMPORTANCE_MIN)); + final NotificationChannel updated = new NotificationChannel(NOTIFICATION_CHANNEL_ID_UPDATED, + service.getString(R.string.notification_channel_updated), IMPORTANCE_MIN); + updated.setShowBadge(false); + channels.add(updated); notificationManager.createNotificationChannels(channels); } From ede7fbbc73e543fd8a7ddf890a795f7757d8829d Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Mon, 2 Jun 2025 13:02:11 -0400 Subject: [PATCH 6/7] increment TLS key pinning expiry date --- res/xml/network_security_config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/xml/network_security_config.xml b/res/xml/network_security_config.xml index 94a9c52..bae73b7 100644 --- a/res/xml/network_security_config.xml +++ b/res/xml/network_security_config.xml @@ -4,7 +4,7 @@ releases.grapheneos.org - + C5+lpZ7tcVwmwQIMcRtPbsQtWLABXhQzejna0wHFr8M= From 2e1ad195bad3be3ca0ceae8b548f87d9271327e5 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Thu, 3 Jul 2025 10:04:13 -0400 Subject: [PATCH 7/7] increment TLS key pinning expiry date --- res/xml/network_security_config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/xml/network_security_config.xml b/res/xml/network_security_config.xml index bae73b7..656f831 100644 --- a/res/xml/network_security_config.xml +++ b/res/xml/network_security_config.xml @@ -4,7 +4,7 @@ releases.grapheneos.org - + C5+lpZ7tcVwmwQIMcRtPbsQtWLABXhQzejna0wHFr8M=