Merge changes Ia7d9514e,I3e9e4f47 into rvc-dev am: 5cc486b1a1 am: f3dfb52c65 am: f6c42e5a96
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11920861 Change-Id: I616a490a859162aca5d3b095d920dc72b0e77a6c
This commit is contained in:
@@ -606,12 +606,14 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
||||
|
||||
private void updateState(InsetsState newState) {
|
||||
mState.setDisplayFrame(newState.getDisplayFrame());
|
||||
for (int i = newState.getSourcesCount() - 1; i >= 0; i--) {
|
||||
InsetsSource source = newState.sourceAt(i);
|
||||
for (int i = 0; i < InsetsState.SIZE; i++) {
|
||||
InsetsSource source = newState.peekSource(i);
|
||||
if (source == null) continue;;
|
||||
getSourceConsumer(source.getType()).updateSource(source);
|
||||
}
|
||||
for (int i = mState.getSourcesCount() - 1; i >= 0; i--) {
|
||||
InsetsSource source = mState.sourceAt(i);
|
||||
for (int i = 0; i < InsetsState.SIZE; i++) {
|
||||
InsetsSource source = mState.peekSource(i);
|
||||
if (source == null) continue;
|
||||
if (newState.peekSource(source.getType()) == null) {
|
||||
mState.removeSource(source.getType());
|
||||
}
|
||||
@@ -707,7 +709,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
|
||||
if (hideTypes[0] != 0) {
|
||||
applyAnimation(hideTypes[0], false /* show */, false /* fromIme */);
|
||||
}
|
||||
if (hasControl && mRequestedState.getSourcesCount() > 0) {
|
||||
if (hasControl && mRequestedState.hasSources()) {
|
||||
// We might have changed our requested visibilities while we don't have the control,
|
||||
// so we need to update our requested state once we have control. Otherwise, our
|
||||
// requested state at the server side might be incorrect.
|
||||
|
||||
@@ -50,6 +50,7 @@ import com.android.internal.annotations.VisibleForTesting;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
@@ -117,6 +118,7 @@ public class InsetsState implements Parcelable {
|
||||
public static final int ITYPE_EXTRA_NAVIGATION_BAR = 15;
|
||||
|
||||
static final int LAST_TYPE = ITYPE_EXTRA_NAVIGATION_BAR;
|
||||
public static final int SIZE = LAST_TYPE + 1;
|
||||
|
||||
// Derived types
|
||||
|
||||
@@ -140,7 +142,7 @@ public class InsetsState implements Parcelable {
|
||||
static final int ISIDE_FLOATING = 4;
|
||||
static final int ISIDE_UNKNOWN = 5;
|
||||
|
||||
private final ArrayMap<Integer, InsetsSource> mSources = new ArrayMap<>();
|
||||
private InsetsSource[] mSources = new InsetsSource[SIZE];
|
||||
|
||||
/**
|
||||
* The frame of the display these sources are relative to.
|
||||
@@ -177,7 +179,7 @@ public class InsetsState implements Parcelable {
|
||||
final Rect relativeFrame = new Rect(frame);
|
||||
final Rect relativeFrameMax = new Rect(frame);
|
||||
for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
|
||||
InsetsSource source = mSources.get(type);
|
||||
InsetsSource source = mSources[type];
|
||||
if (source == null) {
|
||||
int index = indexOf(toPublicType(type));
|
||||
if (typeInsetsMap[index] == null) {
|
||||
@@ -227,7 +229,7 @@ public class InsetsState implements Parcelable {
|
||||
public Rect calculateVisibleInsets(Rect frame, @SoftInputModeFlags int softInputMode) {
|
||||
Insets insets = Insets.NONE;
|
||||
for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
|
||||
InsetsSource source = mSources.get(type);
|
||||
InsetsSource source = mSources[type];
|
||||
if (source == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -256,7 +258,7 @@ public class InsetsState implements Parcelable {
|
||||
public int calculateUncontrollableInsetsFromFrame(Rect frame) {
|
||||
int blocked = 0;
|
||||
for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
|
||||
InsetsSource source = mSources.get(type);
|
||||
InsetsSource source = mSources[type];
|
||||
if (source == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -350,11 +352,26 @@ public class InsetsState implements Parcelable {
|
||||
}
|
||||
|
||||
public InsetsSource getSource(@InternalInsetsType int type) {
|
||||
return mSources.computeIfAbsent(type, InsetsSource::new);
|
||||
InsetsSource source = mSources[type];
|
||||
if (source != null) {
|
||||
return source;
|
||||
}
|
||||
source = new InsetsSource(type);
|
||||
mSources[type] = source;
|
||||
return source;
|
||||
}
|
||||
|
||||
public @Nullable InsetsSource peekSource(@InternalInsetsType int type) {
|
||||
return mSources.get(type);
|
||||
return mSources[type];
|
||||
}
|
||||
|
||||
public boolean hasSources() {
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
if (mSources[i] != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,7 +383,7 @@ public class InsetsState implements Parcelable {
|
||||
* doesn't exist.
|
||||
*/
|
||||
public boolean getSourceOrDefaultVisibility(@InternalInsetsType int type) {
|
||||
final InsetsSource source = mSources.get(type);
|
||||
final InsetsSource source = mSources[type];
|
||||
return source != null ? source.isVisible() : getDefaultVisibility(type);
|
||||
}
|
||||
|
||||
@@ -385,7 +402,7 @@ public class InsetsState implements Parcelable {
|
||||
* @param type The {@link InternalInsetsType} of the source to remove
|
||||
*/
|
||||
public void removeSource(@InternalInsetsType int type) {
|
||||
mSources.remove(type);
|
||||
mSources[type] = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -395,7 +412,7 @@ public class InsetsState implements Parcelable {
|
||||
* @param visible {@code true} for visible
|
||||
*/
|
||||
public void setSourceVisible(@InternalInsetsType int type, boolean visible) {
|
||||
InsetsSource source = mSources.get(type);
|
||||
InsetsSource source = mSources[type];
|
||||
if (source != null) {
|
||||
source.setVisible(visible);
|
||||
}
|
||||
@@ -407,27 +424,21 @@ public class InsetsState implements Parcelable {
|
||||
|
||||
public void set(InsetsState other, boolean copySources) {
|
||||
mDisplayFrame.set(other.mDisplayFrame);
|
||||
mSources.clear();
|
||||
if (copySources) {
|
||||
for (int i = 0; i < other.mSources.size(); i++) {
|
||||
InsetsSource source = other.mSources.valueAt(i);
|
||||
mSources.put(source.getType(), new InsetsSource(source));
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
InsetsSource source = other.mSources[i];
|
||||
if (source == null) continue;
|
||||
mSources[i] = new InsetsSource(source);
|
||||
}
|
||||
} else {
|
||||
mSources.putAll(other.mSources);
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
mSources[i] = other.mSources[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addSource(InsetsSource source) {
|
||||
mSources.put(source.getType(), source);
|
||||
}
|
||||
|
||||
public int getSourcesCount() {
|
||||
return mSources.size();
|
||||
}
|
||||
|
||||
public InsetsSource sourceAt(int index) {
|
||||
return mSources.valueAt(index);
|
||||
mSources[source.getType()] = source;
|
||||
}
|
||||
|
||||
public static @InternalInsetsType ArraySet<Integer> toInternalType(@InsetsType int types) {
|
||||
@@ -508,8 +519,10 @@ public class InsetsState implements Parcelable {
|
||||
|
||||
public void dump(String prefix, PrintWriter pw) {
|
||||
pw.println(prefix + "InsetsState");
|
||||
for (int i = mSources.size() - 1; i >= 0; i--) {
|
||||
mSources.valueAt(i).dump(prefix + " ", pw);
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
InsetsSource source = mSources[i];
|
||||
if (source == null) continue;
|
||||
source.dump(prefix + " ", pw);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -578,26 +591,16 @@ public class InsetsState implements Parcelable {
|
||||
if (!mDisplayFrame.equals(state.mDisplayFrame)) {
|
||||
return false;
|
||||
}
|
||||
int size = mSources.size();
|
||||
int otherSize = state.mSources.size();
|
||||
if (excludingCaptionInsets) {
|
||||
if (mSources.get(ITYPE_CAPTION_BAR) != null) {
|
||||
size--;
|
||||
}
|
||||
if (state.mSources.get(ITYPE_CAPTION_BAR) != null) {
|
||||
otherSize--;
|
||||
}
|
||||
}
|
||||
if (size != otherSize) {
|
||||
return false;
|
||||
}
|
||||
for (int i = mSources.size() - 1; i >= 0; i--) {
|
||||
InsetsSource source = mSources.valueAt(i);
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
if (excludingCaptionInsets) {
|
||||
if (source.getType() == ITYPE_CAPTION_BAR) continue;
|
||||
if (i == ITYPE_CAPTION_BAR) continue;
|
||||
}
|
||||
InsetsSource otherSource = state.mSources.get(source.getType());
|
||||
if (otherSource == null) {
|
||||
InsetsSource source = mSources[i];
|
||||
InsetsSource otherSource = state.mSources[i];
|
||||
if (source == null && otherSource == null) {
|
||||
continue;
|
||||
}
|
||||
if (source != null && otherSource == null || source == null && otherSource != null) {
|
||||
return false;
|
||||
}
|
||||
if (!otherSource.equals(source, excludeInvisibleImeFrames)) {
|
||||
@@ -609,7 +612,7 @@ public class InsetsState implements Parcelable {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(mDisplayFrame, mSources);
|
||||
return Objects.hash(mDisplayFrame, Arrays.hashCode(mSources));
|
||||
}
|
||||
|
||||
public InsetsState(Parcel in) {
|
||||
@@ -624,10 +627,7 @@ public class InsetsState implements Parcelable {
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeParcelable(mDisplayFrame, flags);
|
||||
dest.writeInt(mSources.size());
|
||||
for (int i = 0; i < mSources.size(); i++) {
|
||||
dest.writeParcelable(mSources.valueAt(i), flags);
|
||||
}
|
||||
dest.writeParcelableArray(mSources, 0);
|
||||
}
|
||||
|
||||
public static final @android.annotation.NonNull Creator<InsetsState> CREATOR = new Creator<InsetsState>() {
|
||||
@@ -642,19 +642,15 @@ public class InsetsState implements Parcelable {
|
||||
};
|
||||
|
||||
public void readFromParcel(Parcel in) {
|
||||
mSources.clear();
|
||||
mDisplayFrame.set(in.readParcelable(null /* loader */));
|
||||
final int size = in.readInt();
|
||||
for (int i = 0; i < size; i++) {
|
||||
final InsetsSource source = in.readParcelable(null /* loader */);
|
||||
mSources.put(source.getType(), source);
|
||||
}
|
||||
mSources = in.readParcelableArray(null, InsetsSource.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringJoiner joiner = new StringJoiner(", ");
|
||||
for (InsetsSource source : mSources.values()) {
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
InsetsSource source = mSources[i];
|
||||
if (source != null) {
|
||||
joiner.add(source.toString());
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.os.Trace;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.util.SparseIntArray;
|
||||
@@ -439,7 +440,9 @@ public final class SurfaceControl implements Parcelable {
|
||||
release();
|
||||
}
|
||||
if (nativeObject != 0) {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "closeGuard");
|
||||
mCloseGuard.open("release");
|
||||
Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
|
||||
}
|
||||
mNativeObject = nativeObject;
|
||||
mNativeHandle = mNativeObject != 0 ? nativeGetHandle(nativeObject) : 0;
|
||||
|
||||
@@ -22,6 +22,7 @@ import static android.view.InputDevice.SOURCE_CLASS_NONE;
|
||||
import static android.view.InsetsState.ITYPE_NAVIGATION_BAR;
|
||||
import static android.view.InsetsState.ITYPE_STATUS_BAR;
|
||||
import static android.view.InsetsState.LAST_TYPE;
|
||||
import static android.view.InsetsState.SIZE;
|
||||
import static android.view.View.PFLAG_DRAW_ANIMATION;
|
||||
import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||
import static android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
|
||||
@@ -564,7 +565,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
new DisplayCutout.ParcelableWrapper(DisplayCutout.NO_CUTOUT);
|
||||
boolean mPendingAlwaysConsumeSystemBars;
|
||||
private final InsetsState mTempInsets = new InsetsState();
|
||||
private final InsetsSourceControl[] mTempControls = new InsetsSourceControl[LAST_TYPE + 1];
|
||||
private final InsetsSourceControl[] mTempControls = new InsetsSourceControl[SIZE];
|
||||
final ViewTreeObserver.InternalInsetsInfo mLastGivenInsets
|
||||
= new ViewTreeObserver.InternalInsetsInfo();
|
||||
|
||||
|
||||
@@ -111,15 +111,20 @@ class InsetsPolicy {
|
||||
abortTransient();
|
||||
}
|
||||
mFocusedWin = focusedWin;
|
||||
mStateController.onBarControlTargetChanged(getStatusControlTarget(focusedWin),
|
||||
getFakeStatusControlTarget(focusedWin),
|
||||
getNavControlTarget(focusedWin),
|
||||
getFakeNavControlTarget(focusedWin));
|
||||
boolean forceShowsSystemBarsForWindowingMode = forceShowsSystemBarsForWindowingMode();
|
||||
InsetsControlTarget statusControlTarget = getStatusControlTarget(focusedWin,
|
||||
forceShowsSystemBarsForWindowingMode);
|
||||
InsetsControlTarget navControlTarget = getNavControlTarget(focusedWin,
|
||||
forceShowsSystemBarsForWindowingMode);
|
||||
mStateController.onBarControlTargetChanged(statusControlTarget,
|
||||
getFakeControlTarget(focusedWin, statusControlTarget),
|
||||
navControlTarget,
|
||||
getFakeControlTarget(focusedWin, navControlTarget));
|
||||
if (ViewRootImpl.sNewInsetsMode != ViewRootImpl.NEW_INSETS_MODE_FULL) {
|
||||
return;
|
||||
}
|
||||
mStatusBar.updateVisibility(getStatusControlTarget(focusedWin), ITYPE_STATUS_BAR);
|
||||
mNavBar.updateVisibility(getNavControlTarget(focusedWin), ITYPE_NAVIGATION_BAR);
|
||||
mStatusBar.updateVisibility(statusControlTarget, ITYPE_STATUS_BAR);
|
||||
mNavBar.updateVisibility(navControlTarget, ITYPE_NAVIGATION_BAR);
|
||||
mPolicy.updateHideNavInputEventReceiver();
|
||||
}
|
||||
|
||||
@@ -237,16 +242,13 @@ class InsetsPolicy {
|
||||
updateBarControlTarget(mFocusedWin);
|
||||
}
|
||||
|
||||
private @Nullable InsetsControlTarget getFakeStatusControlTarget(
|
||||
@Nullable WindowState focused) {
|
||||
return getStatusControlTarget(focused) == mDummyControlTarget ? focused : null;
|
||||
private @Nullable InsetsControlTarget getFakeControlTarget(@Nullable WindowState focused,
|
||||
InsetsControlTarget realControlTarget) {
|
||||
return realControlTarget == mDummyControlTarget ? focused : null;
|
||||
}
|
||||
|
||||
private @Nullable InsetsControlTarget getFakeNavControlTarget(@Nullable WindowState focused) {
|
||||
return getNavControlTarget(focused) == mDummyControlTarget ? focused : null;
|
||||
}
|
||||
|
||||
private @Nullable InsetsControlTarget getStatusControlTarget(@Nullable WindowState focusedWin) {
|
||||
private @Nullable InsetsControlTarget getStatusControlTarget(@Nullable WindowState focusedWin,
|
||||
boolean forceShowsSystemBarsForWindowingMode) {
|
||||
if (mShowingTransientTypes.indexOf(ITYPE_STATUS_BAR) != -1) {
|
||||
return mDummyControlTarget;
|
||||
}
|
||||
@@ -254,7 +256,7 @@ class InsetsPolicy {
|
||||
// Notification shade has control anyways, no reason to force anything.
|
||||
return focusedWin;
|
||||
}
|
||||
if (forceShowsSystemBarsForWindowingMode()) {
|
||||
if (forceShowsSystemBarsForWindowingMode) {
|
||||
// Status bar is forcibly shown for the windowing mode which is a steady state.
|
||||
// We don't want the client to control the status bar, and we will dispatch the real
|
||||
// visibility of status bar to the client.
|
||||
@@ -274,7 +276,8 @@ class InsetsPolicy {
|
||||
return focusedWin;
|
||||
}
|
||||
|
||||
private @Nullable InsetsControlTarget getNavControlTarget(@Nullable WindowState focusedWin) {
|
||||
private @Nullable InsetsControlTarget getNavControlTarget(@Nullable WindowState focusedWin,
|
||||
boolean forceShowsSystemBarsForWindowingMode) {
|
||||
if (mShowingTransientTypes.indexOf(ITYPE_NAVIGATION_BAR) != -1) {
|
||||
return mDummyControlTarget;
|
||||
}
|
||||
@@ -282,7 +285,7 @@ class InsetsPolicy {
|
||||
// Notification shade has control anyways, no reason to force anything.
|
||||
return focusedWin;
|
||||
}
|
||||
if (forceShowsSystemBarsForWindowingMode()) {
|
||||
if (forceShowsSystemBarsForWindowingMode) {
|
||||
// Navigation bar is forcibly shown for the windowing mode which is a steady state.
|
||||
// We don't want the client to control the navigation bar, and we will dispatch the real
|
||||
// visibility of navigation bar to the client.
|
||||
|
||||
@@ -254,8 +254,9 @@ class InsetsStateController {
|
||||
|
||||
void onInsetsModified(InsetsControlTarget windowState, InsetsState state) {
|
||||
boolean changed = false;
|
||||
for (int i = state.getSourcesCount() - 1; i >= 0; i--) {
|
||||
final InsetsSource source = state.sourceAt(i);
|
||||
for (int i = 0; i < InsetsState.SIZE; i++) {
|
||||
final InsetsSource source = state.peekSource(i);
|
||||
if (source == null) continue;
|
||||
final InsetsSourceProvider provider = mProviders.get(source.getType());
|
||||
if (provider == null) {
|
||||
continue;
|
||||
|
||||
@@ -179,6 +179,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
||||
* Applied as part of the animation pass in "prepareSurfaces".
|
||||
*/
|
||||
protected final SurfaceAnimator mSurfaceAnimator;
|
||||
private boolean mAnyParentAnimating;
|
||||
|
||||
final SurfaceFreezer mSurfaceFreezer;
|
||||
protected final WindowManagerService mWmService;
|
||||
|
||||
@@ -2460,21 +2462,16 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
||||
*/
|
||||
@Nullable
|
||||
WindowContainer getAnimatingContainer(int flags, int typesToCheck) {
|
||||
int animationType = mSurfaceAnimator.getAnimationType();
|
||||
if (mSurfaceAnimator.isAnimating() && (animationType & typesToCheck) > 0) {
|
||||
return this;
|
||||
}
|
||||
if ((flags & TRANSITION) != 0 && isWaitingForTransitionStart()) {
|
||||
if (isSelfAnimating(flags, typesToCheck)) {
|
||||
return this;
|
||||
}
|
||||
if ((flags & PARENTS) != 0) {
|
||||
final WindowContainer parent = getParent();
|
||||
if (parent != null) {
|
||||
final WindowContainer wc = parent.getAnimatingContainer(
|
||||
flags & ~CHILDREN, typesToCheck);
|
||||
if (wc != null) {
|
||||
return wc;
|
||||
WindowContainer parent = getParent();
|
||||
while (parent != null) {
|
||||
if (parent.isSelfAnimating(flags, typesToCheck)) {
|
||||
return parent;
|
||||
}
|
||||
parent = parent.getParent();
|
||||
}
|
||||
}
|
||||
if ((flags & CHILDREN) != 0) {
|
||||
@@ -2489,6 +2486,21 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal method only to be used during {@link #getAnimatingContainer(int, int)}.DO NOT CALL
|
||||
* FROM OUTSIDE.
|
||||
*/
|
||||
protected boolean isSelfAnimating(int flags, int typesToCheck) {
|
||||
if (mSurfaceAnimator.isAnimating()
|
||||
&& (mSurfaceAnimator.getAnimationType() & typesToCheck) > 0) {
|
||||
return true;
|
||||
}
|
||||
if ((flags & TRANSITION) != 0 && isWaitingForTransitionStart()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getAnimatingContainer(int, int)} instead.
|
||||
*/
|
||||
|
||||
@@ -2866,15 +2866,13 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
aspectRatio);
|
||||
}
|
||||
|
||||
public void getStackBounds(int windowingMode, int activityType, Rect bounds) {
|
||||
synchronized (mGlobalLock) {
|
||||
final ActivityStack stack = mRoot.getStack(windowingMode, activityType);
|
||||
if (stack != null) {
|
||||
stack.getBounds(bounds);
|
||||
return;
|
||||
}
|
||||
bounds.setEmpty();
|
||||
void getStackBounds(int windowingMode, int activityType, Rect bounds) {
|
||||
final ActivityStack stack = mRoot.getStack(windowingMode, activityType);
|
||||
if (stack != null) {
|
||||
stack.getBounds(bounds);
|
||||
return;
|
||||
}
|
||||
bounds.setEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -706,6 +706,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
|
||||
static final int BLAST_TIMEOUT_DURATION = 5000; /* milliseconds */
|
||||
|
||||
private final WindowProcessController mWpcForDisplayConfigChanges;
|
||||
|
||||
/**
|
||||
* @return The insets state as requested by the client, i.e. the dispatched insets state
|
||||
* for which the visibilities are overridden with what the client requested.
|
||||
@@ -720,8 +722,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
void updateRequestedInsetsState(InsetsState state) {
|
||||
|
||||
// Only update the sources the client is actually controlling.
|
||||
for (int i = state.getSourcesCount() - 1; i >= 0; i--) {
|
||||
final InsetsSource source = state.sourceAt(i);
|
||||
for (int i = 0; i < InsetsState.SIZE; i++) {
|
||||
final InsetsSource source = state.peekSource(i);
|
||||
if (source == null) continue;
|
||||
mRequestedInsetsState.addSource(source);
|
||||
}
|
||||
}
|
||||
@@ -873,6 +876,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
mSubLayer = 0;
|
||||
mInputWindowHandle = null;
|
||||
mWinAnimator = null;
|
||||
mWpcForDisplayConfigChanges = null;
|
||||
return;
|
||||
}
|
||||
mDeathRecipient = deathRecipient;
|
||||
@@ -928,6 +932,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
ProtoLog.v(WM_DEBUG_ADD_REMOVE, "Adding %s to %s", this, parentWindow);
|
||||
parentWindow.addChild(this, sWindowSubLayerComparator);
|
||||
}
|
||||
|
||||
// System process or invalid process cannot register to display config change.
|
||||
mWpcForDisplayConfigChanges = (s.mPid == MY_PID || s.mPid < 0)
|
||||
? null
|
||||
: service.mAtmService.getProcessController(s.mPid, s.mUid);
|
||||
}
|
||||
|
||||
void attach() {
|
||||
@@ -3514,13 +3523,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
/** @return {@code true} if the process registered to a display as a config listener. */
|
||||
private boolean registeredForDisplayConfigChanges() {
|
||||
final WindowState parentWindow = getParentWindow();
|
||||
final Session session = parentWindow != null ? parentWindow.mSession : mSession;
|
||||
// System process or invalid process cannot register to display config change.
|
||||
if (session.mPid == MY_PID || session.mPid < 0) return false;
|
||||
WindowProcessController app =
|
||||
mWmService.mAtmService.getProcessController(session.mPid, session.mUid);
|
||||
if (app == null || !app.registeredForDisplayConfigChanges()) return false;
|
||||
return true;
|
||||
final WindowProcessController wpc = parentWindow != null
|
||||
? parentWindow.mWpcForDisplayConfigChanges
|
||||
: mWpcForDisplayConfigChanges;
|
||||
return wpc != null && wpc.registeredForDisplayConfigChanges();
|
||||
}
|
||||
|
||||
void reportResized() {
|
||||
@@ -5103,13 +5109,12 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
mWindowFrames.updateLastInsetValues();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
WindowContainer<WindowState> getAnimatingContainer(int flags, int typesToCheck) {
|
||||
protected boolean isSelfAnimating(int flags, int typesToCheck) {
|
||||
if (mControllableInsetProvider != null) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
return super.getAnimatingContainer(flags, typesToCheck);
|
||||
return super.isSelfAnimating(flags, typesToCheck);
|
||||
}
|
||||
|
||||
void startAnimation(Animation anim) {
|
||||
@@ -5299,10 +5304,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
return mWillReplaceWindow;
|
||||
}
|
||||
|
||||
private void applyDims(Dimmer dimmer) {
|
||||
private void applyDims() {
|
||||
if (!mAnimatingExit && mAppDied) {
|
||||
mIsDimming = true;
|
||||
dimmer.dimAbove(getSyncTransaction(), this, DEFAULT_DIM_AMOUNT_DEAD_WINDOW);
|
||||
getDimmer().dimAbove(getSyncTransaction(), this, DEFAULT_DIM_AMOUNT_DEAD_WINDOW);
|
||||
} else if ((mAttrs.flags & FLAG_DIM_BEHIND) != 0 && isVisibleNow() && !mHidden) {
|
||||
// Only show a dim behind when the following is satisfied:
|
||||
// 1. The window has the flag FLAG_DIM_BEHIND
|
||||
@@ -5310,7 +5315,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
// 3. The WS is considered visible according to the isVisible() method
|
||||
// 4. The WS is not hidden.
|
||||
mIsDimming = true;
|
||||
dimmer.dimBelow(getSyncTransaction(), this, mAttrs.dimAmount);
|
||||
getDimmer().dimBelow(getSyncTransaction(), this, mAttrs.dimAmount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5334,11 +5339,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
|
||||
@Override
|
||||
void prepareSurfaces() {
|
||||
final Dimmer dimmer = getDimmer();
|
||||
mIsDimming = false;
|
||||
if (dimmer != null) {
|
||||
applyDims(dimmer);
|
||||
}
|
||||
applyDims();
|
||||
updateSurfacePosition();
|
||||
// Send information to SufaceFlinger about the priority of the current window.
|
||||
updateFrameRateSelectionPriorityIfNeeded();
|
||||
|
||||
@@ -87,10 +87,7 @@ public class InsetsStateControllerTest extends WindowTestsBase {
|
||||
.setWindow(statusBar, null, null);
|
||||
statusBar.setControllableInsetProvider(getController().getSourceProvider(ITYPE_STATUS_BAR));
|
||||
final InsetsState state = getController().getInsetsForDispatch(statusBar);
|
||||
for (int i = state.getSourcesCount() - 1; i >= 0; i--) {
|
||||
final InsetsSource source = state.sourceAt(i);
|
||||
assertNotEquals(ITYPE_STATUS_BAR, source.getType());
|
||||
}
|
||||
assertNull(state.peekSource(ITYPE_STATUS_BAR));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user