Loading packages/CrashRecovery/services/java/com/android/server/RescueParty.java +1 −3 Original line number Diff line number Diff line Loading @@ -163,10 +163,8 @@ public class RescueParty { * Check if we're currently attempting to reboot for a factory reset. This method must * return true if RescueParty tries to reboot early during a boot loop, since the device * will not be fully booted at this time. * * TODO(gavincorkery): Rename method since its scope has expanded. */ public static boolean isAttemptingFactoryReset() { public static boolean isRecoveryTriggeredReboot() { return isFactoryResetPropertySet() || isRebootPropertySet(); } Loading services/core/java/com/android/server/power/PowerManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -3933,7 +3933,7 @@ public final class PowerManagerService extends SystemService UserspaceRebootLogger.noteUserspaceRebootWasRequested(); } if (mHandler == null || !mSystemReady) { if (RescueParty.isAttemptingFactoryReset()) { if (RescueParty.isRecoveryTriggeredReboot()) { // If we're stuck in a really low-level reboot loop, and a // rescue party is trying to prompt the user for a factory data // reset, we must GET TO DA CHOPPA! Loading services/core/java/com/android/server/power/ShutdownThread.java +1 −1 Original line number Diff line number Diff line Loading @@ -332,7 +332,7 @@ public final class ShutdownThread extends Thread { com.android.internal.R.string.reboot_to_update_reboot)); } } else if (mReason != null && mReason.equals(PowerManager.REBOOT_RECOVERY)) { if (RescueParty.isAttemptingFactoryReset()) { if (RescueParty.isRecoveryTriggeredReboot()) { // We're not actually doing a factory reset yet; we're rebooting // to ask the user if they'd like to reset, so give them a less // scary dialog message. Loading services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java +8 −8 Original line number Diff line number Diff line Loading @@ -439,19 +439,19 @@ public class RescuePartyTest { } @Test public void testIsAttemptingFactoryReset() { public void testIsRecoveryTriggeredReboot() { for (int i = 0; i < LEVEL_FACTORY_RESET; i++) { noteBoot(i + 1); } assertFalse(RescueParty.isFactoryResetPropertySet()); setCrashRecoveryPropAttemptingReboot(false); noteBoot(LEVEL_FACTORY_RESET + 1); assertTrue(RescueParty.isAttemptingFactoryReset()); assertTrue(RescueParty.isRecoveryTriggeredReboot()); assertTrue(RescueParty.isFactoryResetPropertySet()); } @Test public void testIsAttemptingFactoryResetOnlyAfterRebootCompleted() { public void testIsRecoveryTriggeredRebootOnlyAfterRebootCompleted() { for (int i = 0; i < LEVEL_FACTORY_RESET; i++) { noteBoot(i + 1); } Loading @@ -464,7 +464,7 @@ public class RescuePartyTest { noteBoot(mitigationCount++); setCrashRecoveryPropAttemptingReboot(false); noteBoot(mitigationCount + 1); assertTrue(RescueParty.isAttemptingFactoryReset()); assertTrue(RescueParty.isRecoveryTriggeredReboot()); assertTrue(RescueParty.isFactoryResetPropertySet()); } Loading @@ -477,7 +477,7 @@ public class RescuePartyTest { for (int i = 1; i <= LEVEL_FACTORY_RESET; i++) { noteBoot(i); } assertFalse(RescueParty.isAttemptingFactoryReset()); assertFalse(RescueParty.isRecoveryTriggeredReboot()); } @Test Loading @@ -489,7 +489,7 @@ public class RescuePartyTest { for (int i = 0; i <= LEVEL_FACTORY_RESET; i++) { noteAppCrash(i + 1, true); } assertFalse(RescueParty.isAttemptingFactoryReset()); assertFalse(RescueParty.isRecoveryTriggeredReboot()); } @Test Loading @@ -501,7 +501,7 @@ public class RescuePartyTest { for (int i = 1; i <= LEVEL_FACTORY_RESET; i++) { noteBoot(i); } assertTrue(RescueParty.isAttemptingFactoryReset()); assertTrue(RescueParty.isRecoveryTriggeredReboot()); } @Test public void testNotThrottlingAfterTimeoutOnAppCrash() { Loading @@ -512,7 +512,7 @@ public class RescuePartyTest { for (int i = 0; i <= LEVEL_FACTORY_RESET; i++) { noteAppCrash(i + 1, true); } assertTrue(RescueParty.isAttemptingFactoryReset()); assertTrue(RescueParty.isRecoveryTriggeredReboot()); } @Test Loading Loading
packages/CrashRecovery/services/java/com/android/server/RescueParty.java +1 −3 Original line number Diff line number Diff line Loading @@ -163,10 +163,8 @@ public class RescueParty { * Check if we're currently attempting to reboot for a factory reset. This method must * return true if RescueParty tries to reboot early during a boot loop, since the device * will not be fully booted at this time. * * TODO(gavincorkery): Rename method since its scope has expanded. */ public static boolean isAttemptingFactoryReset() { public static boolean isRecoveryTriggeredReboot() { return isFactoryResetPropertySet() || isRebootPropertySet(); } Loading
services/core/java/com/android/server/power/PowerManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -3933,7 +3933,7 @@ public final class PowerManagerService extends SystemService UserspaceRebootLogger.noteUserspaceRebootWasRequested(); } if (mHandler == null || !mSystemReady) { if (RescueParty.isAttemptingFactoryReset()) { if (RescueParty.isRecoveryTriggeredReboot()) { // If we're stuck in a really low-level reboot loop, and a // rescue party is trying to prompt the user for a factory data // reset, we must GET TO DA CHOPPA! Loading
services/core/java/com/android/server/power/ShutdownThread.java +1 −1 Original line number Diff line number Diff line Loading @@ -332,7 +332,7 @@ public final class ShutdownThread extends Thread { com.android.internal.R.string.reboot_to_update_reboot)); } } else if (mReason != null && mReason.equals(PowerManager.REBOOT_RECOVERY)) { if (RescueParty.isAttemptingFactoryReset()) { if (RescueParty.isRecoveryTriggeredReboot()) { // We're not actually doing a factory reset yet; we're rebooting // to ask the user if they'd like to reset, so give them a less // scary dialog message. Loading
services/tests/mockingservicestests/src/com/android/server/RescuePartyTest.java +8 −8 Original line number Diff line number Diff line Loading @@ -439,19 +439,19 @@ public class RescuePartyTest { } @Test public void testIsAttemptingFactoryReset() { public void testIsRecoveryTriggeredReboot() { for (int i = 0; i < LEVEL_FACTORY_RESET; i++) { noteBoot(i + 1); } assertFalse(RescueParty.isFactoryResetPropertySet()); setCrashRecoveryPropAttemptingReboot(false); noteBoot(LEVEL_FACTORY_RESET + 1); assertTrue(RescueParty.isAttemptingFactoryReset()); assertTrue(RescueParty.isRecoveryTriggeredReboot()); assertTrue(RescueParty.isFactoryResetPropertySet()); } @Test public void testIsAttemptingFactoryResetOnlyAfterRebootCompleted() { public void testIsRecoveryTriggeredRebootOnlyAfterRebootCompleted() { for (int i = 0; i < LEVEL_FACTORY_RESET; i++) { noteBoot(i + 1); } Loading @@ -464,7 +464,7 @@ public class RescuePartyTest { noteBoot(mitigationCount++); setCrashRecoveryPropAttemptingReboot(false); noteBoot(mitigationCount + 1); assertTrue(RescueParty.isAttemptingFactoryReset()); assertTrue(RescueParty.isRecoveryTriggeredReboot()); assertTrue(RescueParty.isFactoryResetPropertySet()); } Loading @@ -477,7 +477,7 @@ public class RescuePartyTest { for (int i = 1; i <= LEVEL_FACTORY_RESET; i++) { noteBoot(i); } assertFalse(RescueParty.isAttemptingFactoryReset()); assertFalse(RescueParty.isRecoveryTriggeredReboot()); } @Test Loading @@ -489,7 +489,7 @@ public class RescuePartyTest { for (int i = 0; i <= LEVEL_FACTORY_RESET; i++) { noteAppCrash(i + 1, true); } assertFalse(RescueParty.isAttemptingFactoryReset()); assertFalse(RescueParty.isRecoveryTriggeredReboot()); } @Test Loading @@ -501,7 +501,7 @@ public class RescuePartyTest { for (int i = 1; i <= LEVEL_FACTORY_RESET; i++) { noteBoot(i); } assertTrue(RescueParty.isAttemptingFactoryReset()); assertTrue(RescueParty.isRecoveryTriggeredReboot()); } @Test public void testNotThrottlingAfterTimeoutOnAppCrash() { Loading @@ -512,7 +512,7 @@ public class RescuePartyTest { for (int i = 0; i <= LEVEL_FACTORY_RESET; i++) { noteAppCrash(i + 1, true); } assertTrue(RescueParty.isAttemptingFactoryReset()); assertTrue(RescueParty.isRecoveryTriggeredReboot()); } @Test Loading