Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72aeda05 authored by lumark's avatar lumark
Browse files

Fix App flashes when keyboard height changes in split screen mode.

When tapping globe key in the Gboard to switch keyboard, app will flashes
due to DisplayContent.adjustForImeIfNeeded will set adjust IME amount is 0
for adjusting dock bottom stack size, so stack size will have a chance to
back to the size without IME adjustment and then task size resize back to
adjusted size after IME window updated.

Forcing update the last adjust amount from DockedDividerController in
TaskStack.setAdjustedForIme to fix the above case.

Bug: 64362571
Test: manual, first to enable two languages with different keyboard height
    in Gboard's language setting UI, e.g. English and Hindi, and then in
    split-screen mode:
       1) Launch chrome app in bottom stack,
       2) Tapping Editor to let Gboard keyboard shown,
       3) Press global key to switch keyboard.
       4) See if chrome app flashes.

Change-Id: Ieea66640ba29cd4956b69b3c3231315695df85cf
parent db48fe13
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -996,15 +996,20 @@ public class TaskStack extends WindowContainer<Task> implements
     * Adjusts the stack bounds if the IME is visible.
     *
     * @param imeWin The IME window.
     * @param keepLastAmount Use {@code true} to keep the last adjusted amount from
     *                       {@link DockedStackDividerController} for adjusting the stack bounds,
     *                       Use {@code false} to reset adjusted amount as 0.
     * @see #updateAdjustForIme(float, float, boolean)
     */
    void setAdjustedForIme(WindowState imeWin, boolean forceUpdate) {
    void setAdjustedForIme(WindowState imeWin, boolean keepLastAmount) {
        mImeWin = imeWin;
        mImeGoingAway = false;
        if (!mAdjustedForIme || forceUpdate) {
        if (!mAdjustedForIme || keepLastAmount) {
            mAdjustedForIme = true;
            mAdjustImeAmount = 0f;
            mAdjustDividerAmount = 0f;
            updateAdjustForIme(0f, 0f, true /* force */);
            DockedStackDividerController controller = getDisplayContent().mDividerControllerLocked;
            final float adjustImeAmount = keepLastAmount ? controller.mLastAnimationProgress : 0f;
            final float adjustDividerAmount = keepLastAmount ? controller.mLastDividerProgress : 0f;
            updateAdjustForIme(adjustImeAmount, adjustDividerAmount, true /* force */);
        }
    }