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

Commit 3ae865e6 authored by mpodolian's avatar mpodolian
Browse files

Added logic to update ime clip value on insets update.

Added logic to notify BubbleBarExpandedView to update task view clip
rect if new insets are applied.

Fixes:416183410
Flag:com.android.wm.shell.enable_create_any_bubble
Test: Manual. Create any bubble that will have an input inside the task
view. Click on it to show keyboard. Rotate the device couple of times.
Task is clipped correctly for every rotation.
Used the device mentioned in the bug.

Change-Id: I091cb194baeabd5f7b88906a60212c6b2dd66bf5
parent 5ab3134c
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1351,8 +1351,12 @@ public class BubbleController implements ConfigurationChangeListener,

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        DeviceConfig deviceConfig = DeviceConfig.create(mContext, mWindowManager);
        if (mBubblePositioner != null) {
            mBubblePositioner.update(DeviceConfig.create(mContext, mWindowManager));
            mBubblePositioner.update(deviceConfig);
        }
        if (mLayerView != null) {
            mLayerView.update(deviceConfig);
        }
        if (mStackView != null && newConfig != null) {
            if (newConfig.densityDpi != mDensityDpi
+2 −6
Original line number Diff line number Diff line
@@ -31,8 +31,6 @@ import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES_
import static com.android.wm.shell.shared.animation.Interpolators.EMPHASIZED;
import static com.android.wm.shell.shared.animation.Interpolators.EMPHASIZED_DECELERATE;

import static java.lang.Math.max;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
@@ -238,7 +236,7 @@ public class BubbleBarAnimationHelper {
                })
                .withEndActions(() -> {
                    bbev.setAnimationMatrix(null);
                    bbev.updateBottomClip(0);
                    bbev.onImeTopChanged(0);
                    if (endRunnable != null) {
                        endRunnable.run();
                    }
@@ -664,9 +662,7 @@ public class BubbleBarAnimationHelper {
            Log.w(TAG, "Bubble bar expanded view was null when IME top changed");
            return;
        }
        int bbevBottom = bbev.getContentBottomOnScreen();
        int clip = max(bbevBottom - imeTop, 0);
        bbev.updateBottomClip(clip);
        bbev.onImeTopChanged(imeTop);
    }

    private @Nullable BubbleBarExpandedView getExpandedView() {
+13 −3
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;

import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES_NOISY;

import static java.lang.Math.max;

import android.annotation.Nullable;
import android.content.Context;
import android.graphics.Insets;
@@ -169,6 +171,7 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView

    private boolean mIsClipping = false;
    private int mBottomClip = 0;
    private int mImeTop = 0;

    /** An enum value that tracks the visibility state of the task view */
    private enum TaskViewVisibilityState {
@@ -693,12 +696,19 @@ public class BubbleBarExpandedView extends FrameLayout implements BubbleTaskView
        return mTempBounds.bottom;
    }

    /** Update the amount by which to clip the expanded view at the bottom. */
    public void updateBottomClip(int bottomClip) {
        mBottomClip = bottomClip;
    /** Notifies the expanded view that the IME top changed. */
    public void onImeTopChanged(int imeTop) {
        mImeTop = imeTop;
        mBottomClip = max(getContentBottomOnScreen() - mImeTop, 0);
        onClipUpdate();
    }

    void updateBottomClip() {
        if (mIsClipping) {
            onImeTopChanged(mImeTop);
        }
    }

    private void onClipUpdate() {
        if (mBottomClip == 0) {
            if (mIsClipping) {
+12 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static com.android.wm.shell.shared.bubbles.BubbleConstants.BUBBLE_EXPANDE

import android.annotation.Nullable;
import android.content.Context;
import android.graphics.Insets;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.Region;
@@ -106,6 +107,7 @@ public class BubbleBarLayerView extends FrameLayout
    // Used to ensure touch target size for the menu shown on a bubble expanded view
    private TouchDelegate mHandleTouchDelegate;
    private final Rect mHandleTouchBounds = new Rect();
    private Insets mInsets;

    public BubbleBarLayerView(Context context, BubbleController controller, BubbleData bubbleData,
            BubbleLogger bubbleLogger) {
@@ -612,6 +614,7 @@ public class BubbleBarLayerView extends FrameLayout
        mExpandedView.setX(mTempRect.left);
        mExpandedView.setY(mTempRect.top);
        mExpandedView.updateLocation();
        mExpandedView.updateBottomClip();
    }

    private void showScrim(boolean show) {
@@ -664,6 +667,15 @@ public class BubbleBarLayerView extends FrameLayout
        return mDragController;
    }

    /** Notifies view of device config update. */
    public void update(DeviceConfig deviceConfig) {
        Insets newInsets = deviceConfig.getInsets();
        if (!newInsets.equals(mInsets)) {
            mInsets = newInsets;
            updateExpandedView();
        }
    }

    private class LocationChangeListener implements
            BaseBubblePinController.LocationChangeListener {