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

Commit 12a2b5e5 authored by Winson Chung's avatar Winson Chung Committed by android-build-merger
Browse files

Merge "Adjusting PiP for the TV IME." into oc-mr1-dev

am: ca468f19

Change-Id: I0869d84d5c7a41f7088dc27ca2e2e8355794c4bc
parents ecb3e7a4 ca468f19
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -127,6 +127,10 @@ public class PipManager implements BasePipManager {
    private PipNotification mPipNotification;
    private ParceledListSlice mCustomActions;

    // Keeps track of the IME visibility to adjust the PiP when the IME is visible
    private boolean mImeVisible;
    private int mImeHeightAdjustment;

    private final PinnedStackListener mPinnedStackListener = new PinnedStackListener();

    private final Runnable mResizePinnedStackRunnable = new Runnable() {
@@ -175,7 +179,22 @@ public class PipManager implements BasePipManager {
        public void onListenerRegistered(IPinnedStackController controller) {}

        @Override
        public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {}
        public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {
            if (mState == STATE_PIP) {
                if (mImeVisible != imeVisible) {
                    if (imeVisible) {
                        // Save the IME height adjustment, and offset to not occlude the IME
                        mPipBounds.offset(0, -imeHeight);
                        mImeHeightAdjustment = imeHeight;
                    } else {
                        // Apply the inverse adjustment when the IME is hidden
                        mPipBounds.offset(0, mImeHeightAdjustment);
                    }
                    mImeVisible = imeVisible;
                    resizePinnedStack(STATE_PIP);
                }
            }
        }

        @Override
        public void onMinimizedStateChanged(boolean isMinimized) {}