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

Commit 60e3bbe0 authored by Garfield Tan's avatar Garfield Tan
Browse files

Skip desktop mode LPM if desktop mode isn't on

The difference between RESULT_CONTINUE and RESULT_SKIP is the former
will let the result be carried over to the next LPM, so without copying
over the input launch params, the result of previous LPM and the
previous record is lost.

Bug: 339093954
Test: Last records are preserved when desktop mode is disabled.
Test: atest DesktopModeLaunchParamsModifierTests
Change-Id: Id0af1e0ba037f1c14e10bf97189e8508da166b19
parent b8f502aa
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -80,8 +80,8 @@ public class DesktopModeLaunchParamsModifier implements LaunchParamsModifier {
            LaunchParamsController.LaunchParams outParams) {

        if (!canEnterDesktopMode(mContext)) {
            appendLog("desktop mode is not enabled, continuing");
            return RESULT_CONTINUE;
            appendLog("desktop mode is not enabled, skipping");
            return RESULT_SKIP;
        }

        if (task == null) {
+4 −4
Original line number Diff line number Diff line
@@ -79,19 +79,19 @@ public class DesktopModeLaunchParamsModifierTests extends WindowTestsBase {

    @Test
    @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE)
    public void testReturnsContinueIfDesktopWindowingIsDisabled() {
    public void testReturnsSkipIfDesktopWindowingIsDisabled() {
        setupDesktopModeLaunchParamsModifier();

        assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setTask(null).calculate());
        assertEquals(RESULT_SKIP, new CalculateRequestBuilder().setTask(null).calculate());
    }

    @Test
    @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE)
    public void testReturnsContinueIfDesktopWindowingIsEnabledOnUnsupportedDevice() {
    public void testReturnsSkipIfDesktopWindowingIsEnabledOnUnsupportedDevice() {
        setupDesktopModeLaunchParamsModifier(/*isDesktopModeSupported=*/ false,
                /*enforceDeviceRestrictions=*/ true);

        assertEquals(RESULT_CONTINUE, new CalculateRequestBuilder().setTask(null).calculate());
        assertEquals(RESULT_SKIP, new CalculateRequestBuilder().setTask(null).calculate());
    }

    @Test