Loading packages/CrashRecovery/aconfig/flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -39,3 +39,10 @@ flag { bug: "289203818" is_fixed_read_only: true } flag { name: "synchronous_reboot_in_rescue_party" namespace: "modularization" description: "Makes reboot and factory reset synchronous in RescueParty" bug: "328203835" } No newline at end of file services/core/java/com/android/server/PackageWatchdog.java +10 −0 Original line number Diff line number Diff line Loading @@ -1292,6 +1292,16 @@ public class PackageWatchdog { /** Dump status of every observer in mAllObservers. */ public void dump(@NonNull PrintWriter pw) { if (Flags.synchronousRebootInRescueParty() && RescueParty.isRecoveryTriggeredReboot()) { dumpInternal(pw); } else { synchronized (mLock) { dumpInternal(pw); } } } private void dumpInternal(@NonNull PrintWriter pw) { IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " "); ipw.println("Package Watchdog status"); ipw.increaseIndent(); Loading services/core/java/com/android/server/RescueParty.java +37 −15 Original line number Diff line number Diff line Loading @@ -631,6 +631,17 @@ public class RescueParty { // Request the reboot from a separate thread to avoid deadlock on PackageWatchdog // when device shutting down. setRebootProperty(true); if (Flags.synchronousRebootInRescueParty()) { try { PowerManager pm = context.getSystemService(PowerManager.class); if (pm != null) { pm.reboot(TAG); } } catch (Throwable t) { logRescueException(level, failedPackage, t); } } else { Runnable runnable = () -> { try { PowerManager pm = context.getSystemService(PowerManager.class); Loading @@ -644,6 +655,7 @@ public class RescueParty { Thread thread = new Thread(runnable); thread.start(); } } private static void executeFactoryReset(Context context, int level, @Nullable String failedPackage) { Loading @@ -655,11 +667,20 @@ public class RescueParty { setFactoryResetProperty(true); long now = System.currentTimeMillis(); setLastFactoryResetTimeMs(now); if (Flags.synchronousRebootInRescueParty()) { try { RecoverySystem.rebootPromptAndWipeUserData(context, TAG + "," + failedPackage); } catch (Throwable t) { logRescueException(level, failedPackage, t); } } else { Runnable runnable = new Runnable() { @Override public void run() { try { RecoverySystem.rebootPromptAndWipeUserData(context, TAG + "," + failedPackage); RecoverySystem.rebootPromptAndWipeUserData(context, TAG + "," + failedPackage); } catch (Throwable t) { logRescueException(level, failedPackage, t); } Loading @@ -668,6 +689,7 @@ public class RescueParty { Thread thread = new Thread(runnable); thread.start(); } } private static String getCompleteMessage(Throwable t) { Loading Loading
packages/CrashRecovery/aconfig/flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -39,3 +39,10 @@ flag { bug: "289203818" is_fixed_read_only: true } flag { name: "synchronous_reboot_in_rescue_party" namespace: "modularization" description: "Makes reboot and factory reset synchronous in RescueParty" bug: "328203835" } No newline at end of file
services/core/java/com/android/server/PackageWatchdog.java +10 −0 Original line number Diff line number Diff line Loading @@ -1292,6 +1292,16 @@ public class PackageWatchdog { /** Dump status of every observer in mAllObservers. */ public void dump(@NonNull PrintWriter pw) { if (Flags.synchronousRebootInRescueParty() && RescueParty.isRecoveryTriggeredReboot()) { dumpInternal(pw); } else { synchronized (mLock) { dumpInternal(pw); } } } private void dumpInternal(@NonNull PrintWriter pw) { IndentingPrintWriter ipw = new IndentingPrintWriter(pw, " "); ipw.println("Package Watchdog status"); ipw.increaseIndent(); Loading
services/core/java/com/android/server/RescueParty.java +37 −15 Original line number Diff line number Diff line Loading @@ -631,6 +631,17 @@ public class RescueParty { // Request the reboot from a separate thread to avoid deadlock on PackageWatchdog // when device shutting down. setRebootProperty(true); if (Flags.synchronousRebootInRescueParty()) { try { PowerManager pm = context.getSystemService(PowerManager.class); if (pm != null) { pm.reboot(TAG); } } catch (Throwable t) { logRescueException(level, failedPackage, t); } } else { Runnable runnable = () -> { try { PowerManager pm = context.getSystemService(PowerManager.class); Loading @@ -644,6 +655,7 @@ public class RescueParty { Thread thread = new Thread(runnable); thread.start(); } } private static void executeFactoryReset(Context context, int level, @Nullable String failedPackage) { Loading @@ -655,11 +667,20 @@ public class RescueParty { setFactoryResetProperty(true); long now = System.currentTimeMillis(); setLastFactoryResetTimeMs(now); if (Flags.synchronousRebootInRescueParty()) { try { RecoverySystem.rebootPromptAndWipeUserData(context, TAG + "," + failedPackage); } catch (Throwable t) { logRescueException(level, failedPackage, t); } } else { Runnable runnable = new Runnable() { @Override public void run() { try { RecoverySystem.rebootPromptAndWipeUserData(context, TAG + "," + failedPackage); RecoverySystem.rebootPromptAndWipeUserData(context, TAG + "," + failedPackage); } catch (Throwable t) { logRescueException(level, failedPackage, t); } Loading @@ -668,6 +689,7 @@ public class RescueParty { Thread thread = new Thread(runnable); thread.start(); } } private static String getCompleteMessage(Throwable t) { Loading