diff options
| -rw-r--r-- | libs/WindowManager/Jetpack/src/androidx/window/extensions/area/WindowAreaComponentImpl.java | 12 |
1 files changed, 11 insertions, 1 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 274dcaee5a43..575b0cea78f7 100644 --- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/area/WindowAreaComponentImpl.java +++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/area/WindowAreaComponentImpl.java @@ -263,8 +263,10 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, return; } @WindowAreaStatus int currentStatus = getCurrentRearDisplayPresentationModeStatus(); + DisplayMetrics metrics = + currentStatus == STATUS_UNSUPPORTED ? null : getRearDisplayMetrics(); consumer.accept( - new RearDisplayPresentationStatus(currentStatus, getRearDisplayMetrics())); + new RearDisplayPresentationStatus(currentStatus, metrics)); } } @@ -408,6 +410,10 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, @GuardedBy("mLock") private int getCurrentRearDisplayModeStatus() { + if (mRearDisplayState == INVALID_DEVICE_STATE) { + return WindowAreaComponent.STATUS_UNSUPPORTED; + } + if (mRearDisplaySessionStatus == WindowAreaComponent.SESSION_STATE_ACTIVE || !ArrayUtils.contains(mCurrentSupportedDeviceStates, mRearDisplayState) || isRearDisplayActive()) { @@ -441,6 +447,10 @@ public class WindowAreaComponentImpl implements WindowAreaComponent, @GuardedBy("mLock") private int getCurrentRearDisplayPresentationModeStatus() { + if (mConcurrentDisplayState == INVALID_DEVICE_STATE) { + return WindowAreaComponent.STATUS_UNSUPPORTED; + } + if (mCurrentDeviceState == mConcurrentDisplayState || !ArrayUtils.contains(mCurrentSupportedDeviceStates, mConcurrentDisplayState) || isDeviceFolded()) { |