Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9d3aef0 authored by Harshit Mahajan's avatar Harshit Mahajan Committed by Gerrit Code Review
Browse files

Merge "Renaming isAttemptingFactoryReset to new name" into main

parents fa33da55 04e08e9f
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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();
    }

+1 −1
Original line number Diff line number Diff line
@@ -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!
+1 −1
Original line number Diff line number Diff line
@@ -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.
+8 −8
Original line number Diff line number Diff line
@@ -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);
        }
@@ -464,7 +464,7 @@ public class RescuePartyTest {
        noteBoot(mitigationCount++);
        setCrashRecoveryPropAttemptingReboot(false);
        noteBoot(mitigationCount + 1);
        assertTrue(RescueParty.isAttemptingFactoryReset());
        assertTrue(RescueParty.isRecoveryTriggeredReboot());
        assertTrue(RescueParty.isFactoryResetPropertySet());
    }

@@ -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
@@ -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
@@ -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() {
@@ -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