Merge "Reland "Keep runtime insets types during layout"" into sc-dev
This commit is contained in:
@@ -106,7 +106,9 @@ public class InsetsState implements Parcelable {
|
|||||||
public static final int ITYPE_NAVIGATION_BAR = 1;
|
public static final int ITYPE_NAVIGATION_BAR = 1;
|
||||||
public static final int ITYPE_CAPTION_BAR = 2;
|
public static final int ITYPE_CAPTION_BAR = 2;
|
||||||
|
|
||||||
public static final int ITYPE_TOP_GESTURES = 3;
|
// The always visible types are visible to all windows regardless of the z-order.
|
||||||
|
public static final int FIRST_ALWAYS_VISIBLE_TYPE = 3;
|
||||||
|
public static final int ITYPE_TOP_GESTURES = FIRST_ALWAYS_VISIBLE_TYPE;
|
||||||
public static final int ITYPE_BOTTOM_GESTURES = 4;
|
public static final int ITYPE_BOTTOM_GESTURES = 4;
|
||||||
public static final int ITYPE_LEFT_GESTURES = 5;
|
public static final int ITYPE_LEFT_GESTURES = 5;
|
||||||
public static final int ITYPE_RIGHT_GESTURES = 6;
|
public static final int ITYPE_RIGHT_GESTURES = 6;
|
||||||
@@ -117,15 +119,16 @@ public class InsetsState implements Parcelable {
|
|||||||
public static final int ITYPE_LEFT_MANDATORY_GESTURES = 9;
|
public static final int ITYPE_LEFT_MANDATORY_GESTURES = 9;
|
||||||
public static final int ITYPE_RIGHT_MANDATORY_GESTURES = 10;
|
public static final int ITYPE_RIGHT_MANDATORY_GESTURES = 10;
|
||||||
|
|
||||||
public static final int ITYPE_LEFT_TAPPABLE_ELEMENT = 11;
|
public static final int ITYPE_LEFT_DISPLAY_CUTOUT = 11;
|
||||||
public static final int ITYPE_TOP_TAPPABLE_ELEMENT = 12;
|
public static final int ITYPE_TOP_DISPLAY_CUTOUT = 12;
|
||||||
public static final int ITYPE_RIGHT_TAPPABLE_ELEMENT = 13;
|
public static final int ITYPE_RIGHT_DISPLAY_CUTOUT = 13;
|
||||||
public static final int ITYPE_BOTTOM_TAPPABLE_ELEMENT = 14;
|
public static final int ITYPE_BOTTOM_DISPLAY_CUTOUT = 14;
|
||||||
|
public static final int LAST_ALWAYS_VISIBLE_TYPE = ITYPE_BOTTOM_DISPLAY_CUTOUT;
|
||||||
|
|
||||||
public static final int ITYPE_LEFT_DISPLAY_CUTOUT = 15;
|
public static final int ITYPE_LEFT_TAPPABLE_ELEMENT = 15;
|
||||||
public static final int ITYPE_TOP_DISPLAY_CUTOUT = 16;
|
public static final int ITYPE_TOP_TAPPABLE_ELEMENT = 16;
|
||||||
public static final int ITYPE_RIGHT_DISPLAY_CUTOUT = 17;
|
public static final int ITYPE_RIGHT_TAPPABLE_ELEMENT = 17;
|
||||||
public static final int ITYPE_BOTTOM_DISPLAY_CUTOUT = 18;
|
public static final int ITYPE_BOTTOM_TAPPABLE_ELEMENT = 18;
|
||||||
|
|
||||||
/** Input method window. */
|
/** Input method window. */
|
||||||
public static final int ITYPE_IME = 19;
|
public static final int ITYPE_IME = 19;
|
||||||
@@ -181,6 +184,18 @@ public class InsetsState implements Parcelable {
|
|||||||
set(copy, copySources);
|
set(copy, copySources);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mirror the always visible sources from the other state. They will share the same object for
|
||||||
|
* the always visible types.
|
||||||
|
*
|
||||||
|
* @param other the state to mirror the mirrored sources from.
|
||||||
|
*/
|
||||||
|
public void mirrorAlwaysVisibleInsetsSources(InsetsState other) {
|
||||||
|
for (int type = FIRST_ALWAYS_VISIBLE_TYPE; type <= LAST_ALWAYS_VISIBLE_TYPE; type++) {
|
||||||
|
mSources[type] = other.mSources[type];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculates {@link WindowInsets} based on the current source configuration.
|
* Calculates {@link WindowInsets} based on the current source configuration.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -670,8 +670,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
// Used in updating override configurations
|
// Used in updating override configurations
|
||||||
private final Configuration mTempConfig = new Configuration();
|
private final Configuration mTempConfig = new Configuration();
|
||||||
|
|
||||||
// Used in performing layout
|
// Used in performing layout, to record the insets provided by other windows above the current
|
||||||
private boolean mTmpWindowsBehindIme;
|
// window.
|
||||||
|
private InsetsState mTmpAboveInsetsState = new InsetsState();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to prevent recursions when calling
|
* Used to prevent recursions when calling
|
||||||
@@ -770,17 +771,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
+ " parentHidden=" + w.isParentWindowHidden());
|
+ " parentHidden=" + w.isParentWindowHidden());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets mBehindIme for each window. Windows behind IME can get IME insets.
|
// Sets mAboveInsets for each window. Windows behind the window providing the insets can
|
||||||
if (w.mBehindIme != mTmpWindowsBehindIme) {
|
// receive the insets.
|
||||||
w.mBehindIme = mTmpWindowsBehindIme;
|
if (!w.mAboveInsetsState.equals(mTmpAboveInsetsState)) {
|
||||||
if (getInsetsStateController().getRawInsetsState().getSourceOrDefaultVisibility(
|
w.mAboveInsetsState.set(mTmpAboveInsetsState);
|
||||||
ITYPE_IME)) {
|
mWinInsetsChanged.add(w);
|
||||||
// If IME is invisible, behind IME or not doesn't make the insets different.
|
|
||||||
mWinInsetsChanged.add(w);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (w == mInputMethodWindow) {
|
|
||||||
mTmpWindowsBehindIme = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this view is GONE, then skip it -- keep the current frame, and let the caller know
|
// If this view is GONE, then skip it -- keep the current frame, and let the caller know
|
||||||
@@ -816,8 +811,16 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
+ " mContainingFrame=" + w.getContainingFrame()
|
+ " mContainingFrame=" + w.getContainingFrame()
|
||||||
+ " mDisplayFrame=" + w.getDisplayFrame());
|
+ " mDisplayFrame=" + w.getDisplayFrame());
|
||||||
}
|
}
|
||||||
|
provideInsetsByWindow(w);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private void provideInsetsByWindow(WindowState w) {
|
||||||
|
for (int i = 0; i < w.mProvidedInsetsSources.size(); i++) {
|
||||||
|
final InsetsSource providedSource = w.mProvidedInsetsSources.valueAt(i);
|
||||||
|
mTmpAboveInsetsState.addSource(providedSource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private final Consumer<WindowState> mPerformLayoutAttached = w -> {
|
private final Consumer<WindowState> mPerformLayoutAttached = w -> {
|
||||||
if (w.mLayoutAttached) {
|
if (w.mLayoutAttached) {
|
||||||
if (DEBUG_LAYOUT) Slog.v(TAG, "2ND PASS " + w + " mHaveFrame=" + w.mHaveFrame
|
if (DEBUG_LAYOUT) Slog.v(TAG, "2ND PASS " + w + " mHaveFrame=" + w.mHaveFrame
|
||||||
@@ -4283,14 +4286,20 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
+ " dh=" + mDisplayInfo.logicalHeight);
|
+ " dh=" + mDisplayInfo.logicalHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used to indicate that we have processed the insets windows. This needs to be after
|
||||||
|
// beginLayoutLw to ensure the raw insets state display related info is initialized.
|
||||||
|
final InsetsState rawInsetsState = getInsetsStateController().getRawInsetsState();
|
||||||
|
mTmpAboveInsetsState = new InsetsState();
|
||||||
|
mTmpAboveInsetsState.setDisplayFrame(rawInsetsState.getDisplayFrame());
|
||||||
|
mTmpAboveInsetsState.setDisplayCutout(rawInsetsState.getDisplayCutout());
|
||||||
|
mTmpAboveInsetsState.mirrorAlwaysVisibleInsetsSources(rawInsetsState);
|
||||||
|
|
||||||
int seq = mLayoutSeq + 1;
|
int seq = mLayoutSeq + 1;
|
||||||
if (seq < 0) seq = 0;
|
if (seq < 0) seq = 0;
|
||||||
mLayoutSeq = seq;
|
mLayoutSeq = seq;
|
||||||
|
|
||||||
mTmpInitial = initial;
|
mTmpInitial = initial;
|
||||||
|
|
||||||
// Used to indicate that we have processed the IME window.
|
|
||||||
mTmpWindowsBehindIme = false;
|
|
||||||
|
|
||||||
// First perform layout of any root windows (not attached to another window).
|
// First perform layout of any root windows (not attached to another window).
|
||||||
forAllWindows(mPerformLayout, true /* traverseTopToBottom */);
|
forAllWindows(mPerformLayout, true /* traverseTopToBottom */);
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ class InsetsSourceProvider {
|
|||||||
// animate-out as new one animates-in.
|
// animate-out as new one animates-in.
|
||||||
mWin.cancelAnimation();
|
mWin.cancelAnimation();
|
||||||
mWin.mPendingPositionChanged = null;
|
mWin.mPendingPositionChanged = null;
|
||||||
|
mWin.mProvidedInsetsSources.remove(mSource.getType());
|
||||||
}
|
}
|
||||||
ProtoLog.d(WM_DEBUG_IME, "InsetsSource setWin %s", win);
|
ProtoLog.d(WM_DEBUG_IME, "InsetsSource setWin %s", win);
|
||||||
mWin = win;
|
mWin = win;
|
||||||
@@ -160,11 +161,14 @@ class InsetsSourceProvider {
|
|||||||
setServerVisible(false);
|
setServerVisible(false);
|
||||||
mSource.setFrame(new Rect());
|
mSource.setFrame(new Rect());
|
||||||
mSource.setVisibleFrame(null);
|
mSource.setVisibleFrame(null);
|
||||||
} else if (mControllable) {
|
} else {
|
||||||
mWin.setControllableInsetProvider(this);
|
mWin.mProvidedInsetsSources.put(mSource.getType(), mSource);
|
||||||
if (mPendingControlTarget != null) {
|
if (mControllable) {
|
||||||
updateControlForTarget(mPendingControlTarget, true /* force */);
|
mWin.setControllableInsetProvider(this);
|
||||||
mPendingControlTarget = null;
|
if (mPendingControlTarget != null) {
|
||||||
|
updateControlForTarget(mPendingControlTarget, true /* force */);
|
||||||
|
mPendingControlTarget = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ class InsetsStateController {
|
|||||||
* visible to the target. e.g., the source which represents the target window itself, and the
|
* visible to the target. e.g., the source which represents the target window itself, and the
|
||||||
* IME source when the target is above IME. We also need to exclude certain types of insets
|
* IME source when the target is above IME. We also need to exclude certain types of insets
|
||||||
* source for client within specific windowing modes.
|
* source for client within specific windowing modes.
|
||||||
|
* This is to get the insets for a window layout on the screen. If the window is not there, use
|
||||||
|
* the {@link #getInsetsForWindowMetrics} to get insets instead.
|
||||||
*
|
*
|
||||||
* @param target The window associate with the perspective.
|
* @param target The window associate with the perspective.
|
||||||
* @return The state stripped of the necessary information.
|
* @return The state stripped of the necessary information.
|
||||||
@@ -117,8 +119,8 @@ class InsetsStateController {
|
|||||||
final @InternalInsetsType int type = provider != null
|
final @InternalInsetsType int type = provider != null
|
||||||
? provider.getSource().getType() : ITYPE_INVALID;
|
? provider.getSource().getType() : ITYPE_INVALID;
|
||||||
return getInsetsForTarget(type, target.getWindowingMode(), target.isAlwaysOnTop(),
|
return getInsetsForTarget(type, target.getWindowingMode(), target.isAlwaysOnTop(),
|
||||||
isAboveIme(target),
|
target.getFrozenInsetsState() != null ? target.getFrozenInsetsState() :
|
||||||
target.getFrozenInsetsState() != null ? target.getFrozenInsetsState() : mState);
|
target.mAboveInsetsState);
|
||||||
}
|
}
|
||||||
|
|
||||||
InsetsState getInsetsForWindowMetrics(@NonNull WindowManager.LayoutParams attrs) {
|
InsetsState getInsetsForWindowMetrics(@NonNull WindowManager.LayoutParams attrs) {
|
||||||
@@ -133,19 +135,7 @@ class InsetsStateController {
|
|||||||
final @WindowingMode int windowingMode = token != null
|
final @WindowingMode int windowingMode = token != null
|
||||||
? token.getWindowingMode() : WINDOWING_MODE_UNDEFINED;
|
? token.getWindowingMode() : WINDOWING_MODE_UNDEFINED;
|
||||||
final boolean alwaysOnTop = token != null && token.isAlwaysOnTop();
|
final boolean alwaysOnTop = token != null && token.isAlwaysOnTop();
|
||||||
return getInsetsForTarget(type, windowingMode, alwaysOnTop, isAboveIme(token), mState);
|
return getInsetsForTarget(type, windowingMode, alwaysOnTop, mState);
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isAboveIme(WindowContainer target) {
|
|
||||||
final WindowState imeWindow = mDisplayContent.mInputMethodWindow;
|
|
||||||
if (target == null || imeWindow == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (target instanceof WindowState) {
|
|
||||||
final WindowState win = (WindowState) target;
|
|
||||||
return win.needsRelativeLayeringToIme() || !win.mBehindIme;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static @InternalInsetsType
|
private static @InternalInsetsType
|
||||||
@@ -181,10 +171,12 @@ class InsetsStateController {
|
|||||||
* @see #getInsetsForWindowMetrics
|
* @see #getInsetsForWindowMetrics
|
||||||
*/
|
*/
|
||||||
private InsetsState getInsetsForTarget(@InternalInsetsType int type,
|
private InsetsState getInsetsForTarget(@InternalInsetsType int type,
|
||||||
@WindowingMode int windowingMode, boolean isAlwaysOnTop, boolean aboveIme,
|
@WindowingMode int windowingMode, boolean isAlwaysOnTop, InsetsState state) {
|
||||||
@NonNull InsetsState state) {
|
boolean stateCopied = false;
|
||||||
|
|
||||||
if (type != ITYPE_INVALID) {
|
if (type != ITYPE_INVALID) {
|
||||||
state = new InsetsState(state);
|
state = new InsetsState(state);
|
||||||
|
stateCopied = true;
|
||||||
state.removeSource(type);
|
state.removeSource(type);
|
||||||
|
|
||||||
// Navigation bar doesn't get influenced by anything else
|
// Navigation bar doesn't get influenced by anything else
|
||||||
@@ -219,23 +211,15 @@ class InsetsStateController {
|
|||||||
|
|
||||||
if (WindowConfiguration.isFloating(windowingMode)
|
if (WindowConfiguration.isFloating(windowingMode)
|
||||||
|| (windowingMode == WINDOWING_MODE_MULTI_WINDOW && isAlwaysOnTop)) {
|
|| (windowingMode == WINDOWING_MODE_MULTI_WINDOW && isAlwaysOnTop)) {
|
||||||
state = new InsetsState(state);
|
if (!stateCopied) {
|
||||||
|
state = new InsetsState(state);
|
||||||
|
stateCopied = true;
|
||||||
|
}
|
||||||
state.removeSource(ITYPE_STATUS_BAR);
|
state.removeSource(ITYPE_STATUS_BAR);
|
||||||
state.removeSource(ITYPE_NAVIGATION_BAR);
|
state.removeSource(ITYPE_NAVIGATION_BAR);
|
||||||
state.removeSource(ITYPE_EXTRA_NAVIGATION_BAR);
|
state.removeSource(ITYPE_EXTRA_NAVIGATION_BAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aboveIme) {
|
|
||||||
InsetsSource imeSource = state.peekSource(ITYPE_IME);
|
|
||||||
if (imeSource != null && imeSource.isVisible()) {
|
|
||||||
imeSource = new InsetsSource(imeSource);
|
|
||||||
imeSource.setVisible(false);
|
|
||||||
imeSource.setFrame(0, 0, 0, 0);
|
|
||||||
state = new InsetsState(state);
|
|
||||||
state.addSource(imeSource);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ import android.os.Trace;
|
|||||||
import android.os.WorkSource;
|
import android.os.WorkSource;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.ArrayMap;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.MergedConfiguration;
|
import android.util.MergedConfiguration;
|
||||||
@@ -647,9 +648,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
boolean mSeamlesslyRotated = false;
|
boolean mSeamlesslyRotated = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if this window is behind IME. Only windows behind IME can get insets from IME.
|
* The insets state of sources provided by windows above the current window.
|
||||||
*/
|
*/
|
||||||
boolean mBehindIme = false;
|
InsetsState mAboveInsetsState = new InsetsState();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The insets sources provided by this window.
|
||||||
|
*/
|
||||||
|
ArrayMap<Integer, InsetsSource> mProvidedInsetsSources = new ArrayMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Surface insets from the previous call to relayout(), used to track
|
* Surface insets from the previous call to relayout(), used to track
|
||||||
|
|||||||
@@ -123,6 +123,15 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
updateDisplayFrames();
|
updateDisplayFrames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addWindowWithRawInsetsState(WindowState win) {
|
||||||
|
addWindow(win);
|
||||||
|
// Without mPerformLayout in display content, the window cannot see any insets. Override the
|
||||||
|
// insets state with the global one.
|
||||||
|
final InsetsState insetsState =
|
||||||
|
win.getDisplayContent().getInsetsStateController().getRawInsetsState();
|
||||||
|
win.mAboveInsetsState = insetsState;
|
||||||
|
}
|
||||||
|
|
||||||
public void setRotation(int rotation, boolean includingWindows) {
|
public void setRotation(int rotation, boolean includingWindows) {
|
||||||
mRotation = rotation;
|
mRotation = rotation;
|
||||||
updateDisplayFrames();
|
updateDisplayFrames();
|
||||||
@@ -272,7 +281,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
@Test
|
@Test
|
||||||
public void layoutWindowLw_fitStatusBars() {
|
public void layoutWindowLw_fitStatusBars() {
|
||||||
mWindow.mAttrs.setFitInsetsTypes(Type.statusBars());
|
mWindow.mAttrs.setFitInsetsTypes(Type.statusBars());
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -283,7 +292,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
@Test
|
@Test
|
||||||
public void layoutWindowLw_fitNavigationBars() {
|
public void layoutWindowLw_fitNavigationBars() {
|
||||||
mWindow.mAttrs.setFitInsetsTypes(Type.navigationBars());
|
mWindow.mAttrs.setFitInsetsTypes(Type.navigationBars());
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -294,7 +303,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
@Test
|
@Test
|
||||||
public void layoutWindowLw_fitAllSides() {
|
public void layoutWindowLw_fitAllSides() {
|
||||||
mWindow.mAttrs.setFitInsetsSides(Side.all());
|
mWindow.mAttrs.setFitInsetsSides(Side.all());
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -305,7 +314,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
@Test
|
@Test
|
||||||
public void layoutWindowLw_fitTopOnly() {
|
public void layoutWindowLw_fitTopOnly() {
|
||||||
mWindow.mAttrs.setFitInsetsSides(Side.TOP);
|
mWindow.mAttrs.setFitInsetsSides(Side.TOP);
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -315,11 +324,12 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void layoutWindowLw_fitInsetsIgnoringVisibility() {
|
public void layoutWindowLw_fitInsetsIgnoringVisibility() {
|
||||||
final InsetsState state = mWindow.getInsetsState();
|
final InsetsState state =
|
||||||
|
mDisplayContent.getInsetsStateController().getRawInsetsState();
|
||||||
state.getSource(InsetsState.ITYPE_STATUS_BAR).setVisible(false);
|
state.getSource(InsetsState.ITYPE_STATUS_BAR).setVisible(false);
|
||||||
state.getSource(InsetsState.ITYPE_NAVIGATION_BAR).setVisible(false);
|
state.getSource(InsetsState.ITYPE_NAVIGATION_BAR).setVisible(false);
|
||||||
mWindow.mAttrs.setFitInsetsIgnoringVisibility(true);
|
mWindow.mAttrs.setFitInsetsIgnoringVisibility(true);
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -329,11 +339,12 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void layoutWindowLw_fitInsetsNotIgnoringVisibility() {
|
public void layoutWindowLw_fitInsetsNotIgnoringVisibility() {
|
||||||
final InsetsState state = mWindow.getInsetsState();
|
final InsetsState state =
|
||||||
|
mDisplayContent.getInsetsStateController().getRawInsetsState();
|
||||||
state.getSource(InsetsState.ITYPE_STATUS_BAR).setVisible(false);
|
state.getSource(InsetsState.ITYPE_STATUS_BAR).setVisible(false);
|
||||||
state.getSource(InsetsState.ITYPE_NAVIGATION_BAR).setVisible(false);
|
state.getSource(InsetsState.ITYPE_NAVIGATION_BAR).setVisible(false);
|
||||||
mWindow.mAttrs.setFitInsetsIgnoringVisibility(false);
|
mWindow.mAttrs.setFitInsetsIgnoringVisibility(false);
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -349,8 +360,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
state.getSource(InsetsState.ITYPE_IME).setFrame(
|
state.getSource(InsetsState.ITYPE_IME).setFrame(
|
||||||
0, DISPLAY_HEIGHT - IME_HEIGHT, DISPLAY_WIDTH, DISPLAY_HEIGHT);
|
0, DISPLAY_HEIGHT - IME_HEIGHT, DISPLAY_WIDTH, DISPLAY_HEIGHT);
|
||||||
mWindow.mAttrs.privateFlags |= PRIVATE_FLAG_INSET_PARENT_FRAME_BY_IME;
|
mWindow.mAttrs.privateFlags |= PRIVATE_FLAG_INSET_PARENT_FRAME_BY_IME;
|
||||||
mWindow.mBehindIme = true;
|
addWindowWithRawInsetsState(mWindow);
|
||||||
addWindow(mWindow);
|
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -364,7 +374,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
|
|
||||||
mWindow.mAttrs.setFitInsetsTypes(Type.displayCutout());
|
mWindow.mAttrs.setFitInsetsTypes(Type.displayCutout());
|
||||||
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -379,7 +389,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
mWindow.mAttrs.flags =
|
mWindow.mAttrs.flags =
|
||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -395,7 +405,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
|
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -411,7 +421,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -427,7 +437,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -442,7 +452,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
mWindow.mAttrs.flags =
|
mWindow.mAttrs.flags =
|
||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -457,11 +467,12 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
mWindow.mAttrs.flags =
|
mWindow.mAttrs.flags =
|
||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
mWindow.getInsetsState().getSource(InsetsState.ITYPE_STATUS_BAR).setVisible(false);
|
mDisplayContent.getInsetsStateController().getRawInsetsState()
|
||||||
|
.getSource(InsetsState.ITYPE_STATUS_BAR).setVisible(false);
|
||||||
final InsetsState requestedState = new InsetsState();
|
final InsetsState requestedState = new InsetsState();
|
||||||
requestedState.getSource(ITYPE_STATUS_BAR).setVisible(false);
|
requestedState.getSource(ITYPE_STATUS_BAR).setVisible(false);
|
||||||
mWindow.updateRequestedVisibility(requestedState);
|
mWindow.updateRequestedVisibility(requestedState);
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -476,12 +487,13 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
mWindow.mAttrs.flags =
|
mWindow.mAttrs.flags =
|
||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
mWindow.getInsetsState().getSource(InsetsState.ITYPE_STATUS_BAR).setVisible(false);
|
mDisplayContent.getInsetsStateController().getRawInsetsState()
|
||||||
|
.getSource(InsetsState.ITYPE_STATUS_BAR).setVisible(false);
|
||||||
final InsetsState requestedState = new InsetsState();
|
final InsetsState requestedState = new InsetsState();
|
||||||
requestedState.getSource(ITYPE_STATUS_BAR).setVisible(false);
|
requestedState.getSource(ITYPE_STATUS_BAR).setVisible(false);
|
||||||
mWindow.updateRequestedVisibility(requestedState);
|
mWindow.updateRequestedVisibility(requestedState);
|
||||||
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -497,7 +509,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
mWindow.mAttrs.flags =
|
mWindow.mAttrs.flags =
|
||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -513,7 +525,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
mWindow.mAttrs.flags =
|
mWindow.mAttrs.flags =
|
||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -529,7 +541,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
mWindow.mAttrs.flags =
|
mWindow.mAttrs.flags =
|
||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -545,7 +557,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
mWindow.mAttrs.type = TYPE_APPLICATION_OVERLAY;
|
mWindow.mAttrs.type = TYPE_APPLICATION_OVERLAY;
|
||||||
mWindow.mAttrs.width = DISPLAY_WIDTH;
|
mWindow.mAttrs.width = DISPLAY_WIDTH;
|
||||||
mWindow.mAttrs.height = DISPLAY_HEIGHT;
|
mWindow.mAttrs.height = DISPLAY_HEIGHT;
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -562,7 +574,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -576,7 +588,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
mWindow.mAttrs.flags =
|
mWindow.mAttrs.flags =
|
||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -592,7 +604,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
|
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -608,7 +620,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -624,7 +636,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
mWindow.mAttrs.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
mDisplayPolicy.layoutWindowLw(mWindow, null, mFrames);
|
||||||
|
|
||||||
@@ -638,7 +650,7 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||||
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
mWindow.mAttrs.setFitInsetsTypes(0 /* types */);
|
||||||
mWindow.mAttrs.softInputMode = SOFT_INPUT_ADJUST_NOTHING;
|
mWindow.mAttrs.softInputMode = SOFT_INPUT_ADJUST_NOTHING;
|
||||||
addWindow(mWindow);
|
addWindowWithRawInsetsState(mWindow);
|
||||||
|
|
||||||
final int forwardedInsetBottom = 50;
|
final int forwardedInsetBottom = 50;
|
||||||
mDisplayPolicy.setForwardedInsets(Insets.of(0, 0, 0, forwardedInsetBottom));
|
mDisplayPolicy.setForwardedInsets(Insets.of(0, 0, 0, forwardedInsetBottom));
|
||||||
@@ -776,9 +788,13 @@ public class DisplayPolicyLayoutTests extends DisplayPolicyTestsBase {
|
|||||||
public void testFixedRotationInsetsSourceFrame() {
|
public void testFixedRotationInsetsSourceFrame() {
|
||||||
doReturn((mDisplayContent.getRotation() + 1) % 4).when(mDisplayContent)
|
doReturn((mDisplayContent.getRotation() + 1) % 4).when(mDisplayContent)
|
||||||
.rotationForActivityInDifferentOrientation(eq(mWindow.mActivityRecord));
|
.rotationForActivityInDifferentOrientation(eq(mWindow.mActivityRecord));
|
||||||
final Rect frame = mWindow.getInsetsState().getSource(ITYPE_STATUS_BAR).getFrame();
|
mWindow.mAboveInsetsState.addSource(mDisplayContent.getInsetsStateController()
|
||||||
|
.getRawInsetsState().peekSource(ITYPE_STATUS_BAR));
|
||||||
|
final Rect frame = mDisplayPolicy.getInsetsPolicy().getInsetsForWindow(mWindow)
|
||||||
|
.getSource(ITYPE_STATUS_BAR).getFrame();
|
||||||
mDisplayContent.rotateInDifferentOrientationIfNeeded(mWindow.mActivityRecord);
|
mDisplayContent.rotateInDifferentOrientationIfNeeded(mWindow.mActivityRecord);
|
||||||
final Rect rotatedFrame = mWindow.getInsetsState().getSource(ITYPE_STATUS_BAR).getFrame();
|
final Rect rotatedFrame = mDisplayPolicy.getInsetsPolicy().getInsetsForWindow(mWindow)
|
||||||
|
.getSource(ITYPE_STATUS_BAR).getFrame();
|
||||||
|
|
||||||
assertEquals(DISPLAY_WIDTH, frame.width());
|
assertEquals(DISPLAY_WIDTH, frame.width());
|
||||||
assertEquals(DISPLAY_HEIGHT, rotatedFrame.width());
|
assertEquals(DISPLAY_HEIGHT, rotatedFrame.width());
|
||||||
|
|||||||
@@ -300,6 +300,7 @@ public class DisplayPolicyTests extends WindowTestsBase {
|
|||||||
displayPolicy.addWindowLw(mNavBarWindow, mNavBarWindow.mAttrs);
|
displayPolicy.addWindowLw(mNavBarWindow, mNavBarWindow.mAttrs);
|
||||||
mNavBarWindow.getControllableInsetProvider().setServerVisible(true);
|
mNavBarWindow.getControllableInsetProvider().setServerVisible(true);
|
||||||
final InsetsState state = mDisplayContent.getInsetsStateController().getRawInsetsState();
|
final InsetsState state = mDisplayContent.getInsetsStateController().getRawInsetsState();
|
||||||
|
mImeWindow.mAboveInsetsState = state;
|
||||||
mDisplayContent.mDisplayFrames = new DisplayFrames(mDisplayContent.getDisplayId(),
|
mDisplayContent.mDisplayFrames = new DisplayFrames(mDisplayContent.getDisplayId(),
|
||||||
state, displayInfo, null /* displayCutout */);
|
state, displayInfo, null /* displayCutout */);
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import static org.mockito.Mockito.verify;
|
|||||||
|
|
||||||
import android.app.StatusBarManager;
|
import android.app.StatusBarManager;
|
||||||
import android.platform.test.annotations.Presubmit;
|
import android.platform.test.annotations.Presubmit;
|
||||||
|
import android.view.InsetsSource;
|
||||||
import android.view.InsetsSourceControl;
|
import android.view.InsetsSourceControl;
|
||||||
import android.view.InsetsState;
|
import android.view.InsetsState;
|
||||||
|
|
||||||
@@ -272,7 +273,6 @@ public class InsetsPolicyTest extends WindowTestsBase {
|
|||||||
final WindowState navBar = addNonFocusableWindow(TYPE_NAVIGATION_BAR, "navBar");
|
final WindowState navBar = addNonFocusableWindow(TYPE_NAVIGATION_BAR, "navBar");
|
||||||
navBar.setHasSurface(true);
|
navBar.setHasSurface(true);
|
||||||
navBar.getControllableInsetProvider().setServerVisible(true);
|
navBar.getControllableInsetProvider().setServerVisible(true);
|
||||||
|
|
||||||
final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy());
|
final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy());
|
||||||
doNothing().when(policy).startAnimation(anyBoolean(), any());
|
doNothing().when(policy).startAnimation(anyBoolean(), any());
|
||||||
|
|
||||||
@@ -337,11 +337,14 @@ public class InsetsPolicyTest extends WindowTestsBase {
|
|||||||
@UseTestDisplay(addWindows = W_ACTIVITY)
|
@UseTestDisplay(addWindows = W_ACTIVITY)
|
||||||
@Test
|
@Test
|
||||||
public void testAbortTransientBars_bothCanBeAborted_appGetsBothRealControls() {
|
public void testAbortTransientBars_bothCanBeAborted_appGetsBothRealControls() {
|
||||||
addNonFocusableWindow(TYPE_STATUS_BAR, "statusBar")
|
final InsetsSource statusBarSource = addNonFocusableWindow(TYPE_STATUS_BAR, "statusBar")
|
||||||
.getControllableInsetProvider().getSource().setVisible(false);
|
.getControllableInsetProvider().getSource();
|
||||||
addNonFocusableWindow(TYPE_NAVIGATION_BAR, "navBar")
|
final InsetsSource navBarSource = addNonFocusableWindow(TYPE_NAVIGATION_BAR, "navBar")
|
||||||
.getControllableInsetProvider().getSource().setVisible(false);
|
.getControllableInsetProvider().getSource();
|
||||||
|
statusBarSource.setVisible(false);
|
||||||
|
navBarSource.setVisible(false);
|
||||||
|
mAppWindow.mAboveInsetsState.addSource(navBarSource);
|
||||||
|
mAppWindow.mAboveInsetsState.addSource(statusBarSource);
|
||||||
final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy());
|
final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy());
|
||||||
doNothing().when(policy).startAnimation(anyBoolean(), any());
|
doNothing().when(policy).startAnimation(anyBoolean(), any());
|
||||||
policy.updateBarControlTarget(mAppWindow);
|
policy.updateBarControlTarget(mAppWindow);
|
||||||
|
|||||||
@@ -58,25 +58,6 @@ import org.junit.runner.RunWith;
|
|||||||
@RunWith(WindowTestRunner.class)
|
@RunWith(WindowTestRunner.class)
|
||||||
public class InsetsStateControllerTest extends WindowTestsBase {
|
public class InsetsStateControllerTest extends WindowTestsBase {
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testStripForDispatch_notOwn() {
|
|
||||||
final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");
|
|
||||||
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
|
||||||
getController().getSourceProvider(ITYPE_STATUS_BAR).setWindow(statusBar, null, null);
|
|
||||||
statusBar.setControllableInsetProvider(getController().getSourceProvider(ITYPE_STATUS_BAR));
|
|
||||||
assertNotNull(getController().getInsetsForWindow(app).peekSource(ITYPE_STATUS_BAR));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testStripForDispatch_own() {
|
|
||||||
final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");
|
|
||||||
mDisplayContent.getInsetsStateController().getSourceProvider(ITYPE_STATUS_BAR)
|
|
||||||
.setWindow(statusBar, null, null);
|
|
||||||
statusBar.setControllableInsetProvider(getController().getSourceProvider(ITYPE_STATUS_BAR));
|
|
||||||
final InsetsState state = getController().getInsetsForWindow(statusBar);
|
|
||||||
assertNull(state.peekSource(ITYPE_STATUS_BAR));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStripForDispatch_navBar() {
|
public void testStripForDispatch_navBar() {
|
||||||
final WindowState navBar = createWindow(null, TYPE_APPLICATION, "navBar");
|
final WindowState navBar = createWindow(null, TYPE_APPLICATION, "navBar");
|
||||||
@@ -142,14 +123,15 @@ public class InsetsStateControllerTest extends WindowTestsBase {
|
|||||||
getController().getSourceProvider(ITYPE_IME).setWindow(mImeWindow, null, null);
|
getController().getSourceProvider(ITYPE_IME).setWindow(mImeWindow, null, null);
|
||||||
|
|
||||||
final WindowState app1 = createWindow(null, TYPE_APPLICATION, "app1");
|
final WindowState app1 = createWindow(null, TYPE_APPLICATION, "app1");
|
||||||
app1.mBehindIme = true;
|
|
||||||
|
|
||||||
final WindowState app2 = createWindow(null, TYPE_APPLICATION, "app2");
|
final WindowState app2 = createWindow(null, TYPE_APPLICATION, "app2");
|
||||||
app2.mBehindIme = false;
|
|
||||||
|
app1.mAboveInsetsState.addSource(getController().getRawInsetsState().getSource(ITYPE_IME));
|
||||||
|
|
||||||
getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true);
|
getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true);
|
||||||
assertFalse(getController().getInsetsForWindow(app2).getSource(ITYPE_IME).isVisible());
|
assertFalse(getController().getInsetsForWindow(app2).getSource(ITYPE_IME)
|
||||||
assertTrue(getController().getInsetsForWindow(app1).getSource(ITYPE_IME).isVisible());
|
.isVisible());
|
||||||
|
assertTrue(getController().getInsetsForWindow(app1).getSource(ITYPE_IME)
|
||||||
|
.isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseTestDisplay(addWindows = W_INPUT_METHOD)
|
@UseTestDisplay(addWindows = W_INPUT_METHOD)
|
||||||
@@ -158,7 +140,8 @@ public class InsetsStateControllerTest extends WindowTestsBase {
|
|||||||
getController().getSourceProvider(ITYPE_IME).setWindow(mImeWindow, null, null);
|
getController().getSourceProvider(ITYPE_IME).setWindow(mImeWindow, null, null);
|
||||||
|
|
||||||
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
||||||
app.mBehindIme = true;
|
app.mAboveInsetsState.getSource(ITYPE_IME).setVisible(true);
|
||||||
|
app.mAboveInsetsState.getSource(ITYPE_IME).setFrame(mImeWindow.getFrame());
|
||||||
|
|
||||||
getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true);
|
getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true);
|
||||||
assertTrue(getController().getInsetsForWindow(app).getSource(ITYPE_IME).isVisible());
|
assertTrue(getController().getInsetsForWindow(app).getSource(ITYPE_IME).isVisible());
|
||||||
@@ -170,10 +153,10 @@ public class InsetsStateControllerTest extends WindowTestsBase {
|
|||||||
getController().getSourceProvider(ITYPE_IME).setWindow(mImeWindow, null, null);
|
getController().getSourceProvider(ITYPE_IME).setWindow(mImeWindow, null, null);
|
||||||
|
|
||||||
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
||||||
app.mBehindIme = false;
|
|
||||||
|
|
||||||
getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true);
|
getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true);
|
||||||
assertFalse(getController().getInsetsForWindow(app).getSource(ITYPE_IME).isVisible());
|
assertFalse(getController().getInsetsForWindow(app).getSource(ITYPE_IME)
|
||||||
|
.isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseTestDisplay(addWindows = W_INPUT_METHOD)
|
@UseTestDisplay(addWindows = W_INPUT_METHOD)
|
||||||
@@ -210,7 +193,8 @@ public class InsetsStateControllerTest extends WindowTestsBase {
|
|||||||
|
|
||||||
// app won't get visible IME insets while above IME even when IME is visible.
|
// app won't get visible IME insets while above IME even when IME is visible.
|
||||||
assertTrue(getController().getRawInsetsState().getSourceOrDefaultVisibility(ITYPE_IME));
|
assertTrue(getController().getRawInsetsState().getSourceOrDefaultVisibility(ITYPE_IME));
|
||||||
assertFalse(getController().getInsetsForWindow(app).getSource(ITYPE_IME).isVisible());
|
assertFalse(getController().getInsetsForWindow(app).getSource(ITYPE_IME)
|
||||||
|
.isVisible());
|
||||||
|
|
||||||
// Reset invocation counter.
|
// Reset invocation counter.
|
||||||
clearInvocations(app);
|
clearInvocations(app);
|
||||||
@@ -219,6 +203,8 @@ public class InsetsStateControllerTest extends WindowTestsBase {
|
|||||||
app.mAttrs.flags &= ~FLAG_NOT_FOCUSABLE;
|
app.mAttrs.flags &= ~FLAG_NOT_FOCUSABLE;
|
||||||
mDisplayContent.computeImeTarget(true);
|
mDisplayContent.computeImeTarget(true);
|
||||||
mDisplayContent.applySurfaceChangesTransaction();
|
mDisplayContent.applySurfaceChangesTransaction();
|
||||||
|
app.mAboveInsetsState.getSource(ITYPE_IME).setVisible(true);
|
||||||
|
app.mAboveInsetsState.getSource(ITYPE_IME).setFrame(mImeWindow.getFrame());
|
||||||
|
|
||||||
// Make sure app got notified.
|
// Make sure app got notified.
|
||||||
verify(app, atLeast(1)).notifyInsetsChanged();
|
verify(app, atLeast(1)).notifyInsetsChanged();
|
||||||
@@ -234,6 +220,8 @@ public class InsetsStateControllerTest extends WindowTestsBase {
|
|||||||
|
|
||||||
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
||||||
final WindowState child = createWindow(app, TYPE_APPLICATION, "child");
|
final WindowState child = createWindow(app, TYPE_APPLICATION, "child");
|
||||||
|
app.mAboveInsetsState.set(getController().getRawInsetsState());
|
||||||
|
child.mAboveInsetsState.set(getController().getRawInsetsState());
|
||||||
child.mAttrs.flags |= FLAG_ALT_FOCUSABLE_IM;
|
child.mAttrs.flags |= FLAG_ALT_FOCUSABLE_IM;
|
||||||
|
|
||||||
mDisplayContent.computeImeTarget(true);
|
mDisplayContent.computeImeTarget(true);
|
||||||
@@ -242,7 +230,8 @@ public class InsetsStateControllerTest extends WindowTestsBase {
|
|||||||
|
|
||||||
getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true);
|
getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true);
|
||||||
assertTrue(getController().getInsetsForWindow(app).getSource(ITYPE_IME).isVisible());
|
assertTrue(getController().getInsetsForWindow(app).getSource(ITYPE_IME).isVisible());
|
||||||
assertFalse(getController().getInsetsForWindow(child).getSource(ITYPE_IME).isVisible());
|
assertFalse(getController().getInsetsForWindow(child).getSource(ITYPE_IME)
|
||||||
|
.isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseTestDisplay(addWindows = W_INPUT_METHOD)
|
@UseTestDisplay(addWindows = W_INPUT_METHOD)
|
||||||
@@ -252,6 +241,7 @@ public class InsetsStateControllerTest extends WindowTestsBase {
|
|||||||
|
|
||||||
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
final WindowState app = createWindow(null, TYPE_APPLICATION, "app");
|
||||||
final WindowState child = createWindow(app, TYPE_APPLICATION, "child");
|
final WindowState child = createWindow(app, TYPE_APPLICATION, "child");
|
||||||
|
app.mAboveInsetsState.addSource(getController().getRawInsetsState().peekSource(ITYPE_IME));
|
||||||
child.mAttrs.flags |= FLAG_NOT_FOCUSABLE;
|
child.mAttrs.flags |= FLAG_NOT_FOCUSABLE;
|
||||||
child.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
|
child.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
|
||||||
|
|
||||||
@@ -261,7 +251,8 @@ public class InsetsStateControllerTest extends WindowTestsBase {
|
|||||||
|
|
||||||
getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true);
|
getController().getRawInsetsState().setSourceVisible(ITYPE_IME, true);
|
||||||
assertTrue(getController().getInsetsForWindow(app).getSource(ITYPE_IME).isVisible());
|
assertTrue(getController().getInsetsForWindow(app).getSource(ITYPE_IME).isVisible());
|
||||||
assertFalse(getController().getInsetsForWindow(child).getSource(ITYPE_IME).isVisible());
|
assertFalse(getController().getInsetsForWindow(child).getSource(ITYPE_IME)
|
||||||
|
.isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ public class WindowFrameTests extends WindowTestsBase {
|
|||||||
imeSource.setFrame(imeFrame);
|
imeSource.setFrame(imeFrame);
|
||||||
imeSource.setVisible(true);
|
imeSource.setVisible(true);
|
||||||
w.updateRequestedVisibility(state);
|
w.updateRequestedVisibility(state);
|
||||||
w.mBehindIme = true;
|
w.mAboveInsetsState.addSource(imeSource);
|
||||||
|
|
||||||
// With no insets or system decor all the frames incoming from PhoneWindowManager
|
// With no insets or system decor all the frames incoming from PhoneWindowManager
|
||||||
// are identical.
|
// are identical.
|
||||||
|
|||||||
Reference in New Issue
Block a user