Merge "Send InsetsState to the client via IWindow#resized" into tm-dev
This commit is contained in:
@@ -395,8 +395,9 @@ public abstract class WallpaperService extends Service {
|
||||
final BaseIWindow mWindow = new BaseIWindow() {
|
||||
@Override
|
||||
public void resized(ClientWindowFrames frames, boolean reportDraw,
|
||||
MergedConfiguration mergedConfiguration, boolean forceLayout,
|
||||
boolean alwaysConsumeSystemBars, int displayId, int syncSeqId, int resizeMode) {
|
||||
MergedConfiguration mergedConfiguration, InsetsState insetsState,
|
||||
boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId,
|
||||
int syncSeqId, int resizeMode) {
|
||||
Message msg = mCaller.obtainMessageIO(MSG_WINDOW_RESIZED,
|
||||
reportDraw ? 1 : 0,
|
||||
mergedConfiguration);
|
||||
|
||||
@@ -54,26 +54,14 @@ oneway interface IWindow {
|
||||
void executeCommand(String command, String parameters, in ParcelFileDescriptor descriptor);
|
||||
|
||||
void resized(in ClientWindowFrames frames, boolean reportDraw,
|
||||
in MergedConfiguration newMergedConfiguration,
|
||||
in MergedConfiguration newMergedConfiguration, in InsetsState insetsState,
|
||||
boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId,
|
||||
int syncSeqId, int resizeMode);
|
||||
|
||||
/**
|
||||
* Called when the window insets configuration has changed.
|
||||
*
|
||||
* @param willMove The window frame will be moved soon.
|
||||
* @param willResize The window frame will be resized soon.
|
||||
*/
|
||||
void insetsChanged(in InsetsState insetsState, in boolean willMove, in boolean willResize);
|
||||
|
||||
/**
|
||||
* Called when this window retrieved control over a specified set of insets sources.
|
||||
*
|
||||
* @param willMove The window frame will be moved soon.
|
||||
* @param willResize The window frame will be resized soon.
|
||||
*/
|
||||
void insetsControlChanged(in InsetsState insetsState, in InsetsSourceControl[] activeControls,
|
||||
in boolean willMove, in boolean willResize);
|
||||
void insetsControlChanged(in InsetsState insetsState, in InsetsSourceControl[] activeControls);
|
||||
|
||||
/**
|
||||
* Called when a set of insets source window should be shown by policy.
|
||||
|
||||
@@ -679,9 +679,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|
||||
final Rect mPendingBackDropFrame = new Rect();
|
||||
|
||||
private boolean mWillMove;
|
||||
private boolean mWillResize;
|
||||
|
||||
boolean mPendingAlwaysConsumeSystemBars;
|
||||
private final InsetsState mTempInsets = new InsetsState();
|
||||
private final InsetsSourceControl[] mTempControls = new InsetsSourceControl[SIZE];
|
||||
@@ -1869,10 +1866,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|
||||
void notifyInsetsChanged() {
|
||||
mApplyInsetsRequested = true;
|
||||
if (mWillMove || mWillResize) {
|
||||
// The window frame will be changed soon. The following logic will be executed then.
|
||||
return;
|
||||
}
|
||||
requestLayout();
|
||||
|
||||
// See comment for View.sForceLayoutWhenInsetsChanged
|
||||
@@ -2774,7 +2767,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
// Execute enqueued actions on every traversal in case a detached view enqueued an action
|
||||
getRunQueue().executeActions(mAttachInfo.mHandler);
|
||||
|
||||
if (mApplyInsetsRequested && !(mWillMove || mWillResize)) {
|
||||
if (mApplyInsetsRequested) {
|
||||
dispatchApplyInsets(host);
|
||||
}
|
||||
|
||||
@@ -5322,14 +5315,13 @@ public final class ViewRootImpl implements ViewParent,
|
||||
private static final int MSG_REQUEST_KEYBOARD_SHORTCUTS = 26;
|
||||
private static final int MSG_UPDATE_POINTER_ICON = 27;
|
||||
private static final int MSG_POINTER_CAPTURE_CHANGED = 28;
|
||||
private static final int MSG_INSETS_CHANGED = 30;
|
||||
private static final int MSG_INSETS_CONTROL_CHANGED = 31;
|
||||
private static final int MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED = 32;
|
||||
private static final int MSG_SHOW_INSETS = 34;
|
||||
private static final int MSG_HIDE_INSETS = 35;
|
||||
private static final int MSG_REQUEST_SCROLL_CAPTURE = 36;
|
||||
private static final int MSG_WINDOW_TOUCH_MODE_CHANGED = 37;
|
||||
private static final int MSG_KEEP_CLEAR_RECTS_CHANGED = 38;
|
||||
private static final int MSG_INSETS_CONTROL_CHANGED = 29;
|
||||
private static final int MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED = 30;
|
||||
private static final int MSG_SHOW_INSETS = 31;
|
||||
private static final int MSG_HIDE_INSETS = 32;
|
||||
private static final int MSG_REQUEST_SCROLL_CAPTURE = 33;
|
||||
private static final int MSG_WINDOW_TOUCH_MODE_CHANGED = 34;
|
||||
private static final int MSG_KEEP_CLEAR_RECTS_CHANGED = 35;
|
||||
|
||||
|
||||
final class ViewRootHandler extends Handler {
|
||||
@@ -5384,8 +5376,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
return "MSG_UPDATE_POINTER_ICON";
|
||||
case MSG_POINTER_CAPTURE_CHANGED:
|
||||
return "MSG_POINTER_CAPTURE_CHANGED";
|
||||
case MSG_INSETS_CHANGED:
|
||||
return "MSG_INSETS_CHANGED";
|
||||
case MSG_INSETS_CONTROL_CHANGED:
|
||||
return "MSG_INSETS_CONTROL_CHANGED";
|
||||
case MSG_SYSTEM_GESTURE_EXCLUSION_CHANGED:
|
||||
@@ -5447,25 +5437,14 @@ public final class ViewRootImpl implements ViewParent,
|
||||
break;
|
||||
case MSG_RESIZED:
|
||||
case MSG_RESIZED_REPORT: {
|
||||
mWillMove = false;
|
||||
mWillResize = false;
|
||||
final SomeArgs args = (SomeArgs) msg.obj;
|
||||
mInsetsController.onStateChanged((InsetsState) args.arg3);
|
||||
handleResized(msg.what, args);
|
||||
args.recycle();
|
||||
break;
|
||||
}
|
||||
case MSG_INSETS_CHANGED: {
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
mWillMove = args.argi1 == 1;
|
||||
mWillResize = args.argi2 == 1;
|
||||
mInsetsController.onStateChanged((InsetsState) args.arg1);
|
||||
args.recycle();
|
||||
break;
|
||||
}
|
||||
case MSG_INSETS_CONTROL_CHANGED: {
|
||||
SomeArgs args = (SomeArgs) msg.obj;
|
||||
mWillMove = args.argi1 == 1;
|
||||
mWillResize = args.argi2 == 1;
|
||||
|
||||
// Deliver state change before control change, such that:
|
||||
// a) When gaining control, controller can compare with server state to evaluate
|
||||
@@ -5501,7 +5480,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
break;
|
||||
}
|
||||
case MSG_WINDOW_MOVED:
|
||||
mWillMove = false;
|
||||
if (mAdded) {
|
||||
final int w = mWinFrame.width();
|
||||
final int h = mWinFrame.height();
|
||||
@@ -7967,8 +7945,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
final int requestedWidth = (int) (mView.getMeasuredWidth() * appScale + 0.5f);
|
||||
final int requestedHeight = (int) (mView.getMeasuredHeight() * appScale + 0.5f);
|
||||
|
||||
mWillMove = false;
|
||||
mWillResize = false;
|
||||
int relayoutResult = 0;
|
||||
WindowConfiguration winConfig = getConfiguration().windowConfiguration;
|
||||
if (LOCAL_LAYOUT) {
|
||||
@@ -8513,15 +8489,25 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
||||
private void dispatchResized(ClientWindowFrames frames, boolean reportDraw,
|
||||
MergedConfiguration mergedConfiguration, boolean forceLayout,
|
||||
MergedConfiguration mergedConfiguration, InsetsState insetsState, boolean forceLayout,
|
||||
boolean alwaysConsumeSystemBars, int displayId, int syncSeqId, int resizeMode) {
|
||||
|
||||
Message msg = mHandler.obtainMessage(reportDraw ? MSG_RESIZED_REPORT : MSG_RESIZED);
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
final boolean sameProcessCall = (Binder.getCallingPid() == android.os.Process.myPid());
|
||||
if (sameProcessCall) {
|
||||
insetsState = new InsetsState(insetsState, true /* copySource */);
|
||||
}
|
||||
if (mTranslator != null) {
|
||||
mTranslator.translateInsetsStateInScreenToAppWindow(insetsState);
|
||||
}
|
||||
if (insetsState.getSourceOrDefaultVisibility(ITYPE_IME)) {
|
||||
ImeTracing.getInstance().triggerClientDump("ViewRootImpl#dispatchResized",
|
||||
getInsetsController().getHost().getInputMethodManager(), null /* icProto */);
|
||||
}
|
||||
args.arg1 = sameProcessCall ? new ClientWindowFrames(frames) : frames;
|
||||
args.arg2 = sameProcessCall && mergedConfiguration != null
|
||||
? new MergedConfiguration(mergedConfiguration) : mergedConfiguration;
|
||||
args.arg3 = insetsState;
|
||||
args.argi1 = forceLayout ? 1 : 0;
|
||||
args.argi2 = alwaysConsumeSystemBars ? 1 : 0;
|
||||
args.argi3 = displayId;
|
||||
@@ -8532,27 +8518,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mHandler.sendMessage(msg);
|
||||
}
|
||||
|
||||
private void dispatchInsetsChanged(InsetsState insetsState, boolean willMove,
|
||||
boolean willResize) {
|
||||
if (Binder.getCallingPid() == android.os.Process.myPid()) {
|
||||
insetsState = new InsetsState(insetsState, true /* copySource */);
|
||||
}
|
||||
if (mTranslator != null) {
|
||||
mTranslator.translateInsetsStateInScreenToAppWindow(insetsState);
|
||||
}
|
||||
if (insetsState != null && insetsState.getSourceOrDefaultVisibility(ITYPE_IME)) {
|
||||
ImeTracing.getInstance().triggerClientDump("ViewRootImpl#dispatchInsetsChanged",
|
||||
getInsetsController().getHost().getInputMethodManager(), null /* icProto */);
|
||||
}
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
args.arg1 = insetsState;
|
||||
args.argi1 = willMove ? 1 : 0;
|
||||
args.argi2 = willResize ? 1 : 0;
|
||||
mHandler.obtainMessage(MSG_INSETS_CHANGED, args).sendToTarget();
|
||||
}
|
||||
|
||||
private void dispatchInsetsControlChanged(InsetsState insetsState,
|
||||
InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) {
|
||||
InsetsSourceControl[] activeControls) {
|
||||
if (Binder.getCallingPid() == android.os.Process.myPid()) {
|
||||
insetsState = new InsetsState(insetsState, true /* copySource */);
|
||||
if (activeControls != null) {
|
||||
@@ -8572,8 +8539,6 @@ public final class ViewRootImpl implements ViewParent,
|
||||
SomeArgs args = SomeArgs.obtain();
|
||||
args.arg1 = insetsState;
|
||||
args.arg2 = activeControls;
|
||||
args.argi1 = willMove ? 1 : 0;
|
||||
args.argi2 = willResize ? 1 : 0;
|
||||
mHandler.obtainMessage(MSG_INSETS_CONTROL_CHANGED, args).sendToTarget();
|
||||
}
|
||||
|
||||
@@ -9916,30 +9881,22 @@ public final class ViewRootImpl implements ViewParent,
|
||||
|
||||
@Override
|
||||
public void resized(ClientWindowFrames frames, boolean reportDraw,
|
||||
MergedConfiguration mergedConfiguration, boolean forceLayout,
|
||||
boolean alwaysConsumeSystemBars, int displayId, int syncSeqId, int resizeMode) {
|
||||
MergedConfiguration mergedConfiguration, InsetsState insetsState,
|
||||
boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, int syncSeqId,
|
||||
int resizeMode) {
|
||||
final ViewRootImpl viewAncestor = mViewAncestor.get();
|
||||
if (viewAncestor != null) {
|
||||
viewAncestor.dispatchResized(frames, reportDraw, mergedConfiguration, forceLayout,
|
||||
alwaysConsumeSystemBars, displayId, syncSeqId, resizeMode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) {
|
||||
final ViewRootImpl viewAncestor = mViewAncestor.get();
|
||||
if (viewAncestor != null) {
|
||||
viewAncestor.dispatchInsetsChanged(insetsState, willMove, willResize);
|
||||
viewAncestor.dispatchResized(frames, reportDraw, mergedConfiguration, insetsState,
|
||||
forceLayout, alwaysConsumeSystemBars, displayId, syncSeqId, resizeMode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insetsControlChanged(InsetsState insetsState,
|
||||
InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) {
|
||||
InsetsSourceControl[] activeControls) {
|
||||
final ViewRootImpl viewAncestor = mViewAncestor.get();
|
||||
if (viewAncestor != null) {
|
||||
viewAncestor.dispatchInsetsControlChanged(
|
||||
insetsState, activeControls, willMove, willResize);
|
||||
viewAncestor.dispatchInsetsControlChanged(insetsState, activeControls);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package android.view;
|
||||
|
||||
import static android.view.WindowCallbacks.RESIZE_MODE_INVALID;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.PixelFormat;
|
||||
@@ -82,9 +84,8 @@ public class WindowlessWindowManager implements IWindowSession {
|
||||
private final IBinder mHostInputToken;
|
||||
private final IBinder mFocusGrantToken = new Binder();
|
||||
private InsetsState mInsetsState;
|
||||
|
||||
private int mForceHeight = -1;
|
||||
private int mForceWidth = -1;
|
||||
private final ClientWindowFrames mTmpFrames = new ClientWindowFrames();
|
||||
private final MergedConfiguration mTmpConfig = new MergedConfiguration();
|
||||
|
||||
public WindowlessWindowManager(Configuration c, SurfaceControl rootSurface,
|
||||
IBinder hostInputToken) {
|
||||
@@ -540,7 +541,12 @@ public class WindowlessWindowManager implements IWindowSession {
|
||||
mInsetsState = state;
|
||||
for (State s : mStateForWindow.values()) {
|
||||
try {
|
||||
s.mClient.insetsChanged(state, false, false);
|
||||
mTmpFrames.frame.set(0, 0, s.mParams.width, s.mParams.height);
|
||||
mTmpFrames.displayFrame.set(mTmpFrames.frame);
|
||||
mTmpConfig.setConfiguration(mConfiguration, mConfiguration);
|
||||
s.mClient.resized(mTmpFrames, false /* reportDraw */, mTmpConfig, state,
|
||||
false /* forceLayout */, false /* alwaysConsumeSystemBars */, s.mDisplayId,
|
||||
Integer.MAX_VALUE, RESIZE_MODE_INVALID);
|
||||
} catch (RemoteException e) {
|
||||
// Too bad
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class BaseIWindow extends IWindow.Stub {
|
||||
|
||||
@Override
|
||||
public void resized(ClientWindowFrames frames, boolean reportDraw,
|
||||
MergedConfiguration mergedConfiguration, boolean forceLayout,
|
||||
MergedConfiguration mergedConfiguration, InsetsState insetsState, boolean forceLayout,
|
||||
boolean alwaysConsumeSystemBars, int displayId, int seqId, int resizeMode) {
|
||||
if (reportDraw) {
|
||||
try {
|
||||
@@ -60,13 +60,9 @@ public class BaseIWindow extends IWindow.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insetsControlChanged(InsetsState insetsState,
|
||||
InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) {
|
||||
InsetsSourceControl[] activeControls) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -343,15 +343,13 @@ public class SystemWindows {
|
||||
|
||||
@Override
|
||||
public void resized(ClientWindowFrames frames, boolean reportDraw,
|
||||
MergedConfiguration newMergedConfiguration, boolean forceLayout,
|
||||
boolean alwaysConsumeSystemBars, int displayId, int syncSeqId, int resizeMode) {}
|
||||
|
||||
@Override
|
||||
public void insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) {}
|
||||
MergedConfiguration newMergedConfiguration, InsetsState insetsState,
|
||||
boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, int syncSeqId,
|
||||
int resizeMode) {}
|
||||
|
||||
@Override
|
||||
public void insetsControlChanged(InsetsState insetsState,
|
||||
InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) {}
|
||||
InsetsSourceControl[] activeControls) {}
|
||||
|
||||
@Override
|
||||
public void showInsets(int types, boolean fromIme) {}
|
||||
|
||||
@@ -534,8 +534,9 @@ public class TaskSnapshotWindow {
|
||||
|
||||
@Override
|
||||
public void resized(ClientWindowFrames frames, boolean reportDraw,
|
||||
MergedConfiguration mergedConfiguration, boolean forceLayout,
|
||||
boolean alwaysConsumeSystemBars, int displayId, int seqId, int resizeMode) {
|
||||
MergedConfiguration mergedConfiguration, InsetsState insetsState,
|
||||
boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, int seqId,
|
||||
int resizeMode) {
|
||||
if (mOuter != null) {
|
||||
mOuter.mSplashScreenExecutor.execute(() -> {
|
||||
if (mergedConfiguration != null
|
||||
|
||||
@@ -81,6 +81,8 @@ public class WindowFrames {
|
||||
|
||||
private boolean mContentChanged;
|
||||
|
||||
private boolean mInsetsChanged;
|
||||
|
||||
public void setFrames(Rect parentFrame, Rect displayFrame) {
|
||||
mParentFrame.set(parentFrame);
|
||||
mDisplayFrame.set(displayFrame);
|
||||
@@ -158,6 +160,20 @@ public class WindowFrames {
|
||||
return mContentChanged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether we need to report {@link android.view.InsetsState} to the client.
|
||||
*/
|
||||
void setInsetsChanged(boolean insetsChanged) {
|
||||
mInsetsChanged = insetsChanged;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setInsetsChanged(boolean)
|
||||
*/
|
||||
boolean hasInsetsChanged() {
|
||||
return mInsetsChanged;
|
||||
}
|
||||
|
||||
public void dumpDebug(@NonNull ProtoOutputStream proto, long fieldId) {
|
||||
final long token = proto.start(fieldId);
|
||||
mParentFrame.dumpDebug(proto, PARENT_FRAME);
|
||||
@@ -169,9 +185,10 @@ public class WindowFrames {
|
||||
|
||||
public void dump(PrintWriter pw, String prefix) {
|
||||
pw.println(prefix + "Frames: parent=" + mParentFrame.toShortString(sTmpSB)
|
||||
+ " display=" + mDisplayFrame.toShortString(sTmpSB));
|
||||
pw.println(prefix + "mFrame=" + mFrame.toShortString(sTmpSB)
|
||||
+ " last=" + mLastFrame.toShortString(sTmpSB));
|
||||
+ " display=" + mDisplayFrame.toShortString(sTmpSB)
|
||||
+ " frame=" + mFrame.toShortString(sTmpSB)
|
||||
+ " last=" + mLastFrame.toShortString(sTmpSB)
|
||||
+ " insetsChanged=" + mInsetsChanged);
|
||||
}
|
||||
|
||||
String getInsetsChangedInfo() {
|
||||
|
||||
@@ -709,6 +709,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
// State while inside of layoutAndPlaceSurfacesLocked().
|
||||
boolean mFocusMayChange;
|
||||
|
||||
// Number of windows whose insets state have been changed.
|
||||
int mWindowsInsetsChanged = 0;
|
||||
|
||||
// This is held as long as we have the screen frozen, to give us time to
|
||||
// perform a rotation animation when turning off shows the lock screen which
|
||||
// changes the orientation.
|
||||
@@ -5218,6 +5221,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
public static final int LAYOUT_AND_ASSIGN_WINDOW_LAYERS_IF_NEEDED = 63;
|
||||
public static final int WINDOW_STATE_BLAST_SYNC_TIMEOUT = 64;
|
||||
public static final int REPARENT_TASK_TO_DEFAULT_DISPLAY = 65;
|
||||
public static final int INSETS_CHANGED = 66;
|
||||
|
||||
/**
|
||||
* Used to denote that an integer field in a message will not be used.
|
||||
@@ -5544,6 +5548,17 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
break;
|
||||
}
|
||||
case INSETS_CHANGED: {
|
||||
synchronized (mGlobalLock) {
|
||||
if (mWindowsInsetsChanged > 0) {
|
||||
mWindowsInsetsChanged = 0;
|
||||
// We need to update resizing windows and dispatch the new insets state
|
||||
// to them.
|
||||
mRoot.performSurfacePlacement();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (DEBUG_WINDOW_TRACE) {
|
||||
Slog.v(TAG_WM, "handleMessage: exit");
|
||||
|
||||
@@ -1537,12 +1537,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
* dimensions or insets have changed.
|
||||
*/
|
||||
void updateResizingWindowIfNeeded() {
|
||||
final WindowStateAnimator winAnimator = mWinAnimator;
|
||||
if (!mHasSurface || getDisplayContent().mLayoutSeq != mLayoutSeq || isGoneForLayout()) {
|
||||
final boolean insetsChanged = mWindowFrames.hasInsetsChanged();
|
||||
if ((!mHasSurface || getDisplayContent().mLayoutSeq != mLayoutSeq || isGoneForLayout())
|
||||
&& !insetsChanged) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean didFrameInsetsChange = setReportResizeHints();
|
||||
final WindowStateAnimator winAnimator = mWinAnimator;
|
||||
final boolean didFrameInsetsChange = setReportResizeHints();
|
||||
// The latest configuration will be returned by the out parameter of relayout, so it is
|
||||
// unnecessary to report resize if this window is running relayout.
|
||||
final boolean configChanged = !mInRelayout && !isLastConfigReportedToClient();
|
||||
@@ -1567,6 +1569,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
// already. This because the window is waiting on a finishDrawing from the client.
|
||||
if (didFrameInsetsChange
|
||||
|| configChanged
|
||||
|| insetsChanged
|
||||
|| dragResizingChanged
|
||||
|| mReportOrientationChanged
|
||||
|| shouldSendRedrawForSync()) {
|
||||
@@ -1576,6 +1579,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
this, mWindowFrames.getInsetsChangedInfo(),
|
||||
configChanged, dragResizingChanged, mReportOrientationChanged);
|
||||
|
||||
if (insetsChanged) {
|
||||
mWindowFrames.setInsetsChanged(false);
|
||||
mWmService.mWindowsInsetsChanged--;
|
||||
if (mWmService.mWindowsInsetsChanged == 0) {
|
||||
mWmService.mH.removeMessages(WindowManagerService.H.INSETS_CHANGED);
|
||||
}
|
||||
}
|
||||
|
||||
// If it's a dead window left on screen, and the configuration changed, there is nothing
|
||||
// we can do about it. Remove the window now.
|
||||
if (mActivityRecord != null && mAppDied) {
|
||||
@@ -3962,8 +3973,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
|
||||
try {
|
||||
mClient.resized(mClientWindowFrames, reportDraw, mLastReportedConfiguration,
|
||||
forceRelayout, alwaysConsumeSystemBars, displayId, mSyncSeqId, resizeMode);
|
||||
|
||||
getCompatInsetsState(), forceRelayout, alwaysConsumeSystemBars, displayId,
|
||||
mSyncSeqId, resizeMode);
|
||||
if (drawPending && reportOrientation && mOrientationChanging) {
|
||||
mOrientationChangeRedrawRequestTime = SystemClock.elapsedRealtime();
|
||||
ProtoLog.v(WM_DEBUG_ORIENTATION,
|
||||
@@ -3992,13 +4003,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
*/
|
||||
void notifyInsetsChanged() {
|
||||
ProtoLog.d(WM_DEBUG_WINDOW_INSETS, "notifyInsetsChanged for %s ", this);
|
||||
try {
|
||||
mClient.insetsChanged(getCompatInsetsState(),
|
||||
hasMoved(),
|
||||
mWindowFrames.isFrameSizeChangeReported());
|
||||
} catch (RemoteException e) {
|
||||
Slog.w(TAG, "Failed to deliver inset state change w=" + this, e);
|
||||
}
|
||||
mWindowFrames.setInsetsChanged(true);
|
||||
|
||||
// If the new InsetsState won't be dispatched before releasing WM lock, the following
|
||||
// message will be executed.
|
||||
mWmService.mWindowsInsetsChanged++;
|
||||
mWmService.mH.removeMessages(WindowManagerService.H.INSETS_CHANGED);
|
||||
mWmService.mH.sendEmptyMessage(WindowManagerService.H.INSETS_CHANGED);
|
||||
|
||||
final WindowContainer p = getParent();
|
||||
if (p != null) {
|
||||
p.updateOverlayInsetsState(this);
|
||||
@@ -4015,9 +4027,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
getDisplayContent().getInsetsStateController();
|
||||
try {
|
||||
mClient.insetsControlChanged(getCompatInsetsState(),
|
||||
stateController.getControlsForDispatch(this),
|
||||
hasMoved(),
|
||||
mWindowFrames.isFrameSizeChangeReported());
|
||||
stateController.getControlsForDispatch(this));
|
||||
} catch (RemoteException e) {
|
||||
Slog.w(TAG, "Failed to deliver inset state change to w=" + this, e);
|
||||
}
|
||||
|
||||
@@ -3159,12 +3159,14 @@ public class ActivityRecordTests extends WindowTestsBase {
|
||||
doReturn(true).when(app2).isReadyToDispatchInsetsState();
|
||||
mDisplayContent.setImeLayeringTarget(app2);
|
||||
mDisplayContent.updateImeInputAndControlTarget(app2);
|
||||
mDisplayContent.mWmService.mRoot.performSurfacePlacement();
|
||||
|
||||
// Verify after unfreezing app2's IME insets state, we won't dispatch visible IME insets
|
||||
// to client if the app didn't request IME visible.
|
||||
assertFalse(app2.mActivityRecord.mImeInsetsFrozenUntilStartInput);
|
||||
verify(app2.mClient, atLeastOnce()).insetsChanged(insetsStateCaptor.capture(), anyBoolean(),
|
||||
anyBoolean());
|
||||
verify(app2.mClient, atLeastOnce()).resized(any(), anyBoolean(), any(),
|
||||
insetsStateCaptor.capture(), anyBoolean(), anyBoolean(), anyInt(), anyInt(),
|
||||
anyInt());
|
||||
assertFalse(app2.getInsetsState().getSource(ITYPE_IME).isVisible());
|
||||
}
|
||||
|
||||
|
||||
@@ -43,17 +43,14 @@ public class TestIWindow extends IWindow.Stub {
|
||||
|
||||
@Override
|
||||
public void resized(ClientWindowFrames frames, boolean reportDraw,
|
||||
MergedConfiguration mergedConfig, boolean forceLayout, boolean alwaysConsumeSystemBars,
|
||||
int displayId, int seqId, int resizeMode) throws RemoteException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) {
|
||||
MergedConfiguration mergedConfig, InsetsState insetsState, boolean forceLayout,
|
||||
boolean alwaysConsumeSystemBars, int displayId, int seqId, int resizeMode)
|
||||
throws RemoteException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insetsControlChanged(InsetsState insetsState,
|
||||
InsetsSourceControl[] activeControls, boolean willMove, boolean willResize) {
|
||||
InsetsSourceControl[] activeControls) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -692,8 +692,9 @@ public class WindowStateTests extends WindowTestsBase {
|
||||
try {
|
||||
doThrow(new RemoteException("test")).when(win.mClient).resized(any() /* frames */,
|
||||
anyBoolean() /* reportDraw */, any() /* mergedConfig */,
|
||||
anyBoolean() /* forceLayout */, anyBoolean() /* alwaysConsumeSystemBars */,
|
||||
anyInt() /* displayId */, anyInt() /* seqId */, anyInt() /* resizeMode */);
|
||||
any() /* insetsState */, anyBoolean() /* forceLayout */,
|
||||
anyBoolean() /* alwaysConsumeSystemBars */, anyInt() /* displayId */,
|
||||
anyInt() /* seqId */, anyInt() /* resizeMode */);
|
||||
} catch (RemoteException ignored) {
|
||||
}
|
||||
win.reportResized();
|
||||
|
||||
Reference in New Issue
Block a user