summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/CarSystemUI/res/layout/sysui_overlay_window.xml3
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/notification/NotificationPanelViewController.java27
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/window/OverlayViewController.java13
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/window/OverlayViewGlobalStateController.java8
-rw-r--r--packages/CarSystemUI/src/com/android/systemui/car/window/SystemUIOverlayWindowController.java6
5 files changed, 38 insertions, 19 deletions
diff --git a/packages/CarSystemUI/res/layout/sysui_overlay_window.xml b/packages/CarSystemUI/res/layout/sysui_overlay_window.xml
index e7295aa6383d..2c9788955bfa 100644
--- a/packages/CarSystemUI/res/layout/sysui_overlay_window.xml
+++ b/packages/CarSystemUI/res/layout/sysui_overlay_window.xml
@@ -25,8 +25,7 @@
<ViewStub android:id="@+id/notification_panel_stub"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout="@layout/notification_panel_container"
- android:layout_marginBottom="@dimen/car_bottom_navigation_bar_height"/>
+ android:layout="@layout/notification_panel_container"/>
<ViewStub android:id="@+id/keyguard_stub"
android:layout_width="match_parent"
diff --git a/packages/CarSystemUI/src/com/android/systemui/car/notification/NotificationPanelViewController.java b/packages/CarSystemUI/src/com/android/systemui/car/notification/NotificationPanelViewController.java
index b647f13cbe1f..4b660692cd8f 100644
--- a/packages/CarSystemUI/src/com/android/systemui/car/notification/NotificationPanelViewController.java
+++ b/packages/CarSystemUI/src/com/android/systemui/car/notification/NotificationPanelViewController.java
@@ -32,6 +32,7 @@ import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import android.view.WindowInsets;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
@@ -82,7 +83,6 @@ public class NotificationPanelViewController extends OverlayPanelViewController
private final StatusBarStateController mStatusBarStateController;
private final boolean mEnableHeadsUpNotificationWhenNotificationShadeOpen;
private final NotificationVisibilityLogger mNotificationVisibilityLogger;
- private final int mNavBarHeight;
private float mInitialBackgroundAlpha;
private float mBackgroundAlphaDiff;
@@ -97,6 +97,7 @@ public class NotificationPanelViewController extends OverlayPanelViewController
private boolean mNotificationListAtEndAtTimeOfTouch;
private boolean mIsSwipingVerticallyToClose;
private boolean mIsNotificationCardSwiping;
+ private boolean mImeVisible = false;
private OnUnseenCountUpdateListener mUnseenCountUpdateListener;
@@ -139,8 +140,6 @@ public class NotificationPanelViewController extends OverlayPanelViewController
mStatusBarStateController = statusBarStateController;
mNotificationVisibilityLogger = notificationVisibilityLogger;
- mNavBarHeight = mResources.getDimensionPixelSize(R.dimen.car_bottom_navigation_bar_height);
-
mCommandQueue.addCallback(this);
// Notification background setup.
@@ -189,19 +188,7 @@ public class NotificationPanelViewController extends OverlayPanelViewController
if (mContext.getDisplayId() != displayId) {
return;
}
- boolean isKeyboardVisible = (vis & InputMethodService.IME_VISIBLE) != 0;
- int bottomMargin = isKeyboardVisible ? 0 : mNavBarHeight;
- ViewGroup container = (ViewGroup) getLayout();
- if (container == null) {
- // Notification panel hasn't been inflated before. We shouldn't try to update the layout
- // params.
- return;
- }
-
- ViewGroup.MarginLayoutParams params =
- (ViewGroup.MarginLayoutParams) container.getLayoutParams();
- params.setMargins(params.leftMargin, params.topMargin, params.rightMargin, bottomMargin);
- container.setLayoutParams(params);
+ mImeVisible = (vis & InputMethodService.IME_VISIBLE) != 0;
}
// OverlayViewController
@@ -229,7 +216,7 @@ public class NotificationPanelViewController extends OverlayPanelViewController
@Override
protected int getInsetTypesToFit() {
- return 0;
+ return WindowInsets.Type.navigationBars();
}
@Override
@@ -237,6 +224,12 @@ public class NotificationPanelViewController extends OverlayPanelViewController
return mEnableHeadsUpNotificationWhenNotificationShadeOpen;
}
+ @Override
+ protected boolean shouldUseStableInsets() {
+ // When IME is visible, then the inset from the nav bar should not be applied.
+ return !mImeVisible;
+ }
+
/** Reinflates the view. */
public void reinflate() {
ViewGroup container = (ViewGroup) getLayout();
diff --git a/packages/CarSystemUI/src/com/android/systemui/car/window/OverlayViewController.java b/packages/CarSystemUI/src/com/android/systemui/car/window/OverlayViewController.java
index 8adc1adcc41c..6c3a6327d90c 100644
--- a/packages/CarSystemUI/src/com/android/systemui/car/window/OverlayViewController.java
+++ b/packages/CarSystemUI/src/com/android/systemui/car/window/OverlayViewController.java
@@ -168,6 +168,19 @@ public class OverlayViewController {
}
/**
+ * Returns {@code true} if the window should use stable insets. Using stable insets means that
+ * even when system bars are temporarily not visible, inset from the system bars will still be
+ * applied.
+ *
+ * NOTE: When system bars are hidden in transient mode, insets from them will not be applied
+ * even when the system bars become visible. Setting the return value to {@true} here can
+ * prevent the OverlayView from overlapping with the system bars when that happens.
+ */
+ protected boolean shouldUseStableInsets() {
+ return false;
+ }
+
+ /**
* Returns the insets types to fit to the sysui overlay window when this
* {@link OverlayViewController} is in the foreground.
*/
diff --git a/packages/CarSystemUI/src/com/android/systemui/car/window/OverlayViewGlobalStateController.java b/packages/CarSystemUI/src/com/android/systemui/car/window/OverlayViewGlobalStateController.java
index c13e486f1c0e..0da23605a2cf 100644
--- a/packages/CarSystemUI/src/com/android/systemui/car/window/OverlayViewGlobalStateController.java
+++ b/packages/CarSystemUI/src/com/android/systemui/car/window/OverlayViewGlobalStateController.java
@@ -108,6 +108,7 @@ public class OverlayViewGlobalStateController {
if (mZOrderVisibleSortedMap.isEmpty()) {
setWindowVisible(true);
}
+
if (!(viewController instanceof OverlayPanelViewController)) {
inflateView(viewController);
}
@@ -117,6 +118,7 @@ public class OverlayViewGlobalStateController {
}
updateInternalsWhenShowingView(viewController);
+ refreshUseStableInsets();
refreshInsetTypesToFit();
refreshWindowFocus();
refreshNavigationBarVisibility();
@@ -190,6 +192,7 @@ public class OverlayViewGlobalStateController {
mZOrderVisibleSortedMap.remove(mZOrderMap.get(viewController));
refreshHighestZOrderWhenHidingView(viewController);
+ refreshUseStableInsets();
refreshInsetTypesToFit();
refreshWindowFocus();
refreshNavigationBarVisibility();
@@ -247,6 +250,11 @@ public class OverlayViewGlobalStateController {
setWindowFocusable(mHighestZOrder == null ? false : mHighestZOrder.shouldFocusWindow());
}
+ private void refreshUseStableInsets() {
+ mSystemUIOverlayWindowController.setUsingStableInsets(
+ mHighestZOrder == null ? false : mHighestZOrder.shouldUseStableInsets());
+ }
+
private void refreshInsetTypesToFit() {
if (mZOrderVisibleSortedMap.isEmpty()) {
setFitInsetsTypes(statusBars());
diff --git a/packages/CarSystemUI/src/com/android/systemui/car/window/SystemUIOverlayWindowController.java b/packages/CarSystemUI/src/com/android/systemui/car/window/SystemUIOverlayWindowController.java
index 887329359b05..b22de84eb038 100644
--- a/packages/CarSystemUI/src/com/android/systemui/car/window/SystemUIOverlayWindowController.java
+++ b/packages/CarSystemUI/src/com/android/systemui/car/window/SystemUIOverlayWindowController.java
@@ -53,6 +53,7 @@ public class SystemUIOverlayWindowController implements
private boolean mIsAttached = false;
private boolean mVisible = false;
private boolean mFocusable = false;
+ private boolean mUsingStableInsets = false;
@Inject
public SystemUIOverlayWindowController(
@@ -115,6 +116,7 @@ public class SystemUIOverlayWindowController implements
/** Sets the types of insets to fit. Note: This should be rarely used. */
public void setFitInsetsTypes(@WindowInsets.Type.InsetsType int types) {
mLpChanged.setFitInsetsTypes(types);
+ mLpChanged.setFitInsetsIgnoringVisibility(mUsingStableInsets);
updateWindow();
}
@@ -159,6 +161,10 @@ public class SystemUIOverlayWindowController implements
return mFocusable;
}
+ protected void setUsingStableInsets(boolean useStableInsets) {
+ mUsingStableInsets = useStableInsets;
+ }
+
private void updateWindow() {
if (mLp != null && mLp.copyFrom(mLpChanged) != 0) {
if (isAttached()) {