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

Commit d5adc1d1 authored by Kevin Chyn's avatar Kevin Chyn Committed by Android (Google) Code Review
Browse files

Merge "Fall back to RDMV1 if needed and possible" into main

parents 7ef8daba d1f158dd
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -126,7 +126,10 @@ public class WindowAreaComponentImpl implements WindowAreaComponent,
                return state.getIdentifier();
            }
        }
        return INVALID_DEVICE_STATE_IDENTIFIER;

        // If RDMV2 flag is enabled but not properly configured, let's fall back to RDMV1 if
        // possible.
        return getRdmV1Identifier(currentSupportedDeviceStates);
    }

    public WindowAreaComponentImpl(@NonNull Context context) {
+10 −3
Original line number Diff line number Diff line
@@ -143,13 +143,20 @@ public class WindowAreaComponentImplTests {
    }

    @Test
    public void testRdmV2Identifier_whenStateIsProperlyConfigured() {
    public void testFallsBackToRdmV1() {
        // Test that if we try to get RDMV2 but it's not available, that we get RDMV1 if it is
        // available.
        final List<DeviceState> supportedStates = new ArrayList<>();

        supportedStates.add(REAR_DISPLAY_STATE_V1);
        assertEquals(INVALID_DEVICE_STATE_IDENTIFIER,
        assertEquals(REAR_DISPLAY_STATE_V1.getIdentifier(),
                WindowAreaComponentImpl.getRdmV2Identifier(supportedStates));
    }

    @Test
    public void testRdmV2Identifier_whenStateIsProperlyConfigured() {
        final List<DeviceState> supportedStates = new ArrayList<>();

        supportedStates.add(REAR_DISPLAY_STATE_V1);
        supportedStates.add(REAR_DISPLAY_STATE_V2);
        assertEquals(REAR_DISPLAY_STATE_V2.getIdentifier(),
                WindowAreaComponentImpl.getRdmV2Identifier(supportedStates));