summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2020-07-10 21:41:03 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-07-10 21:41:03 +0000
commit8b1105702aca8f6120405365a8c1a7a15583d08c (patch)
treef6f7e016be96a9eed4becb5ee685638527cc31c8
parent64682e76f21d2de5a5b605cf60b972cc612379a2 (diff)
parent60c667803119d63afd284dbcdf0141fd0b11b7f1 (diff)
Merge "Use inputtarget to check for insets controller" into rvc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/stackdivider/DividerImeController.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java7
-rw-r--r--services/core/java/com/android/server/wm/DisplayContent.java5
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java1
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java2
6 files changed, 28 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java b/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java
index 8a3819925f30..370f9a762402 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/Divider.java
@@ -193,10 +193,11 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
@Override
public void onKeyguardShowingChanged() {
- if (!isDividerVisible() || mView == null) {
+ if (!isSplitActive() || mView == null) {
return;
}
mView.setHidden(mKeyguardStateController.isShowing());
+ mImePositionProcessor.updateAdjustForIme();
}
@Override
@@ -285,8 +286,9 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
* while this only cares if some things are (eg. while entering/exiting as well).
*/
private boolean isSplitActive() {
- return mSplits.mPrimary.topActivityType != ACTIVITY_TYPE_UNDEFINED
- || mSplits.mSecondary.topActivityType != ACTIVITY_TYPE_UNDEFINED;
+ return mSplits.mPrimary != null && mSplits.mSecondary != null
+ && (mSplits.mPrimary.topActivityType != ACTIVITY_TYPE_UNDEFINED
+ || mSplits.mSecondary.topActivityType != ACTIVITY_TYPE_UNDEFINED);
}
private void addDivider(Configuration configuration) {
diff --git a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerImeController.java b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerImeController.java
index 47c8c0ad8a4e..9db389eba3d8 100644
--- a/packages/SystemUI/src/com/android/systemui/stackdivider/DividerImeController.java
+++ b/packages/SystemUI/src/com/android/systemui/stackdivider/DividerImeController.java
@@ -91,6 +91,7 @@ class DividerImeController implements DisplayImeController.ImePositionProcessor
private boolean mPaused = true;
private boolean mPausedTargetAdjusted = false;
+ private boolean mAdjustedWhileHidden = false;
DividerImeController(SplitScreenTaskOrganizer splits, TransactionPool pool, Handler handler) {
mSplits = splits;
@@ -170,11 +171,17 @@ class DividerImeController implements DisplayImeController.ImePositionProcessor
// If split is hidden, we don't want to trigger any relayouts that would cause the
// divider to show again.
updateImeAdjustState();
+ } else {
+ mAdjustedWhileHidden = true;
}
}
private void updateImeAdjustState() {
- if (mAdjusted != mTargetAdjusted) {
+ updateImeAdjustState(false /* force */);
+ }
+
+ private void updateImeAdjustState(boolean force) {
+ if (mAdjusted != mTargetAdjusted || force) {
// Reposition the server's secondary split position so that it evaluates
// insets properly.
WindowContainerTransaction wct = new WindowContainerTransaction();
@@ -231,6 +238,11 @@ class DividerImeController implements DisplayImeController.ImePositionProcessor
mSplits.mDivider.setAdjustedForIme(mTargetShown && !mPaused);
}
+ public void updateAdjustForIme() {
+ updateImeAdjustState(mAdjustedWhileHidden);
+ mAdjustedWhileHidden = false;
+ }
+
@Override
public void onImePositionChanged(int displayId, int imeTop,
SurfaceControl.Transaction t) {
diff --git a/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java b/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java
index c0089e53f8b6..1ce98eb152c8 100644
--- a/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java
+++ b/packages/SystemUI/src/com/android/systemui/wm/DisplayImeController.java
@@ -273,10 +273,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
if (imeSource == null || mImeSourceControl == null) {
return;
}
- // Set frame, but only if the new frame isn't empty -- this maintains continuity
final Rect newFrame = imeSource.getFrame();
- mImeFrame.set(newFrame);
- final boolean isFloating = newFrame.height() == 0;
+ final boolean isFloating = newFrame.height() == 0 && show;
if (isFloating) {
// This is likely a "floating" or "expanded" IME, so to get animations, just
// pretend the ime has some size just below the screen.
@@ -285,6 +283,9 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
mSystemWindows.mDisplayController.getDisplayLayout(mDisplayId).density()
* FLOATING_IME_BOTTOM_INSET);
mImeFrame.bottom -= floatingInset;
+ } else if (newFrame.height() != 0) {
+ // Don't set a new frame if it's empty and hiding -- this maintains continuity
+ mImeFrame.set(newFrame);
}
if (DEBUG) {
Slog.d(TAG, "Run startAnim show:" + show + " was:"
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index b94fb0471af4..de6501aa9718 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -3506,12 +3506,13 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
}
private boolean isImeControlledByApp() {
- return mInputMethodTarget != null && !WindowConfiguration.isSplitScreenWindowingMode(
- mInputMethodTarget.getWindowingMode());
+ return mInputMethodInputTarget != null && !WindowConfiguration.isSplitScreenWindowingMode(
+ mInputMethodInputTarget.getWindowingMode());
}
boolean isImeAttachedToApp() {
return isImeControlledByApp()
+ && mInputMethodTarget != null
&& mInputMethodTarget.mActivityRecord != null
&& mInputMethodTarget.getWindowingMode() == WINDOWING_MODE_FULLSCREEN
// An activity with override bounds should be letterboxed inside its parent bounds,
diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
index d64fdb81107c..94acd776fcb3 100644
--- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java
@@ -858,6 +858,7 @@ public class DisplayContentTests extends WindowTestsBase {
public void testComputeImeParent_app() throws Exception {
final DisplayContent dc = createNewDisplay();
dc.mInputMethodTarget = createWindow(null, TYPE_BASE_APPLICATION, "app");
+ dc.mInputMethodInputTarget = dc.mInputMethodTarget;
assertEquals(dc.mInputMethodTarget.mActivityRecord.getSurfaceControl(),
dc.computeImeParent());
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
index 3c98272311f7..a979c862a8e4 100644
--- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java
@@ -269,6 +269,8 @@ public class SizeCompatTests extends ActivityTestsBase {
rotateDisplay(mActivity.mDisplayContent, ROTATION_90);
mActivity.mDisplayContent.mInputMethodTarget = addWindowToActivity(mActivity);
+ mActivity.mDisplayContent.mInputMethodInputTarget =
+ mActivity.mDisplayContent.mInputMethodTarget;
// Because the aspect ratio of display doesn't exceed the max aspect ratio of activity.
// The activity should still fill its parent container and IME can attach to the activity.
assertTrue(mActivity.matchParentBounds());