diff options
| author | 2024-01-09 14:55:47 +0900 | |
|---|---|---|
| committer | 2024-01-09 14:55:47 +0900 | |
| commit | 2f0f93ea9fc856a8af2b2f80dc2f7f422cffd02e (patch) | |
| tree | bce9b051b584a0c1bd7a3ca7aea3df367084fec0 | |
| parent | 8ce9cb3dc637b482af5c94b13176dc548ba5e430 (diff) | |
Support display cutout side override in tests
The mocked resource will accidentally return null without return value
override and will break the NonNull contract of the obtainTypedArray
API. Return the mock array instead to avoid the unexpected crash.
Test: LocalDisplayAdapterTest
Bug: 302387383
Change-Id: I9b5542da0d3820a1f7e7c421518771ac580cfbe3
| -rw-r--r-- | services/tests/displayservicetests/src/com/android/server/display/LocalDisplayAdapterTest.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/services/tests/displayservicetests/src/com/android/server/display/LocalDisplayAdapterTest.java b/services/tests/displayservicetests/src/com/android/server/display/LocalDisplayAdapterTest.java index 00f98924eff3..c92ce254cae4 100644 --- a/services/tests/displayservicetests/src/com/android/server/display/LocalDisplayAdapterTest.java +++ b/services/tests/displayservicetests/src/com/android/server/display/LocalDisplayAdapterTest.java @@ -176,6 +176,10 @@ public class LocalDisplayAdapterTest { when(mockArray.length()).thenReturn(0); when(mMockedResources.obtainTypedArray(R.array.config_maskBuiltInDisplayCutoutArray)) .thenReturn(mockArray); + when(mMockedResources.obtainTypedArray(R.array.config_displayCutoutSideOverrideArray)) + .thenReturn(mockArray); + when(mMockedResources.getStringArray(R.array.config_mainBuiltInDisplayCutoutSideOverride)) + .thenReturn(new String[]{}); when(mMockedResources.obtainTypedArray(R.array.config_waterfallCutoutArray)) .thenReturn(mockArray); when(mMockedResources.obtainTypedArray(R.array.config_roundedCornerRadiusArray)) |