updater: reboot the installed slot via tryboot again

Revert config_abRebootReason back to the config_use_tryboot boolean now that
A/B uses RPi tryboot (a safe trial that reverts to the active slot on failure).
No behavior change on devices that leave it false.
This commit is contained in:
oxmc
2026-07-17 05:11:44 -07:00
parent 2fb8e31cfd
commit b74673ae02
4 changed files with 5 additions and 16 deletions
@@ -78,7 +78,7 @@ public class UpdaterReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
if (ACTION_INSTALL_REBOOT.equals(intent.getAction())) {
PowerManager pm = context.getSystemService(PowerManager.class);
pm.reboot(Utils.getAbRebootReason(context));
pm.reboot(Utils.usesTryboot(context) ? "tryboot" : null);
} else if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
pref.edit().remove(Constants.PREF_NEEDS_REBOOT_ID).apply();
@@ -412,7 +412,7 @@ public class UpdatesListAdapter extends RecyclerView.Adapter<UpdatesListAdapter.
button.setEnabled(enabled);
clickListener = enabled ? view -> {
PowerManager pm = mActivity.getSystemService(PowerManager.class);
pm.reboot(Utils.getAbRebootReason(mActivity));
pm.reboot(Utils.usesTryboot(mActivity) ? "tryboot" : null);
} : null;
}
break;
@@ -420,14 +420,7 @@ public class Utils {
return new File(Constants.UPDATE_RECOVERY_EXEC).exists();
}
/**
* Reason to pass to {@link android.os.PowerManager#reboot} when booting the
* freshly-installed slot, or {@code null} for a normal reboot. Devices whose
* firmware needs an explicit slot boot set config_abRebootReason (e.g. RPi
* uses "2" to one-shot boot partition 2 = boot_b).
*/
public static String getAbRebootReason(Context context) {
String reason = context.getResources().getString(R.string.config_abRebootReason);
return (reason == null || reason.isEmpty()) ? null : reason;
public static boolean usesTryboot(Context context) {
return context.getResources().getBoolean(R.bool.config_use_tryboot);
}
}
+1 -5
View File
@@ -5,9 +5,5 @@
-->
<resources>
<bool name="config_hideRecoveryUpdate">false</bool>
<!-- Reason passed to PowerManager.reboot() to boot the freshly-installed
slot. Empty = normal reboot. Devices whose firmware needs an explicit
slot boot override this (e.g. RPi sets "2" to one-shot boot partition 2
= boot_b); see the device vendor.prop / config.txt. -->
<string name="config_abRebootReason" translatable="false"></string>
<bool name="config_use_tryboot">false</bool>
</resources>