From 3f4dc8233e62b0ce8ab447b1a9ae21ebfe8fcc39 Mon Sep 17 00:00:00 2001 From: Kenneth Ford Date: Tue, 14 Feb 2023 22:11:48 +0000 Subject: [PATCH] Return STATUS_UNSUPPORTED if WindowAreaComponent is not supported Devices may support WM Extensions and use the reference implementation, but may not support WindowAreaComponent features. This change returns UNSUPPORTED values for status updates on these devices Bug: 269338840 Test: ExtensionRearDisplayTest#testRearDisplayStatusUnsupported_rearDisplayDeviceStateNotDefined Merged-In: I4b8d6c50474849442f67b18040ecee19c2b5e13b Change-Id: I4b8d6c50474849442f67b18040ecee19c2b5e13b --- .../window/extensions/area/WindowAreaComponentImpl.java | 4 ++++ 1 file changed, 4 insertions(+) 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 ff5f256b53974..9118ee2bf125c 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/area/WindowAreaComponentImpl.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/area/WindowAreaComponentImpl.java @@ -187,6 +187,10 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, @GuardedBy("mLock") private int getCurrentStatus() { + if (mRearDisplayState == INVALID_DEVICE_STATE) { + return WindowAreaComponent.STATUS_UNSUPPORTED; + } + if (mRearDisplaySessionStatus == WindowAreaComponent.SESSION_STATE_ACTIVE || isRearDisplayActive()) { return WindowAreaComponent.STATUS_UNAVAILABLE;