Fix a bug in maximize buttons in legacy captions

The bug was introduced in 939b27cb50 which
effectively removed the bounds resolution for fullscreen tasks.
Therefore we need to remove the bounds manually.

Also hide caption on shell behind the flag. Note we still let WM shell
handle freeform resizing so that we don't have to reintroduce an
exception for freeform windows to WM core.

Bug: 165794636
Test: Maximize buttons in legacy captions work.
Test: Caption in WM shell isn't shown when the feature is disabled and
shown when it's enabled.

Change-Id: I51d15556dabdc6713f31d7515c574dfb0db49b7a
This commit is contained in:
Garfield Tan
2022-06-08 17:10:22 -07:00
parent aef0c2179a
commit 6be9f83cb0
3 changed files with 11 additions and 7 deletions

View File

@@ -106,8 +106,6 @@ public class FreeformTaskListener<T extends AutoCloseable>
taskInfo.taskId);
state.mTaskInfo = taskInfo;
mWindowDecorationViewModel.onTaskInfoChanged(state.mTaskInfo, state.mWindowDecoration);
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TASK_ORG, "Freeform Task Info Changed: #%d",
taskInfo.taskId);
}
@Override

View File

@@ -30,6 +30,7 @@ import android.view.LayoutInflater;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;
import android.view.View;
import android.view.ViewRootImpl;
import android.view.WindowManager;
import android.view.WindowlessWindowManager;
import android.window.WindowContainerTransaction;
@@ -201,12 +202,16 @@ public class WindowDecoration<T extends View & TaskFocusStateConsumer> implement
mViewHost.relayout(lp);
}
outResult.mRootView.setTaskFocusState(mTaskInfo.isFocused);
if (ViewRootImpl.CAPTION_ON_SHELL) {
outResult.mRootView.setTaskFocusState(mTaskInfo.isFocused);
// Caption insets
mCaptionInsetsRect.set(taskBounds);
mCaptionInsetsRect.bottom = mCaptionInsetsRect.top + captionHeight;
wct.addRectInsetsProvider(mTaskInfo.token, mCaptionInsetsRect, CAPTION_INSETS_TYPES);
// Caption insets
mCaptionInsetsRect.set(taskBounds);
mCaptionInsetsRect.bottom = mCaptionInsetsRect.top + captionHeight;
wct.addRectInsetsProvider(mTaskInfo.token, mCaptionInsetsRect, CAPTION_INSETS_TYPES);
} else {
outResult.mRootView.setVisibility(View.GONE);
}
// Task surface itself
Point taskPosition = mTaskInfo.positionInParent;

View File

@@ -949,6 +949,7 @@ class ActivityClientController extends IActivityClientController.Stub {
if (rootTask.inFreeformWindowingMode()) {
rootTask.setWindowingMode(WINDOWING_MODE_FULLSCREEN);
rootTask.setBounds(null);
} else if (!r.supportsFreeform()) {
throw new IllegalStateException(
"This activity is currently not freeform-enabled");