Don't throw when setting the same windowing mode

We may throw UnsupportedOperationException when setting windowing mode
other than fullscreen or unspecified in the locked task mode. However if
the container in question is already in the same mode there is no need
to fail the request.

Bug: 263492303
Test: Build and boot.
Change-Id: I55caa81b0c5a259ae39785c0ef473e12aa8b3286
This commit is contained in:
Garfield Tan
2022-12-22 22:30:29 +00:00
parent 9882b54f75
commit 462b8f5f47

View File

@@ -658,7 +658,8 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
}
}
if (windowingMode > -1) {
final int prevWindowingMode = container.getWindowingMode();
if (windowingMode > -1 && prevWindowingMode != windowingMode) {
if (mService.isInLockTaskMode()
&& WindowConfiguration.inMultiWindowMode(windowingMode)) {
throw new UnsupportedOperationException("Not supported to set multi-window"
@@ -672,9 +673,8 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
return effects;
}
final int prevMode = container.getWindowingMode();
container.setWindowingMode(windowingMode);
if (prevMode != container.getWindowingMode()) {
if (prevWindowingMode != container.getWindowingMode()) {
// The activity in the container may become focusable or non-focusable due to
// windowing modes changes (such as entering or leaving pinned windowing mode),
// so also apply the lifecycle effects to this transaction.