Merge "Use inputtarget to check for insets controller" into rvc-dev am: 8b1105702a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12110854 Change-Id: I29a08f80fc21bc82c8b95a346439c618f2aaafb4
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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:"
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user