Merge "Decrease the edge panels height to not overlap with ime"
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java
index 10996e88..794c30a 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java
@@ -217,4 +217,11 @@
WindowManagerGlobal.getWindowManagerService().registerPinnedStackListener(
DEFAULT_DISPLAY, mPinnedStackListenerForwarder);
}
+
+ /**
+ * Removes a pinned stack listener.
+ */
+ public void removePinnedStackListener(IPinnedStackListener listener) {
+ mPinnedStackListenerForwarder.removeListener(listener);
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index c389082..b540fb4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -42,6 +42,7 @@
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.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 @@
}
};
+ 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 @@
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 @@
if (mRightEdgePanel != null) {
wm.removeView(mRightEdgePanel);
}
+ WindowManagerWrapper.getInstance().removePinnedStackListener(mImeChangedListener);
}
private void setUpSwipeUpOnboarding(boolean connectedToOverviewProxy) {