summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/WindowManager/Jetpack/src/androidx/window/extensions/area/WindowAreaComponentImpl.java5
-rw-r--r--libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/area/WindowAreaComponentImplTests.java13
2 files changed, 14 insertions, 4 deletions
diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/area/WindowAreaComponentImpl.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/area/WindowAreaComponentImpl.java
index 76eb207a31c9..8e04855f7d14 100644
--- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/area/WindowAreaComponentImpl.java
+++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/area/WindowAreaComponentImpl.java
@@ -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) {
diff --git a/libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/area/WindowAreaComponentImplTests.java b/libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/area/WindowAreaComponentImplTests.java
index d677fef5c22c..b7983bdaf4cf 100644
--- a/libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/area/WindowAreaComponentImplTests.java
+++ b/libs/WindowManager/Jetpack/tests/unittest/src/androidx/window/extensions/area/WindowAreaComponentImplTests.java
@@ -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));