Merge "Performance optimizations for new insets" into rvc-dev am: 367257cfc4 am: 728adc036c am: de8c2e956a
Change-Id: I487fe2c886e24fb14c5b41bdaca77656d53c8bb4
This commit is contained in:
@@ -318,8 +318,7 @@ interface IWindowSession {
|
|||||||
* Called when the client has changed the local insets state, and now the server should reflect
|
* Called when the client has changed the local insets state, and now the server should reflect
|
||||||
* that new state.
|
* that new state.
|
||||||
*/
|
*/
|
||||||
void insetsModified(IWindow window, in InsetsState state);
|
oneway void insetsModified(IWindow window, in InsetsState state);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the system gesture exclusion has changed.
|
* Called when the system gesture exclusion has changed.
|
||||||
|
|||||||
@@ -258,7 +258,6 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll
|
|||||||
return state.calculateInsets(frame, null /* ignoringVisibilityState */,
|
return state.calculateInsets(frame, null /* ignoringVisibilityState */,
|
||||||
false /* isScreenRound */,
|
false /* isScreenRound */,
|
||||||
false /* alwaysConsumeSystemBars */, null /* displayCutout */,
|
false /* alwaysConsumeSystemBars */, null /* displayCutout */,
|
||||||
null /* legacyContentInsets */, null /* legacyStableInsets */,
|
|
||||||
LayoutParams.SOFT_INPUT_ADJUST_RESIZE /* legacySoftInputMode*/,
|
LayoutParams.SOFT_INPUT_ADJUST_RESIZE /* legacySoftInputMode*/,
|
||||||
0 /* legacySystemUiFlags */, typeSideMap)
|
0 /* legacySystemUiFlags */, typeSideMap)
|
||||||
.getInsets(mTypes);
|
.getInsets(mTypes);
|
||||||
|
|||||||
@@ -363,9 +363,6 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
|||||||
|
|
||||||
private final Runnable mAnimCallback;
|
private final Runnable mAnimCallback;
|
||||||
|
|
||||||
private final Rect mLastLegacyContentInsets = new Rect();
|
|
||||||
private final Rect mLastLegacyStableInsets = new Rect();
|
|
||||||
|
|
||||||
/** Pending control request that is waiting on IME to be ready to be shown */
|
/** Pending control request that is waiting on IME to be ready to be shown */
|
||||||
private PendingControlRequest mPendingImeControlRequest;
|
private PendingControlRequest mPendingImeControlRequest;
|
||||||
|
|
||||||
@@ -435,8 +432,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
|||||||
|
|
||||||
WindowInsets insets = state.calculateInsets(mFrame, mState /* ignoringVisibilityState*/,
|
WindowInsets insets = state.calculateInsets(mFrame, mState /* ignoringVisibilityState*/,
|
||||||
mLastInsets.isRound(), mLastInsets.shouldAlwaysConsumeSystemBars(),
|
mLastInsets.isRound(), mLastInsets.shouldAlwaysConsumeSystemBars(),
|
||||||
mLastDisplayCutout, mLastLegacyContentInsets, mLastLegacyStableInsets,
|
mLastDisplayCutout, mLastLegacySoftInputMode, mLastLegacySystemUiFlags,
|
||||||
mLastLegacySoftInputMode, mLastLegacySystemUiFlags, null /* typeSideMap */);
|
null /* typeSideMap */);
|
||||||
mViewRoot.mView.dispatchWindowInsetsAnimationProgress(insets,
|
mViewRoot.mView.dispatchWindowInsetsAnimationProgress(insets,
|
||||||
mUnmodifiableTmpRunningAnims);
|
mUnmodifiableTmpRunningAnims);
|
||||||
|
|
||||||
@@ -466,13 +463,16 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
|||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public boolean onStateChanged(InsetsState state) {
|
public boolean onStateChanged(InsetsState state) {
|
||||||
if (mState.equals(state) && mLastDispachedState.equals(state)) {
|
boolean localStateChanged = !mState.equals(state);
|
||||||
|
if (!localStateChanged && mLastDispachedState.equals(state)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mState.set(state);
|
mState.set(state);
|
||||||
mLastDispachedState.set(state, true /* copySources */);
|
mLastDispachedState.set(state, true /* copySources */);
|
||||||
applyLocalVisibilityOverride();
|
applyLocalVisibilityOverride();
|
||||||
mViewRoot.notifyInsetsChanged();
|
if (localStateChanged) {
|
||||||
|
mViewRoot.notifyInsetsChanged();
|
||||||
|
}
|
||||||
if (!mState.equals(mLastDispachedState)) {
|
if (!mState.equals(mLastDispachedState)) {
|
||||||
sendStateToWindowManager();
|
sendStateToWindowManager();
|
||||||
}
|
}
|
||||||
@@ -484,26 +484,23 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
|||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public WindowInsets calculateInsets(boolean isScreenRound,
|
public WindowInsets calculateInsets(boolean isScreenRound,
|
||||||
boolean alwaysConsumeSystemBars, DisplayCutout cutout, Rect legacyContentInsets,
|
boolean alwaysConsumeSystemBars, DisplayCutout cutout,
|
||||||
Rect legacyStableInsets, int legacySoftInputMode, int legacySystemUiFlags) {
|
int legacySoftInputMode, int legacySystemUiFlags) {
|
||||||
mLastLegacyContentInsets.set(legacyContentInsets);
|
|
||||||
mLastLegacyStableInsets.set(legacyStableInsets);
|
|
||||||
mLastLegacySoftInputMode = legacySoftInputMode;
|
mLastLegacySoftInputMode = legacySoftInputMode;
|
||||||
mLastLegacySystemUiFlags = legacySystemUiFlags;
|
mLastLegacySystemUiFlags = legacySystemUiFlags;
|
||||||
mLastDisplayCutout = cutout;
|
mLastDisplayCutout = cutout;
|
||||||
mLastInsets = mState.calculateInsets(mFrame, null /* ignoringVisibilityState*/,
|
mLastInsets = mState.calculateInsets(mFrame, null /* ignoringVisibilityState*/,
|
||||||
isScreenRound, alwaysConsumeSystemBars, cutout, legacyContentInsets,
|
isScreenRound, alwaysConsumeSystemBars, cutout,
|
||||||
legacyStableInsets, legacySoftInputMode, legacySystemUiFlags,
|
legacySoftInputMode, legacySystemUiFlags,
|
||||||
null /* typeSideMap */);
|
null /* typeSideMap */);
|
||||||
return mLastInsets;
|
return mLastInsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see InsetsState#calculateVisibleInsets(Rect, Rect, int)
|
* @see InsetsState#calculateVisibleInsets(Rect, int)
|
||||||
*/
|
*/
|
||||||
public Rect calculateVisibleInsets(Rect legacyVisibleInsets,
|
public Rect calculateVisibleInsets(@SoftInputModeFlags int softInputMode) {
|
||||||
@SoftInputModeFlags int softInputMode) {
|
return mState.calculateVisibleInsets(mFrame, softInputMode);
|
||||||
return mState.calculateVisibleInsets(mFrame, legacyVisibleInsets, softInputMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -954,7 +951,6 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Put this on a dispatcher thread.
|
|
||||||
try {
|
try {
|
||||||
mViewRoot.mWindowSession.insetsModified(mViewRoot.mWindow, tmpState);
|
mViewRoot.mWindowSession.insetsModified(mViewRoot.mWindow, tmpState);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
|||||||
@@ -160,7 +160,6 @@ public class InsetsState implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public WindowInsets calculateInsets(Rect frame, @Nullable InsetsState ignoringVisibilityState,
|
public WindowInsets calculateInsets(Rect frame, @Nullable InsetsState ignoringVisibilityState,
|
||||||
boolean isScreenRound, boolean alwaysConsumeSystemBars, DisplayCutout cutout,
|
boolean isScreenRound, boolean alwaysConsumeSystemBars, DisplayCutout cutout,
|
||||||
@Nullable Rect legacyContentInsets, @Nullable Rect legacyStableInsets,
|
|
||||||
int legacySoftInputMode, int legacySystemUiFlags,
|
int legacySoftInputMode, int legacySystemUiFlags,
|
||||||
@Nullable @InternalInsetsSide SparseIntArray typeSideMap) {
|
@Nullable @InternalInsetsSide SparseIntArray typeSideMap) {
|
||||||
Insets[] typeInsetsMap = new Insets[Type.SIZE];
|
Insets[] typeInsetsMap = new Insets[Type.SIZE];
|
||||||
@@ -168,11 +167,6 @@ public class InsetsState implements Parcelable {
|
|||||||
boolean[] typeVisibilityMap = new boolean[SIZE];
|
boolean[] typeVisibilityMap = new boolean[SIZE];
|
||||||
final Rect relativeFrame = new Rect(frame);
|
final Rect relativeFrame = new Rect(frame);
|
||||||
final Rect relativeFrameMax = new Rect(frame);
|
final Rect relativeFrameMax = new Rect(frame);
|
||||||
if (ViewRootImpl.sNewInsetsMode != NEW_INSETS_MODE_FULL
|
|
||||||
&& legacyContentInsets != null && legacyStableInsets != null) {
|
|
||||||
WindowInsets.assignCompatInsets(typeInsetsMap, legacyContentInsets);
|
|
||||||
WindowInsets.assignCompatInsets(typeMaxInsetsMap, legacyStableInsets);
|
|
||||||
}
|
|
||||||
for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
|
for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
|
||||||
InsetsSource source = mSources.get(type);
|
InsetsSource source = mSources.get(type);
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
@@ -217,12 +211,7 @@ public class InsetsState implements Parcelable {
|
|||||||
&& (legacySystemUiFlags & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0);
|
&& (legacySystemUiFlags & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rect calculateVisibleInsets(Rect frame, Rect legacyVisibleInsets,
|
public Rect calculateVisibleInsets(Rect frame, @SoftInputModeFlags int softInputMode) {
|
||||||
@SoftInputModeFlags int softInputMode) {
|
|
||||||
if (sNewInsetsMode == NEW_INSETS_MODE_NONE) {
|
|
||||||
return legacyVisibleInsets;
|
|
||||||
}
|
|
||||||
|
|
||||||
Insets insets = Insets.NONE;
|
Insets insets = Insets.NONE;
|
||||||
for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
|
for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
|
||||||
InsetsSource source = mSources.get(type);
|
InsetsSource source = mSources.get(type);
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ import android.graphics.drawable.GradientDrawable;
|
|||||||
import android.hardware.display.DisplayManagerGlobal;
|
import android.hardware.display.DisplayManagerGlobal;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.os.Build.VERSION_CODES;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
@@ -28745,7 +28746,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
* of the screen decorations, these are the current insets for the
|
* of the screen decorations, these are the current insets for the
|
||||||
* content of the window.
|
* content of the window.
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage(maxTargetSdk = VERSION_CODES.Q,
|
||||||
|
publicAlternatives = "Use {@link WindowInsets#getInsets(int)}")
|
||||||
final Rect mContentInsets = new Rect();
|
final Rect mContentInsets = new Rect();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28753,7 +28755,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
* of the screen decorations, these are the current insets for the
|
* of the screen decorations, these are the current insets for the
|
||||||
* actual visible parts of the window.
|
* actual visible parts of the window.
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage(maxTargetSdk = VERSION_CODES.Q,
|
||||||
|
publicAlternatives = "Use {@link WindowInsets#getInsets(int)}")
|
||||||
final Rect mVisibleInsets = new Rect();
|
final Rect mVisibleInsets = new Rect();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28761,7 +28764,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
* of the screen decorations, these are the current insets for the
|
* of the screen decorations, these are the current insets for the
|
||||||
* stable system windows.
|
* stable system windows.
|
||||||
*/
|
*/
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage(maxTargetSdk = VERSION_CODES.Q,
|
||||||
|
publicAlternatives = "Use {@link WindowInsets#getInsets(int)}")
|
||||||
final Rect mStableInsets = new Rect();
|
final Rect mStableInsets = new Rect();
|
||||||
|
|
||||||
final DisplayCutout.ParcelableWrapper mDisplayCutout =
|
final DisplayCutout.ParcelableWrapper mDisplayCutout =
|
||||||
|
|||||||
@@ -547,13 +547,11 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
boolean mAddedTouchMode;
|
boolean mAddedTouchMode;
|
||||||
|
|
||||||
final Rect mTmpFrame = new Rect();
|
final Rect mTmpFrame = new Rect();
|
||||||
|
final Rect mTmpRect = new Rect();
|
||||||
|
|
||||||
// These are accessed by multiple threads.
|
// These are accessed by multiple threads.
|
||||||
final Rect mWinFrame; // frame given by window manager.
|
final Rect mWinFrame; // frame given by window manager.
|
||||||
|
|
||||||
final Rect mPendingVisibleInsets = new Rect();
|
|
||||||
final Rect mPendingStableInsets = new Rect();
|
|
||||||
final Rect mPendingContentInsets = new Rect();
|
|
||||||
final Rect mPendingBackDropFrame = new Rect();
|
final Rect mPendingBackDropFrame = new Rect();
|
||||||
final DisplayCutout.ParcelableWrapper mPendingDisplayCutout =
|
final DisplayCutout.ParcelableWrapper mPendingDisplayCutout =
|
||||||
new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT);
|
new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT);
|
||||||
@@ -562,10 +560,6 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
final ViewTreeObserver.InternalInsetsInfo mLastGivenInsets
|
final ViewTreeObserver.InternalInsetsInfo mLastGivenInsets
|
||||||
= new ViewTreeObserver.InternalInsetsInfo();
|
= new ViewTreeObserver.InternalInsetsInfo();
|
||||||
|
|
||||||
final Rect mDispatchContentInsets = new Rect();
|
|
||||||
final Rect mDispatchStableInsets = new Rect();
|
|
||||||
DisplayCutout mDispatchDisplayCutout = DisplayCutout.NO_CUTOUT;
|
|
||||||
|
|
||||||
private WindowInsets mLastWindowInsets;
|
private WindowInsets mLastWindowInsets;
|
||||||
|
|
||||||
// Insets types hidden by legacy window flags or system UI flags.
|
// Insets types hidden by legacy window flags or system UI flags.
|
||||||
@@ -1019,10 +1013,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
if (mTranslator != null) {
|
if (mTranslator != null) {
|
||||||
mTranslator.translateRectInScreenToAppWindow(mAttachInfo.mContentInsets);
|
mTranslator.translateRectInScreenToAppWindow(mAttachInfo.mContentInsets);
|
||||||
}
|
}
|
||||||
mPendingContentInsets.set(mAttachInfo.mContentInsets);
|
|
||||||
mPendingStableInsets.set(mAttachInfo.mStableInsets);
|
|
||||||
mPendingDisplayCutout.set(mAttachInfo.mDisplayCutout);
|
mPendingDisplayCutout.set(mAttachInfo.mDisplayCutout);
|
||||||
mPendingVisibleInsets.set(0, 0, 0, 0);
|
|
||||||
mAttachInfo.mAlwaysConsumeSystemBars =
|
mAttachInfo.mAlwaysConsumeSystemBars =
|
||||||
(res & WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS) != 0;
|
(res & WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS) != 0;
|
||||||
mPendingAlwaysConsumeSystemBars = mAttachInfo.mAlwaysConsumeSystemBars;
|
mPendingAlwaysConsumeSystemBars = mAttachInfo.mAlwaysConsumeSystemBars;
|
||||||
@@ -2200,47 +2191,22 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
|
|
||||||
/* package */ WindowInsets getWindowInsets(boolean forceConstruct) {
|
/* package */ WindowInsets getWindowInsets(boolean forceConstruct) {
|
||||||
if (mLastWindowInsets == null || forceConstruct) {
|
if (mLastWindowInsets == null || forceConstruct) {
|
||||||
mDispatchContentInsets.set(mAttachInfo.mContentInsets);
|
|
||||||
mDispatchStableInsets.set(mAttachInfo.mStableInsets);
|
|
||||||
mDispatchDisplayCutout = mAttachInfo.mDisplayCutout.get();
|
|
||||||
|
|
||||||
Rect contentInsets = mDispatchContentInsets;
|
|
||||||
Rect stableInsets = mDispatchStableInsets;
|
|
||||||
DisplayCutout displayCutout = mDispatchDisplayCutout;
|
|
||||||
// For dispatch we preserve old logic, but for direct requests from Views we allow to
|
|
||||||
// immediately use pending insets. This is such that getRootWindowInsets returns the
|
|
||||||
// result from the layout hint before we ran a traversal shortly after adding a window.
|
|
||||||
if (!forceConstruct
|
|
||||||
&& (!mPendingContentInsets.equals(contentInsets) ||
|
|
||||||
!mPendingStableInsets.equals(stableInsets) ||
|
|
||||||
!mPendingDisplayCutout.get().equals(displayCutout))) {
|
|
||||||
contentInsets = mPendingContentInsets;
|
|
||||||
stableInsets = mPendingStableInsets;
|
|
||||||
displayCutout = mPendingDisplayCutout.get();
|
|
||||||
}
|
|
||||||
contentInsets = ensureInsetsNonNegative(contentInsets, "content");
|
|
||||||
stableInsets = ensureInsetsNonNegative(stableInsets, "stable");
|
|
||||||
mLastWindowInsets = mInsetsController.calculateInsets(
|
mLastWindowInsets = mInsetsController.calculateInsets(
|
||||||
mContext.getResources().getConfiguration().isScreenRound(),
|
mContext.getResources().getConfiguration().isScreenRound(),
|
||||||
mAttachInfo.mAlwaysConsumeSystemBars, displayCutout,
|
mAttachInfo.mAlwaysConsumeSystemBars, mPendingDisplayCutout.get(),
|
||||||
contentInsets, stableInsets, mWindowAttributes.softInputMode,
|
mWindowAttributes.softInputMode, (mWindowAttributes.systemUiVisibility
|
||||||
(mWindowAttributes.systemUiVisibility
|
|
||||||
| mWindowAttributes.subtreeSystemUiVisibility));
|
| mWindowAttributes.subtreeSystemUiVisibility));
|
||||||
|
|
||||||
|
Rect visibleInsets = mInsetsController.calculateVisibleInsets(
|
||||||
|
mWindowAttributes.softInputMode);
|
||||||
|
|
||||||
|
mAttachInfo.mVisibleInsets.set(visibleInsets);
|
||||||
|
mAttachInfo.mContentInsets.set(mLastWindowInsets.getSystemWindowInsets().toRect());
|
||||||
|
mAttachInfo.mStableInsets.set(mLastWindowInsets.getStableInsets().toRect());
|
||||||
}
|
}
|
||||||
return mLastWindowInsets;
|
return mLastWindowInsets;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Rect ensureInsetsNonNegative(Rect insets, String kind) {
|
|
||||||
if (insets.left < 0 || insets.top < 0 || insets.right < 0 || insets.bottom < 0) {
|
|
||||||
Log.wtf(mTag, "Negative " + kind + "Insets: " + insets + ", mFirst=" + mFirst);
|
|
||||||
return new Rect(Math.max(0, insets.left),
|
|
||||||
Math.max(0, insets.top),
|
|
||||||
Math.max(0, insets.right),
|
|
||||||
Math.max(0, insets.bottom));
|
|
||||||
}
|
|
||||||
return insets;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dispatchApplyInsets(View host) {
|
public void dispatchApplyInsets(View host) {
|
||||||
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "dispatchApplyInsets");
|
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "dispatchApplyInsets");
|
||||||
mApplyInsetsRequested = false;
|
mApplyInsetsRequested = false;
|
||||||
@@ -2262,12 +2228,6 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
== LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
== LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateVisibleInsets() {
|
|
||||||
Rect visibleInsets = mInsetsController.calculateVisibleInsets(mPendingVisibleInsets,
|
|
||||||
mWindowAttributes.softInputMode);
|
|
||||||
mAttachInfo.mVisibleInsets.set(visibleInsets);
|
|
||||||
}
|
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public InsetsController getInsetsController() {
|
public InsetsController getInsetsController() {
|
||||||
return mInsetsController;
|
return mInsetsController;
|
||||||
@@ -2403,7 +2363,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
// Execute enqueued actions on every traversal in case a detached view enqueued an action
|
// Execute enqueued actions on every traversal in case a detached view enqueued an action
|
||||||
getRunQueue().executeActions(mAttachInfo.mHandler);
|
getRunQueue().executeActions(mAttachInfo.mHandler);
|
||||||
|
|
||||||
boolean insetsChanged = false;
|
boolean cutoutChanged = false;
|
||||||
|
|
||||||
boolean layoutRequested = mLayoutRequested && (!mStopped || mReportNextDraw);
|
boolean layoutRequested = mLayoutRequested && (!mStopped || mReportNextDraw);
|
||||||
if (layoutRequested) {
|
if (layoutRequested) {
|
||||||
@@ -2416,22 +2376,8 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
mAttachInfo.mInTouchMode = !mAddedTouchMode;
|
mAttachInfo.mInTouchMode = !mAddedTouchMode;
|
||||||
ensureTouchModeLocally(mAddedTouchMode);
|
ensureTouchModeLocally(mAddedTouchMode);
|
||||||
} else {
|
} else {
|
||||||
if (!mPendingContentInsets.equals(mAttachInfo.mContentInsets)) {
|
|
||||||
insetsChanged = true;
|
|
||||||
}
|
|
||||||
if (!mPendingStableInsets.equals(mAttachInfo.mStableInsets)) {
|
|
||||||
insetsChanged = true;
|
|
||||||
}
|
|
||||||
if (!mPendingDisplayCutout.equals(mAttachInfo.mDisplayCutout)) {
|
if (!mPendingDisplayCutout.equals(mAttachInfo.mDisplayCutout)) {
|
||||||
insetsChanged = true;
|
cutoutChanged = true;
|
||||||
}
|
|
||||||
if (!mPendingVisibleInsets.equals(mAttachInfo.mVisibleInsets)) {
|
|
||||||
updateVisibleInsets();
|
|
||||||
if (DEBUG_LAYOUT) Log.v(mTag, "Visible insets changing to: "
|
|
||||||
+ mAttachInfo.mVisibleInsets);
|
|
||||||
}
|
|
||||||
if (mPendingAlwaysConsumeSystemBars != mAttachInfo.mAlwaysConsumeSystemBars) {
|
|
||||||
insetsChanged = true;
|
|
||||||
}
|
}
|
||||||
if (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT
|
if (lp.width == ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|| lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
|
|| lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
|
||||||
@@ -2494,7 +2440,6 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mApplyInsetsRequested) {
|
if (mApplyInsetsRequested) {
|
||||||
updateVisibleInsets();
|
|
||||||
dispatchApplyInsets(host);
|
dispatchApplyInsets(host);
|
||||||
if (mLayoutRequested) {
|
if (mLayoutRequested) {
|
||||||
// Short-circuit catching a new layout request here, so
|
// Short-circuit catching a new layout request here, so
|
||||||
@@ -2562,8 +2507,8 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
controlInsetsForCompatibility(params);
|
controlInsetsForCompatibility(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mFirst || windowShouldResize || insetsChanged ||
|
if (mFirst || windowShouldResize || viewVisibilityChanged || cutoutChanged || params != null
|
||||||
viewVisibilityChanged || params != null || mForceNextWindowRelayout) {
|
|| mForceNextWindowRelayout) {
|
||||||
mForceNextWindowRelayout = false;
|
mForceNextWindowRelayout = false;
|
||||||
|
|
||||||
if (isViewVisible) {
|
if (isViewVisible) {
|
||||||
@@ -2585,7 +2530,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean hwInitialized = false;
|
boolean hwInitialized = false;
|
||||||
boolean contentInsetsChanged = false;
|
boolean dispatchApplyInsets = false;
|
||||||
boolean hadSurface = mSurface.isValid();
|
boolean hadSurface = mSurface.isValid();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -2608,9 +2553,6 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
relayoutResult = relayoutWindow(params, viewVisibility, insetsPending);
|
relayoutResult = relayoutWindow(params, viewVisibility, insetsPending);
|
||||||
|
|
||||||
if (DEBUG_LAYOUT) Log.v(mTag, "relayout: frame=" + frame.toShortString()
|
if (DEBUG_LAYOUT) Log.v(mTag, "relayout: frame=" + frame.toShortString()
|
||||||
+ " content=" + mPendingContentInsets.toShortString()
|
|
||||||
+ " visible=" + mPendingVisibleInsets.toShortString()
|
|
||||||
+ " stable=" + mPendingStableInsets.toShortString()
|
|
||||||
+ " cutout=" + mPendingDisplayCutout.get().toString()
|
+ " cutout=" + mPendingDisplayCutout.get().toString()
|
||||||
+ " surface=" + mSurface);
|
+ " surface=" + mSurface);
|
||||||
|
|
||||||
@@ -2627,14 +2569,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
updatedConfiguration = true;
|
updatedConfiguration = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
contentInsetsChanged = !mPendingContentInsets.equals(
|
cutoutChanged = !mPendingDisplayCutout.equals(mAttachInfo.mDisplayCutout);
|
||||||
mAttachInfo.mContentInsets);
|
|
||||||
final boolean visibleInsetsChanged = !mPendingVisibleInsets.equals(
|
|
||||||
mAttachInfo.mVisibleInsets);
|
|
||||||
final boolean stableInsetsChanged = !mPendingStableInsets.equals(
|
|
||||||
mAttachInfo.mStableInsets);
|
|
||||||
final boolean cutoutChanged = !mPendingDisplayCutout.equals(
|
|
||||||
mAttachInfo.mDisplayCutout);
|
|
||||||
surfaceSizeChanged = (relayoutResult
|
surfaceSizeChanged = (relayoutResult
|
||||||
& WindowManagerGlobal.RELAYOUT_RES_SURFACE_RESIZED) != 0;
|
& WindowManagerGlobal.RELAYOUT_RES_SURFACE_RESIZED) != 0;
|
||||||
final boolean alwaysConsumeSystemBarsChanged =
|
final boolean alwaysConsumeSystemBarsChanged =
|
||||||
@@ -2645,42 +2580,25 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
surfaceReplaced = (surfaceGenerationId != mSurface.getGenerationId())
|
surfaceReplaced = (surfaceGenerationId != mSurface.getGenerationId())
|
||||||
&& mSurface.isValid();
|
&& mSurface.isValid();
|
||||||
|
|
||||||
if (contentInsetsChanged) {
|
|
||||||
mAttachInfo.mContentInsets.set(mPendingContentInsets);
|
|
||||||
if (DEBUG_LAYOUT) Log.v(mTag, "Content insets changing to: "
|
|
||||||
+ mAttachInfo.mContentInsets);
|
|
||||||
}
|
|
||||||
if (stableInsetsChanged) {
|
|
||||||
mAttachInfo.mStableInsets.set(mPendingStableInsets);
|
|
||||||
if (DEBUG_LAYOUT) Log.v(mTag, "Decor insets changing to: "
|
|
||||||
+ mAttachInfo.mStableInsets);
|
|
||||||
// Need to relayout with content insets.
|
|
||||||
contentInsetsChanged = true;
|
|
||||||
}
|
|
||||||
if (cutoutChanged) {
|
if (cutoutChanged) {
|
||||||
mAttachInfo.mDisplayCutout.set(mPendingDisplayCutout);
|
mAttachInfo.mDisplayCutout.set(mPendingDisplayCutout);
|
||||||
if (DEBUG_LAYOUT) {
|
if (DEBUG_LAYOUT) {
|
||||||
Log.v(mTag, "DisplayCutout changing to: " + mAttachInfo.mDisplayCutout);
|
Log.v(mTag, "DisplayCutout changing to: " + mAttachInfo.mDisplayCutout);
|
||||||
}
|
}
|
||||||
// Need to relayout with content insets.
|
// Need to relayout with content insets.
|
||||||
contentInsetsChanged = true;
|
dispatchApplyInsets = true;
|
||||||
}
|
}
|
||||||
if (alwaysConsumeSystemBarsChanged) {
|
if (alwaysConsumeSystemBarsChanged) {
|
||||||
mAttachInfo.mAlwaysConsumeSystemBars = mPendingAlwaysConsumeSystemBars;
|
mAttachInfo.mAlwaysConsumeSystemBars = mPendingAlwaysConsumeSystemBars;
|
||||||
contentInsetsChanged = true;
|
dispatchApplyInsets = true;
|
||||||
}
|
}
|
||||||
if (contentInsetsChanged || mLastSystemUiVisibility !=
|
if (dispatchApplyInsets || mLastSystemUiVisibility !=
|
||||||
mAttachInfo.mSystemUiVisibility || mApplyInsetsRequested) {
|
mAttachInfo.mSystemUiVisibility || mApplyInsetsRequested) {
|
||||||
mLastSystemUiVisibility = mAttachInfo.mSystemUiVisibility;
|
mLastSystemUiVisibility = mAttachInfo.mSystemUiVisibility;
|
||||||
dispatchApplyInsets(host);
|
dispatchApplyInsets(host);
|
||||||
// We applied insets so force contentInsetsChanged to ensure the
|
// We applied insets so force contentInsetsChanged to ensure the
|
||||||
// hierarchy is measured below.
|
// hierarchy is measured below.
|
||||||
contentInsetsChanged = true;
|
dispatchApplyInsets = true;
|
||||||
}
|
|
||||||
if (visibleInsetsChanged) {
|
|
||||||
updateVisibleInsets();
|
|
||||||
if (DEBUG_LAYOUT) Log.v(mTag, "Visible insets changing to: "
|
|
||||||
+ mAttachInfo.mVisibleInsets);
|
|
||||||
}
|
}
|
||||||
if (colorModeChanged && mAttachInfo.mThreadedRenderer != null) {
|
if (colorModeChanged && mAttachInfo.mThreadedRenderer != null) {
|
||||||
mAttachInfo.mThreadedRenderer.setWideGamut(
|
mAttachInfo.mThreadedRenderer.setWideGamut(
|
||||||
@@ -2771,7 +2689,8 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
&& mWinFrame.height() == mPendingBackDropFrame.height();
|
&& mWinFrame.height() == mPendingBackDropFrame.height();
|
||||||
// TODO: Need cutout?
|
// TODO: Need cutout?
|
||||||
startDragResizing(mPendingBackDropFrame, !backdropSizeMatchesFrame,
|
startDragResizing(mPendingBackDropFrame, !backdropSizeMatchesFrame,
|
||||||
mPendingVisibleInsets, mPendingStableInsets, mResizeMode);
|
mLastWindowInsets.getSystemWindowInsets().toRect(),
|
||||||
|
mLastWindowInsets.getStableInsets().toRect(), mResizeMode);
|
||||||
} else {
|
} else {
|
||||||
// We shouldn't come here, but if we come we should end the resize.
|
// We shouldn't come here, but if we come we should end the resize.
|
||||||
endDragResizing();
|
endDragResizing();
|
||||||
@@ -2862,7 +2781,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
boolean focusChangedDueToTouchMode = ensureTouchModeLocally(
|
boolean focusChangedDueToTouchMode = ensureTouchModeLocally(
|
||||||
(relayoutResult&WindowManagerGlobal.RELAYOUT_RES_IN_TOUCH_MODE) != 0);
|
(relayoutResult&WindowManagerGlobal.RELAYOUT_RES_IN_TOUCH_MODE) != 0);
|
||||||
if (focusChangedDueToTouchMode || mWidth != host.getMeasuredWidth()
|
if (focusChangedDueToTouchMode || mWidth != host.getMeasuredWidth()
|
||||||
|| mHeight != host.getMeasuredHeight() || contentInsetsChanged ||
|
|| mHeight != host.getMeasuredHeight() || dispatchApplyInsets ||
|
||||||
updatedConfiguration) {
|
updatedConfiguration) {
|
||||||
int childWidthMeasureSpec = getRootMeasureSpec(mWidth, lp.width);
|
int childWidthMeasureSpec = getRootMeasureSpec(mWidth, lp.width);
|
||||||
int childHeightMeasureSpec = getRootMeasureSpec(mHeight, lp.height);
|
int childHeightMeasureSpec = getRootMeasureSpec(mHeight, lp.height);
|
||||||
@@ -2871,7 +2790,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
+ mWidth + " measuredWidth=" + host.getMeasuredWidth()
|
+ mWidth + " measuredWidth=" + host.getMeasuredWidth()
|
||||||
+ " mHeight=" + mHeight
|
+ " mHeight=" + mHeight
|
||||||
+ " measuredHeight=" + host.getMeasuredHeight()
|
+ " measuredHeight=" + host.getMeasuredHeight()
|
||||||
+ " coveredInsetsChanged=" + contentInsetsChanged);
|
+ " dispatchApplyInsets=" + dispatchApplyInsets);
|
||||||
|
|
||||||
// Ask host how big it wants to be
|
// Ask host how big it wants to be
|
||||||
performMeasure(childWidthMeasureSpec, childHeightMeasureSpec);
|
performMeasure(childWidthMeasureSpec, childHeightMeasureSpec);
|
||||||
@@ -4917,12 +4836,9 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
// Recycled in the fall through...
|
// Recycled in the fall through...
|
||||||
SomeArgs args = (SomeArgs) msg.obj;
|
SomeArgs args = (SomeArgs) msg.obj;
|
||||||
if (mWinFrame.equals(args.arg1)
|
if (mWinFrame.equals(args.arg1)
|
||||||
&& mPendingContentInsets.equals(args.arg2)
|
|
||||||
&& mPendingStableInsets.equals(args.arg6)
|
|
||||||
&& mPendingDisplayCutout.get().equals(args.arg9)
|
&& mPendingDisplayCutout.get().equals(args.arg9)
|
||||||
&& mPendingVisibleInsets.equals(args.arg3)
|
|
||||||
&& mPendingBackDropFrame.equals(args.arg8)
|
&& mPendingBackDropFrame.equals(args.arg8)
|
||||||
&& args.arg4 == null
|
&& mLastReportedMergedConfiguration.equals(args.arg4)
|
||||||
&& args.argi1 == 0
|
&& args.argi1 == 0
|
||||||
&& mDisplay.getDisplayId() == args.argi3) {
|
&& mDisplay.getDisplayId() == args.argi3) {
|
||||||
break;
|
break;
|
||||||
@@ -4950,16 +4866,10 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean framesChanged = !mWinFrame.equals(args.arg1)
|
final boolean framesChanged = !mWinFrame.equals(args.arg1)
|
||||||
|| !mPendingContentInsets.equals(args.arg2)
|
|| !mPendingDisplayCutout.get().equals(args.arg9);
|
||||||
|| !mPendingStableInsets.equals(args.arg6)
|
|
||||||
|| !mPendingDisplayCutout.get().equals(args.arg9)
|
|
||||||
|| !mPendingVisibleInsets.equals(args.arg3);
|
|
||||||
|
|
||||||
setFrame((Rect) args.arg1);
|
setFrame((Rect) args.arg1);
|
||||||
mPendingContentInsets.set((Rect) args.arg2);
|
|
||||||
mPendingStableInsets.set((Rect) args.arg6);
|
|
||||||
mPendingDisplayCutout.set((DisplayCutout) args.arg9);
|
mPendingDisplayCutout.set((DisplayCutout) args.arg9);
|
||||||
mPendingVisibleInsets.set((Rect) args.arg3);
|
|
||||||
mPendingBackDropFrame.set((Rect) args.arg8);
|
mPendingBackDropFrame.set((Rect) args.arg8);
|
||||||
mForceNextWindowRelayout = args.argi1 != 0;
|
mForceNextWindowRelayout = args.argi1 != 0;
|
||||||
mPendingAlwaysConsumeSystemBars = args.argi2 != 0;
|
mPendingAlwaysConsumeSystemBars = args.argi2 != 0;
|
||||||
@@ -7413,10 +7323,9 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
(int) (mView.getMeasuredWidth() * appScale + 0.5f),
|
(int) (mView.getMeasuredWidth() * appScale + 0.5f),
|
||||||
(int) (mView.getMeasuredHeight() * appScale + 0.5f), viewVisibility,
|
(int) (mView.getMeasuredHeight() * appScale + 0.5f), viewVisibility,
|
||||||
insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0, frameNumber,
|
insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0, frameNumber,
|
||||||
mTmpFrame, mPendingContentInsets, mPendingVisibleInsets,
|
mTmpFrame, mTmpRect, mTmpRect, mTmpRect, mPendingBackDropFrame,
|
||||||
mPendingStableInsets, mPendingBackDropFrame, mPendingDisplayCutout,
|
mPendingDisplayCutout, mPendingMergedConfiguration, mSurfaceControl, mTempInsets,
|
||||||
mPendingMergedConfiguration, mSurfaceControl, mTempInsets, mSurfaceSize,
|
mSurfaceSize, mBlastSurfaceControl);
|
||||||
mBlastSurfaceControl);
|
|
||||||
if (mSurfaceControl.isValid()) {
|
if (mSurfaceControl.isValid()) {
|
||||||
if (!mUseBLASTAdapter) {
|
if (!mUseBLASTAdapter) {
|
||||||
mSurface.copyFrom(mSurfaceControl);
|
mSurface.copyFrom(mSurfaceControl);
|
||||||
@@ -7437,9 +7346,6 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
|
|
||||||
if (mTranslator != null) {
|
if (mTranslator != null) {
|
||||||
mTranslator.translateRectInScreenToAppWinFrame(mTmpFrame);
|
mTranslator.translateRectInScreenToAppWinFrame(mTmpFrame);
|
||||||
mTranslator.translateRectInScreenToAppWindow(mPendingContentInsets);
|
|
||||||
mTranslator.translateRectInScreenToAppWindow(mPendingVisibleInsets);
|
|
||||||
mTranslator.translateRectInScreenToAppWindow(mPendingStableInsets);
|
|
||||||
}
|
}
|
||||||
setFrame(mTmpFrame);
|
setFrame(mTmpFrame);
|
||||||
mInsetsController.onStateChanged(mTempInsets);
|
mInsetsController.onStateChanged(mTempInsets);
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ public final class WindowManagerImpl implements WindowManager {
|
|||||||
if (ViewRootImpl.sNewInsetsMode == NEW_INSETS_MODE_FULL) {
|
if (ViewRootImpl.sNewInsetsMode == NEW_INSETS_MODE_FULL) {
|
||||||
return insetsState.calculateInsets(bounds, null /* ignoringVisibilityState*/,
|
return insetsState.calculateInsets(bounds, null /* ignoringVisibilityState*/,
|
||||||
isScreenRound, alwaysConsumeSystemBars, displayCutout.get(),
|
isScreenRound, alwaysConsumeSystemBars, displayCutout.get(),
|
||||||
systemWindowInsets, stableInsets, SOFT_INPUT_ADJUST_NOTHING,
|
SOFT_INPUT_ADJUST_NOTHING,
|
||||||
SYSTEM_UI_FLAG_VISIBLE, null /* typeSideMap */);
|
SYSTEM_UI_FLAG_VISIBLE, null /* typeSideMap */);
|
||||||
} else {
|
} else {
|
||||||
return new WindowInsets.Builder()
|
return new WindowInsets.Builder()
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class ImeInsetsSourceConsumerTest {
|
|||||||
false,
|
false,
|
||||||
new DisplayCutout(
|
new DisplayCutout(
|
||||||
Insets.of(10, 10, 10, 10), rect, rect, rect, rect),
|
Insets.of(10, 10, 10, 10), rect, rect, rect, rect),
|
||||||
rect, rect, SOFT_INPUT_ADJUST_RESIZE, 0);
|
SOFT_INPUT_ADJUST_RESIZE, 0);
|
||||||
mImeConsumer = new ImeInsetsSourceConsumer(
|
mImeConsumer = new ImeInsetsSourceConsumer(
|
||||||
new InsetsState(), Transaction::new, mController);
|
new InsetsState(), Transaction::new, mController);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ public class InsetsControllerTest {
|
|||||||
false,
|
false,
|
||||||
new DisplayCutout(
|
new DisplayCutout(
|
||||||
Insets.of(10, 10, 10, 10), rect, rect, rect, rect),
|
Insets.of(10, 10, 10, 10), rect, rect, rect, rect),
|
||||||
rect, rect, SOFT_INPUT_ADJUST_RESIZE, 0);
|
SOFT_INPUT_ADJUST_RESIZE, 0);
|
||||||
mController.onFrameChanged(new Rect(0, 0, 100, 100));
|
mController.onFrameChanged(new Rect(0, 0, 100, 100));
|
||||||
});
|
});
|
||||||
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
|
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_IME).setVisible(true);
|
mState.getSource(ITYPE_IME).setVisible(true);
|
||||||
SparseIntArray typeSideMap = new SparseIntArray();
|
SparseIntArray typeSideMap = new SparseIntArray();
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
false, DisplayCutout.NO_CUTOUT, null, null, SOFT_INPUT_ADJUST_RESIZE, 0, typeSideMap);
|
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, typeSideMap);
|
||||||
assertEquals(Insets.of(0, 100, 0, 100), insets.getSystemWindowInsets());
|
assertEquals(Insets.of(0, 100, 0, 100), insets.getSystemWindowInsets());
|
||||||
assertEquals(Insets.of(0, 100, 0, 100), insets.getInsets(Type.all()));
|
assertEquals(Insets.of(0, 100, 0, 100), insets.getInsets(Type.all()));
|
||||||
assertEquals(ISIDE_TOP, typeSideMap.get(ITYPE_STATUS_BAR));
|
assertEquals(ISIDE_TOP, typeSideMap.get(ITYPE_STATUS_BAR));
|
||||||
@@ -92,7 +92,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_IME).setFrame(new Rect(0, 100, 100, 300));
|
mState.getSource(ITYPE_IME).setFrame(new Rect(0, 100, 100, 300));
|
||||||
mState.getSource(ITYPE_IME).setVisible(true);
|
mState.getSource(ITYPE_IME).setVisible(true);
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
false, DisplayCutout.NO_CUTOUT, null, null, SOFT_INPUT_ADJUST_RESIZE, 0, null);
|
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, null);
|
||||||
assertEquals(100, insets.getStableInsetBottom());
|
assertEquals(100, insets.getStableInsetBottom());
|
||||||
assertEquals(Insets.of(0, 0, 0, 100), insets.getInsetsIgnoringVisibility(Type.systemBars()));
|
assertEquals(Insets.of(0, 0, 0, 100), insets.getInsetsIgnoringVisibility(Type.systemBars()));
|
||||||
assertEquals(Insets.of(0, 0, 0, 200), insets.getSystemWindowInsets());
|
assertEquals(Insets.of(0, 0, 0, 200), insets.getSystemWindowInsets());
|
||||||
@@ -111,7 +111,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_NAVIGATION_BAR).setFrame(new Rect(80, 0, 100, 300));
|
mState.getSource(ITYPE_NAVIGATION_BAR).setFrame(new Rect(80, 0, 100, 300));
|
||||||
mState.getSource(ITYPE_NAVIGATION_BAR).setVisible(true);
|
mState.getSource(ITYPE_NAVIGATION_BAR).setVisible(true);
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
false, DisplayCutout.NO_CUTOUT, null, null, 0, 0, null);
|
false, DisplayCutout.NO_CUTOUT, 0, 0, null);
|
||||||
assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets());
|
assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets());
|
||||||
assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(Type.statusBars()));
|
assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(Type.statusBars()));
|
||||||
assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(Type.navigationBars()));
|
assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(Type.navigationBars()));
|
||||||
@@ -127,7 +127,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_IME).setFrame(new Rect(0, 200, 100, 300));
|
mState.getSource(ITYPE_IME).setFrame(new Rect(0, 200, 100, 300));
|
||||||
mState.getSource(ITYPE_IME).setVisible(true);
|
mState.getSource(ITYPE_IME).setVisible(true);
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
false, DisplayCutout.NO_CUTOUT, null, null, SOFT_INPUT_ADJUST_NOTHING, 0, null);
|
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING, 0, null);
|
||||||
assertEquals(0, insets.getSystemWindowInsetBottom());
|
assertEquals(0, insets.getSystemWindowInsetBottom());
|
||||||
assertEquals(100, insets.getInsets(ime()).bottom);
|
assertEquals(100, insets.getInsets(ime()).bottom);
|
||||||
assertTrue(insets.isVisible(ime()));
|
assertTrue(insets.isVisible(ime()));
|
||||||
@@ -143,11 +143,11 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_IME).setFrame(new Rect(0, 200, 100, 300));
|
mState.getSource(ITYPE_IME).setFrame(new Rect(0, 200, 100, 300));
|
||||||
mState.getSource(ITYPE_IME).setVisible(true);
|
mState.getSource(ITYPE_IME).setVisible(true);
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false,
|
||||||
false, DisplayCutout.NO_CUTOUT, null, null, SOFT_INPUT_ADJUST_NOTHING,
|
false, DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING,
|
||||||
SYSTEM_UI_FLAG_LAYOUT_STABLE, null);
|
SYSTEM_UI_FLAG_LAYOUT_STABLE, null);
|
||||||
assertEquals(100, insets.getSystemWindowInsetTop());
|
assertEquals(100, insets.getSystemWindowInsetTop());
|
||||||
insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false,
|
insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false,
|
||||||
DisplayCutout.NO_CUTOUT, null, null, SOFT_INPUT_ADJUST_NOTHING,
|
DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_NOTHING,
|
||||||
0 /* legacySystemUiFlags */, null);
|
0 /* legacySystemUiFlags */, null);
|
||||||
assertEquals(0, insets.getSystemWindowInsetTop());
|
assertEquals(0, insets.getSystemWindowInsetTop());
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_IME).setVisible(true);
|
mState.getSource(ITYPE_IME).setVisible(true);
|
||||||
mState.removeSource(ITYPE_IME);
|
mState.removeSource(ITYPE_IME);
|
||||||
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false,
|
WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false,
|
||||||
DisplayCutout.NO_CUTOUT, null, null, SOFT_INPUT_ADJUST_RESIZE, 0, null);
|
DisplayCutout.NO_CUTOUT, SOFT_INPUT_ADJUST_RESIZE, 0, null);
|
||||||
assertEquals(0, insets.getSystemWindowInsetBottom());
|
assertEquals(0, insets.getSystemWindowInsetBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_BOTTOM_GESTURES).setFrame(new Rect(0, 100, 100, 300));
|
mState.getSource(ITYPE_BOTTOM_GESTURES).setFrame(new Rect(0, 100, 100, 300));
|
||||||
mState.getSource(ITYPE_BOTTOM_GESTURES).setVisible(true);
|
mState.getSource(ITYPE_BOTTOM_GESTURES).setVisible(true);
|
||||||
Rect visibleInsets = mState.calculateVisibleInsets(
|
Rect visibleInsets = mState.calculateVisibleInsets(
|
||||||
new Rect(0, 0, 100, 300), new Rect(), SOFT_INPUT_ADJUST_PAN);
|
new Rect(0, 0, 100, 300), SOFT_INPUT_ADJUST_PAN);
|
||||||
assertEquals(new Rect(0, 100, 0, 100), visibleInsets);
|
assertEquals(new Rect(0, 100, 0, 100), visibleInsets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,7 +273,7 @@ public class InsetsStateTest {
|
|||||||
mState.getSource(ITYPE_BOTTOM_GESTURES).setFrame(new Rect(0, 100, 100, 300));
|
mState.getSource(ITYPE_BOTTOM_GESTURES).setFrame(new Rect(0, 100, 100, 300));
|
||||||
mState.getSource(ITYPE_BOTTOM_GESTURES).setVisible(true);
|
mState.getSource(ITYPE_BOTTOM_GESTURES).setVisible(true);
|
||||||
Rect visibleInsets = mState.calculateVisibleInsets(
|
Rect visibleInsets = mState.calculateVisibleInsets(
|
||||||
new Rect(0, 0, 100, 300), new Rect(), SOFT_INPUT_ADJUST_NOTHING);
|
new Rect(0, 0, 100, 300), SOFT_INPUT_ADJUST_NOTHING);
|
||||||
assertEquals(new Rect(0, 100, 0, 0), visibleInsets);
|
assertEquals(new Rect(0, 100, 0, 0), visibleInsets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -339,7 +339,6 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
insets = state.calculateInsets(state.getDisplayFrame(),
|
insets = state.calculateInsets(state.getDisplayFrame(),
|
||||||
null /* ignoringVisibilityState */, insets.isRound(),
|
null /* ignoringVisibilityState */, insets.isRound(),
|
||||||
insets.shouldAlwaysConsumeSystemBars(), insets.getDisplayCutout(),
|
insets.shouldAlwaysConsumeSystemBars(), insets.getDisplayCutout(),
|
||||||
null /* legacyContentInsets */, null /* legacyStableInsets */,
|
|
||||||
0 /* legacySystemUiFlags */,
|
0 /* legacySystemUiFlags */,
|
||||||
SOFT_INPUT_ADJUST_NOTHING, null /* typeSideMap */);
|
SOFT_INPUT_ADJUST_NOTHING, null /* typeSideMap */);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user