Merge "Make the visibility of rotated insets up-to-date" into rvc-qpr-dev am: 405ff8efaa
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13133960 Change-Id: Ie8428a8659859accbcbd9e0f91b36639fd8b9027
This commit is contained in:
@@ -188,6 +188,8 @@ import android.view.IWindow;
|
|||||||
import android.view.InputChannel;
|
import android.view.InputChannel;
|
||||||
import android.view.InputDevice;
|
import android.view.InputDevice;
|
||||||
import android.view.InputWindowHandle;
|
import android.view.InputWindowHandle;
|
||||||
|
import android.view.InsetsSource;
|
||||||
|
import android.view.InsetsState;
|
||||||
import android.view.InsetsState.InternalInsetsType;
|
import android.view.InsetsState.InternalInsetsType;
|
||||||
import android.view.MagnificationSpec;
|
import android.view.MagnificationSpec;
|
||||||
import android.view.RemoteAnimationDefinition;
|
import android.view.RemoteAnimationDefinition;
|
||||||
@@ -1666,6 +1668,28 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void notifyInsetsChanged(Consumer<WindowState> dispatchInsetsChanged) {
|
||||||
|
if (mFixedRotationLaunchingApp != null) {
|
||||||
|
// The insets state of fixed rotation app is a rotated copy. Make sure the visibilities
|
||||||
|
// of insets sources are consistent with the latest state.
|
||||||
|
final InsetsState rotatedState =
|
||||||
|
mFixedRotationLaunchingApp.getFixedRotationTransformInsetsState();
|
||||||
|
if (rotatedState != null) {
|
||||||
|
final InsetsState state = mInsetsStateController.getRawInsetsState();
|
||||||
|
for (int i = 0; i < InsetsState.SIZE; i++) {
|
||||||
|
final InsetsSource source = state.peekSource(i);
|
||||||
|
if (source != null) {
|
||||||
|
rotatedState.setSourceVisible(i, source.isVisible());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
forAllWindows(dispatchInsetsChanged, true /* traverseTopToBottom */);
|
||||||
|
if (mRemoteInsetsControlTarget != null) {
|
||||||
|
mRemoteInsetsControlTarget.notifyInsetsChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update rotation of the display.
|
* Update rotation of the display.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -477,10 +477,7 @@ class InsetsStateController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void notifyInsetsChanged() {
|
void notifyInsetsChanged() {
|
||||||
mDisplayContent.forAllWindows(mDispatchInsetsChanged, true /* traverseTopToBottom */);
|
mDisplayContent.notifyInsetsChanged(mDispatchInsetsChanged);
|
||||||
if (mDisplayContent.mRemoteInsetsControlTarget != null) {
|
|
||||||
mDisplayContent.mRemoteInsetsControlTarget.notifyInsetsChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump(String prefix, PrintWriter pw) {
|
void dump(String prefix, PrintWriter pw) {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import static android.view.Display.FLAG_PRIVATE;
|
|||||||
import static android.view.DisplayCutout.BOUNDS_POSITION_LEFT;
|
import static android.view.DisplayCutout.BOUNDS_POSITION_LEFT;
|
||||||
import static android.view.DisplayCutout.BOUNDS_POSITION_TOP;
|
import static android.view.DisplayCutout.BOUNDS_POSITION_TOP;
|
||||||
import static android.view.DisplayCutout.fromBoundingRect;
|
import static android.view.DisplayCutout.fromBoundingRect;
|
||||||
|
import static android.view.InsetsState.ITYPE_STATUS_BAR;
|
||||||
import static android.view.Surface.ROTATION_0;
|
import static android.view.Surface.ROTATION_0;
|
||||||
import static android.view.Surface.ROTATION_90;
|
import static android.view.Surface.ROTATION_90;
|
||||||
import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN;
|
import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN;
|
||||||
@@ -102,6 +103,7 @@ import android.view.IDisplayWindowRotationCallback;
|
|||||||
import android.view.IDisplayWindowRotationController;
|
import android.view.IDisplayWindowRotationController;
|
||||||
import android.view.ISystemGestureExclusionListener;
|
import android.view.ISystemGestureExclusionListener;
|
||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
|
import android.view.InsetsState;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import android.view.SurfaceControl.Transaction;
|
import android.view.SurfaceControl.Transaction;
|
||||||
@@ -1114,6 +1116,17 @@ public class DisplayContentTests extends WindowTestsBase {
|
|||||||
assertTrue(mNavBarWindow.getParent().isAnimating(WindowContainer.AnimationFlags.PARENTS,
|
assertTrue(mNavBarWindow.getParent().isAnimating(WindowContainer.AnimationFlags.PARENTS,
|
||||||
ANIMATION_TYPE_FIXED_TRANSFORM));
|
ANIMATION_TYPE_FIXED_TRANSFORM));
|
||||||
|
|
||||||
|
// If the visibility of insets state is changed, the rotated state should be updated too.
|
||||||
|
final InsetsState rotatedState = app.getFixedRotationTransformInsetsState();
|
||||||
|
final InsetsState state = mDisplayContent.getInsetsStateController().getRawInsetsState();
|
||||||
|
assertEquals(state.getSource(ITYPE_STATUS_BAR).isVisible(),
|
||||||
|
rotatedState.getSource(ITYPE_STATUS_BAR).isVisible());
|
||||||
|
state.getSource(ITYPE_STATUS_BAR).setVisible(
|
||||||
|
!rotatedState.getSource(ITYPE_STATUS_BAR).isVisible());
|
||||||
|
mDisplayContent.getInsetsStateController().notifyInsetsChanged();
|
||||||
|
assertEquals(state.getSource(ITYPE_STATUS_BAR).isVisible(),
|
||||||
|
rotatedState.getSource(ITYPE_STATUS_BAR).isVisible());
|
||||||
|
|
||||||
final Rect outFrame = new Rect();
|
final Rect outFrame = new Rect();
|
||||||
final Rect outInsets = new Rect();
|
final Rect outInsets = new Rect();
|
||||||
final Rect outStableInsets = new Rect();
|
final Rect outStableInsets = new Rect();
|
||||||
|
|||||||
Reference in New Issue
Block a user