Merge "Introduce WindowlessWindowLayout" into tm-qpr-dev
This commit is contained in:
@@ -29,8 +29,6 @@ import android.os.Parcelable;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import android.window.WindowTokenClient;
|
||||
import android.view.InsetsState;
|
||||
import android.view.WindowManagerGlobal;
|
||||
import android.view.accessibility.IAccessibilityEmbeddedConnection;
|
||||
|
||||
import java.util.Objects;
|
||||
@@ -280,7 +278,7 @@ public class SurfaceControlViewHost {
|
||||
public SurfaceControlViewHost(@NonNull Context c, @NonNull Display d,
|
||||
@NonNull WindowlessWindowManager wwm, boolean useSfChoreographer) {
|
||||
mWm = wwm;
|
||||
mViewRoot = new ViewRootImpl(c, d, mWm, useSfChoreographer);
|
||||
mViewRoot = new ViewRootImpl(c, d, mWm, new WindowlessWindowLayout(), useSfChoreographer);
|
||||
addConfigCallback(c, d);
|
||||
|
||||
WindowManagerGlobal.getInstance().addWindowlessRoot(mViewRoot);
|
||||
@@ -310,7 +308,7 @@ public class SurfaceControlViewHost {
|
||||
mWm = new WindowlessWindowManager(context.getResources().getConfiguration(),
|
||||
mSurfaceControl, hostToken);
|
||||
|
||||
mViewRoot = new ViewRootImpl(context, display, mWm);
|
||||
mViewRoot = new ViewRootImpl(context, display, mWm, new WindowlessWindowLayout());
|
||||
addConfigCallback(context, display);
|
||||
|
||||
WindowManagerGlobal.getInstance().addWindowlessRoot(mViewRoot);
|
||||
|
||||
@@ -559,7 +559,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
private final Rect mVisRect = new Rect(); // used to retrieve visible rect of focused view.
|
||||
private final Rect mTempRect = new Rect();
|
||||
|
||||
private final WindowLayout mWindowLayout = new WindowLayout();
|
||||
private final WindowLayout mWindowLayout;
|
||||
|
||||
private ViewRootImpl mParentViewRoot;
|
||||
|
||||
@@ -854,18 +854,20 @@ public final class ViewRootImpl implements ViewParent,
|
||||
private String mTag = TAG;
|
||||
|
||||
public ViewRootImpl(Context context, Display display) {
|
||||
this(context, display, WindowManagerGlobal.getWindowSession(),
|
||||
this(context, display, WindowManagerGlobal.getWindowSession(), new WindowLayout(),
|
||||
false /* useSfChoreographer */);
|
||||
}
|
||||
|
||||
public ViewRootImpl(@UiContext Context context, Display display, IWindowSession session) {
|
||||
this(context, display, session, false /* useSfChoreographer */);
|
||||
public ViewRootImpl(@UiContext Context context, Display display, IWindowSession session,
|
||||
WindowLayout windowLayout) {
|
||||
this(context, display, session, windowLayout, false /* useSfChoreographer */);
|
||||
}
|
||||
|
||||
public ViewRootImpl(@UiContext Context context, Display display, IWindowSession session,
|
||||
boolean useSfChoreographer) {
|
||||
WindowLayout windowLayout, boolean useSfChoreographer) {
|
||||
mContext = context;
|
||||
mWindowSession = session;
|
||||
mWindowLayout = windowLayout;
|
||||
mDisplay = display;
|
||||
mBasePackageName = context.getBasePackageName();
|
||||
mThread = Thread.currentThread();
|
||||
|
||||
@@ -386,7 +386,7 @@ public final class WindowManagerGlobal {
|
||||
root = new ViewRootImpl(view.getContext(), display);
|
||||
} else {
|
||||
root = new ViewRootImpl(view.getContext(), display,
|
||||
windowlessSession);
|
||||
windowlessSession, new WindowlessWindowLayout());
|
||||
}
|
||||
|
||||
view.setLayoutParams(wparams);
|
||||
|
||||
39
core/java/android/view/WindowlessWindowLayout.java
Normal file
39
core/java/android/view/WindowlessWindowLayout.java
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.view;
|
||||
|
||||
import android.app.WindowConfiguration.WindowingMode;
|
||||
import android.graphics.Rect;
|
||||
import android.window.ClientWindowFrames;
|
||||
|
||||
/**
|
||||
* Computes window frames for the windowless window.
|
||||
* @hide
|
||||
*/
|
||||
public class WindowlessWindowLayout extends WindowLayout {
|
||||
|
||||
@Override
|
||||
public void computeFrames(WindowManager.LayoutParams attrs, InsetsState state,
|
||||
Rect displayCutoutSafe, Rect windowBounds, @WindowingMode int windowingMode,
|
||||
int requestedWidth, int requestedHeight, InsetsVisibilities requestedVisibilities,
|
||||
Rect attachedWindowFrame, float compatScale, ClientWindowFrames outFrames) {
|
||||
outFrames.frame.set(0, 0, attrs.width, attrs.height);
|
||||
outFrames.displayFrame.set(outFrames.frame);
|
||||
outFrames.parentFrame.set(outFrames.frame);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user