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

Commit 63c8f34f authored by Matthew Ng's avatar Matthew Ng
Browse files

Decrease the edge panels height to not overlap with ime

Test: manual
Fixes: 124267373
Bug: 112934365
Change-Id: I5e8a79ab3df7ddf54f08a3ecc893bd222d11bc05
parent 52b40ae2
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -217,4 +217,11 @@ public class WindowManagerWrapper {
        WindowManagerGlobal.getWindowManagerService().registerPinnedStackListener(
                DEFAULT_DISPLAY, mPinnedStackListenerForwarder);
    }

    /**
     * Removes a pinned stack listener.
     */
    public void removePinnedStackListener(IPinnedStackListener listener) {
        mPinnedStackListenerForwarder.removeListener(listener);
    }
}
+52 −2
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.annotation.IntDef;
import android.annotation.SuppressLint;
import android.app.StatusBarManager;
import android.content.Context;
import android.content.pm.ParceledListSlice;
import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Point;
@@ -59,6 +60,8 @@ import android.util.Slog;
import android.util.SparseArray;
import android.view.Display;
import android.view.Gravity;
import android.view.IPinnedStackController;
import android.view.IPinnedStackListener;
import android.view.MotionEvent;
import android.view.Surface;
import android.view.View;
@@ -349,6 +352,46 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
        }
    };

    private final IPinnedStackListener.Stub mImeChangedListener = new IPinnedStackListener.Stub() {
        @Override
        public void onListenerRegistered(IPinnedStackController controller) {
        }

        @Override
        public void onImeVisibilityChanged(boolean imeVisible, int imeHeight) {
            post(() -> {
                // When the ime changes visibility, resize the edge panels to not cover the ime
                final int width = mPrototypeController.getEdgeSensitivityWidth();
                final int height = mContext.getDisplay().getHeight() - imeHeight
                        - getResources().getDimensionPixelOffset(R.dimen.status_bar_height);
                if (mLeftEdgePanel != null) {
                    mLeftEdgePanel.setDimensions(width, height);
                }
                if (mRightEdgePanel != null) {
                    mRightEdgePanel.setDimensions(width, height);
                }
            });
        }

        @Override
        public void onShelfVisibilityChanged(boolean shelfVisible, int shelfHeight) {
        }

        @Override
        public void onMinimizedStateChanged(boolean isMinimized) {
        }

        @Override
        public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds,
                Rect animatingBounds, boolean fromImeAdjustment, boolean fromShelfAdjustment,
                int displayRotation) {
        }

        @Override
        public void onActionsChanged(ParceledListSlice actions) {
        }
    };

    public NavigationBarView(Context context, AttributeSet attrs) {
        super(context, attrs);

@@ -1267,13 +1310,19 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
            int height = mPrototypeController.getEdgeSensitivityHeight();
            // Explicitly left and right, not start and end as this is device relative.
            mLeftEdgePanel = NavigationBarEdgePanel.create(getContext(), width, height,
                    Gravity.LEFT | Gravity.BOTTOM);
                    Gravity.LEFT | Gravity.TOP);
            mRightEdgePanel = NavigationBarEdgePanel.create(getContext(), width, height,
                    Gravity.RIGHT | Gravity.BOTTOM);
                    Gravity.RIGHT | Gravity.TOP);
            mLeftEdgePanel.setOnTouchListener(mEdgePanelTouchListener);
            mRightEdgePanel.setOnTouchListener(mEdgePanelTouchListener);
            wm.addView(mLeftEdgePanel, mLeftEdgePanel.getLayoutParams());
            wm.addView(mRightEdgePanel, mRightEdgePanel.getLayoutParams());

            try {
                WindowManagerWrapper.getInstance().addPinnedStackListener(mImeChangedListener);
            } catch (RemoteException e) {
                Log.e(TAG, "Failed to register pinned stack listener", e);
            }
        }
    }

@@ -1298,6 +1347,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
        if (mRightEdgePanel != null) {
            wm.removeView(mRightEdgePanel);
        }
        WindowManagerWrapper.getInstance().removePinnedStackListener(mImeChangedListener);
    }

    private void setUpSwipeUpOnboarding(boolean connectedToOverviewProxy) {