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;
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;
}
};
+ 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);
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);
+ }
}
}
if (mRightEdgePanel != null) {
wm.removeView(mRightEdgePanel);
}
+ WindowManagerWrapper.getInstance().removePinnedStackListener(mImeChangedListener);
}
private void setUpSwipeUpOnboarding(boolean connectedToOverviewProxy) {