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

Commit e035a1fd authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Decrease the edge panels height to not overlap with ime"

parents 24fbef66 63c8f34f
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;
@@ -355,6 +358,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);

@@ -1296,13 +1339,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);
            }
        }
    }

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

    private void setUpSwipeUpOnboarding(boolean connectedToOverviewProxy) {