Loading packages/CarSystemUI/src/com/android/systemui/car/navigationbar/CarNavigationBarController.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class CarNavigationBarController { } } /** /** * Hides all navigation bars. * Hides all system bars. */ */ public void hideBars() { public void hideBars() { if (mTopView != null) { if (mTopView != null) { Loading @@ -85,7 +85,7 @@ public class CarNavigationBarController { } } /** /** * Shows all navigation bars. * Shows all system bars. */ */ public void showBars() { public void showBars() { if (mTopView != null) { if (mTopView != null) { Loading packages/CarSystemUI/src/com/android/systemui/car/notification/CarHeadsUpNotificationSystemContainer.java +9 −14 Original line number Original line Diff line number Diff line Loading @@ -29,41 +29,40 @@ import android.widget.FrameLayout; import com.android.car.notification.R; import com.android.car.notification.R; import com.android.car.notification.headsup.CarHeadsUpNotificationContainer; import com.android.car.notification.headsup.CarHeadsUpNotificationContainer; import com.android.systemui.car.CarDeviceProvisionedController; import com.android.systemui.car.CarDeviceProvisionedController; import com.android.systemui.car.window.OverlayViewGlobalStateController; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dagger.qualifiers.Main; import javax.inject.Inject; import javax.inject.Inject; import javax.inject.Singleton; import javax.inject.Singleton; import dagger.Lazy; /** /** * A controller for SysUI's HUN display. * A controller for SysUI's HUN display. */ */ @Singleton @Singleton public class CarHeadsUpNotificationSystemContainer implements CarHeadsUpNotificationContainer { public class CarHeadsUpNotificationSystemContainer implements CarHeadsUpNotificationContainer { private final CarDeviceProvisionedController mCarDeviceProvisionedController; private final CarDeviceProvisionedController mCarDeviceProvisionedController; private final Lazy<NotificationPanelViewController> mNotificationPanelViewControllerLazy; private final OverlayViewGlobalStateController mOverlayViewGlobalStateController; private final ViewGroup mWindow; private final ViewGroup mWindow; private final FrameLayout mHeadsUpContentFrame; private final FrameLayout mHeadsUpContentFrame; private final boolean mEnableHeadsUpNotificationWhenNotificationShadeOpen; @Inject @Inject CarHeadsUpNotificationSystemContainer(Context context, CarHeadsUpNotificationSystemContainer(Context context, @Main Resources resources, @Main Resources resources, CarDeviceProvisionedController deviceProvisionedController, CarDeviceProvisionedController deviceProvisionedController, WindowManager windowManager, WindowManager windowManager, Lazy<NotificationPanelViewController> notificationPanelViewControllerLazy) { OverlayViewGlobalStateController overlayViewGlobalStateController) { mCarDeviceProvisionedController = deviceProvisionedController; mCarDeviceProvisionedController = deviceProvisionedController; mNotificationPanelViewControllerLazy = notificationPanelViewControllerLazy; mOverlayViewGlobalStateController = overlayViewGlobalStateController; boolean showOnBottom = resources.getBoolean(R.bool.config_showHeadsUpNotificationOnBottom); boolean showOnBottom = resources.getBoolean(R.bool.config_showHeadsUpNotificationOnBottom); // Use TYPE_STATUS_BAR_SUB_PANEL window type since we need to find a window that is above // status bar but below navigation bar. WindowManager.LayoutParams lp = new WindowManager.LayoutParams( WindowManager.LayoutParams lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG, WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, PixelFormat.TRANSLUCENT); PixelFormat.TRANSLUCENT); Loading @@ -78,15 +77,11 @@ public class CarHeadsUpNotificationSystemContainer implements CarHeadsUpNotifica windowManager.addView(mWindow, lp); windowManager.addView(mWindow, lp); mWindow.setVisibility(View.INVISIBLE); mWindow.setVisibility(View.INVISIBLE); mHeadsUpContentFrame = mWindow.findViewById(R.id.headsup_content); mHeadsUpContentFrame = mWindow.findViewById(R.id.headsup_content); mEnableHeadsUpNotificationWhenNotificationShadeOpen = resources.getBoolean( R.bool.config_enableHeadsUpNotificationWhenNotificationShadeOpen); } } private void animateShow() { private void animateShow() { if ((mEnableHeadsUpNotificationWhenNotificationShadeOpen if (mCarDeviceProvisionedController.isCurrentUserFullySetup() || !mNotificationPanelViewControllerLazy.get().isPanelExpanded()) && mOverlayViewGlobalStateController.shouldShowHUN()) { && mCarDeviceProvisionedController.isCurrentUserFullySetup()) { mWindow.setVisibility(View.VISIBLE); mWindow.setVisibility(View.VISIBLE); } } } } Loading packages/CarSystemUI/src/com/android/systemui/car/notification/NotificationPanelViewController.java +15 −0 Original line number Original line Diff line number Diff line Loading @@ -73,6 +73,7 @@ public class NotificationPanelViewController extends OverlayPanelViewController private final CarNotificationListener mCarNotificationListener; private final CarNotificationListener mCarNotificationListener; private final NotificationClickHandlerFactory mNotificationClickHandlerFactory; private final NotificationClickHandlerFactory mNotificationClickHandlerFactory; private final StatusBarStateController mStatusBarStateController; private final StatusBarStateController mStatusBarStateController; private final boolean mEnableHeadsUpNotificationWhenNotificationShadeOpen; private float mInitialBackgroundAlpha; private float mInitialBackgroundAlpha; private float mBackgroundAlphaDiff; private float mBackgroundAlphaDiff; Loading Loading @@ -144,6 +145,10 @@ public class NotificationPanelViewController extends OverlayPanelViewController + " percentage"); + " percentage"); } } mBackgroundAlphaDiff = finalBackgroundAlpha - mInitialBackgroundAlpha; mBackgroundAlphaDiff = finalBackgroundAlpha - mInitialBackgroundAlpha; mEnableHeadsUpNotificationWhenNotificationShadeOpen = mResources.getBoolean( com.android.car.notification.R.bool .config_enableHeadsUpNotificationWhenNotificationShadeOpen); } } @Override @Override Loading @@ -151,6 +156,16 @@ public class NotificationPanelViewController extends OverlayPanelViewController reinflate(); reinflate(); } } @Override protected boolean shouldShowNavigationBar() { return true; } @Override protected boolean shouldShowHUN() { return mEnableHeadsUpNotificationWhenNotificationShadeOpen; } /** Reinflates the view. */ /** Reinflates the view. */ public void reinflate() { public void reinflate() { ViewGroup container = (ViewGroup) getLayout(); ViewGroup container = (ViewGroup) getLayout(); Loading packages/CarSystemUI/src/com/android/systemui/car/window/OverlayPanelViewController.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -375,10 +375,10 @@ public abstract class OverlayPanelViewController extends OverlayViewController { } } if (visible && !getOverlayViewGlobalStateController().isWindowVisible()) { if (visible && !getOverlayViewGlobalStateController().isWindowVisible()) { getOverlayViewGlobalStateController().setWindowVisible(true); getOverlayViewGlobalStateController().showView(/* panelViewController= */ this); } } if (!visible && getOverlayViewGlobalStateController().isWindowVisible()) { if (!visible && getOverlayViewGlobalStateController().isWindowVisible()) { getOverlayViewGlobalStateController().setWindowVisible(false); getOverlayViewGlobalStateController().hideView(/* panelViewController= */ this); } } getLayout().setVisibility(visible ? View.VISIBLE : View.INVISIBLE); getLayout().setVisibility(visible ? View.VISIBLE : View.INVISIBLE); getOverlayViewGlobalStateController().setWindowFocusable(visible); getOverlayViewGlobalStateController().setWindowFocusable(visible); Loading packages/CarSystemUI/src/com/android/systemui/car/window/OverlayViewController.java +15 −2 Original line number Original line Diff line number Diff line Loading @@ -54,7 +54,6 @@ public class OverlayViewController { mOverlayViewGlobalStateController.hideView(/* viewController= */ this, this::hide); mOverlayViewGlobalStateController.hideView(/* viewController= */ this, this::hide); } } /** /** * Inflate layout owned by controller. * Inflate layout owned by controller. */ */ Loading @@ -72,7 +71,7 @@ public class OverlayViewController { } } /** /** * Returns [@code true} if layout owned by controller has been inflated. * Returns {@code true} if layout owned by controller has been inflated. */ */ public final boolean isInflated() { public final boolean isInflated() { return mLayout != null; return mLayout != null; Loading Loading @@ -125,4 +124,18 @@ public class OverlayViewController { protected final OverlayViewGlobalStateController getOverlayViewGlobalStateController() { protected final OverlayViewGlobalStateController getOverlayViewGlobalStateController() { return mOverlayViewGlobalStateController; return mOverlayViewGlobalStateController; } } /** * Returns {@code true} if heads up notifications should be displayed over this view. */ protected boolean shouldShowHUN() { return true; } /** * Returns {@code true} if navigation bar should be displayed over this view. */ protected boolean shouldShowNavigationBar() { return false; } } } Loading
packages/CarSystemUI/src/com/android/systemui/car/navigationbar/CarNavigationBarController.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class CarNavigationBarController { } } /** /** * Hides all navigation bars. * Hides all system bars. */ */ public void hideBars() { public void hideBars() { if (mTopView != null) { if (mTopView != null) { Loading @@ -85,7 +85,7 @@ public class CarNavigationBarController { } } /** /** * Shows all navigation bars. * Shows all system bars. */ */ public void showBars() { public void showBars() { if (mTopView != null) { if (mTopView != null) { Loading
packages/CarSystemUI/src/com/android/systemui/car/notification/CarHeadsUpNotificationSystemContainer.java +9 −14 Original line number Original line Diff line number Diff line Loading @@ -29,41 +29,40 @@ import android.widget.FrameLayout; import com.android.car.notification.R; import com.android.car.notification.R; import com.android.car.notification.headsup.CarHeadsUpNotificationContainer; import com.android.car.notification.headsup.CarHeadsUpNotificationContainer; import com.android.systemui.car.CarDeviceProvisionedController; import com.android.systemui.car.CarDeviceProvisionedController; import com.android.systemui.car.window.OverlayViewGlobalStateController; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dagger.qualifiers.Main; import javax.inject.Inject; import javax.inject.Inject; import javax.inject.Singleton; import javax.inject.Singleton; import dagger.Lazy; /** /** * A controller for SysUI's HUN display. * A controller for SysUI's HUN display. */ */ @Singleton @Singleton public class CarHeadsUpNotificationSystemContainer implements CarHeadsUpNotificationContainer { public class CarHeadsUpNotificationSystemContainer implements CarHeadsUpNotificationContainer { private final CarDeviceProvisionedController mCarDeviceProvisionedController; private final CarDeviceProvisionedController mCarDeviceProvisionedController; private final Lazy<NotificationPanelViewController> mNotificationPanelViewControllerLazy; private final OverlayViewGlobalStateController mOverlayViewGlobalStateController; private final ViewGroup mWindow; private final ViewGroup mWindow; private final FrameLayout mHeadsUpContentFrame; private final FrameLayout mHeadsUpContentFrame; private final boolean mEnableHeadsUpNotificationWhenNotificationShadeOpen; @Inject @Inject CarHeadsUpNotificationSystemContainer(Context context, CarHeadsUpNotificationSystemContainer(Context context, @Main Resources resources, @Main Resources resources, CarDeviceProvisionedController deviceProvisionedController, CarDeviceProvisionedController deviceProvisionedController, WindowManager windowManager, WindowManager windowManager, Lazy<NotificationPanelViewController> notificationPanelViewControllerLazy) { OverlayViewGlobalStateController overlayViewGlobalStateController) { mCarDeviceProvisionedController = deviceProvisionedController; mCarDeviceProvisionedController = deviceProvisionedController; mNotificationPanelViewControllerLazy = notificationPanelViewControllerLazy; mOverlayViewGlobalStateController = overlayViewGlobalStateController; boolean showOnBottom = resources.getBoolean(R.bool.config_showHeadsUpNotificationOnBottom); boolean showOnBottom = resources.getBoolean(R.bool.config_showHeadsUpNotificationOnBottom); // Use TYPE_STATUS_BAR_SUB_PANEL window type since we need to find a window that is above // status bar but below navigation bar. WindowManager.LayoutParams lp = new WindowManager.LayoutParams( WindowManager.LayoutParams lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG, WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, PixelFormat.TRANSLUCENT); PixelFormat.TRANSLUCENT); Loading @@ -78,15 +77,11 @@ public class CarHeadsUpNotificationSystemContainer implements CarHeadsUpNotifica windowManager.addView(mWindow, lp); windowManager.addView(mWindow, lp); mWindow.setVisibility(View.INVISIBLE); mWindow.setVisibility(View.INVISIBLE); mHeadsUpContentFrame = mWindow.findViewById(R.id.headsup_content); mHeadsUpContentFrame = mWindow.findViewById(R.id.headsup_content); mEnableHeadsUpNotificationWhenNotificationShadeOpen = resources.getBoolean( R.bool.config_enableHeadsUpNotificationWhenNotificationShadeOpen); } } private void animateShow() { private void animateShow() { if ((mEnableHeadsUpNotificationWhenNotificationShadeOpen if (mCarDeviceProvisionedController.isCurrentUserFullySetup() || !mNotificationPanelViewControllerLazy.get().isPanelExpanded()) && mOverlayViewGlobalStateController.shouldShowHUN()) { && mCarDeviceProvisionedController.isCurrentUserFullySetup()) { mWindow.setVisibility(View.VISIBLE); mWindow.setVisibility(View.VISIBLE); } } } } Loading
packages/CarSystemUI/src/com/android/systemui/car/notification/NotificationPanelViewController.java +15 −0 Original line number Original line Diff line number Diff line Loading @@ -73,6 +73,7 @@ public class NotificationPanelViewController extends OverlayPanelViewController private final CarNotificationListener mCarNotificationListener; private final CarNotificationListener mCarNotificationListener; private final NotificationClickHandlerFactory mNotificationClickHandlerFactory; private final NotificationClickHandlerFactory mNotificationClickHandlerFactory; private final StatusBarStateController mStatusBarStateController; private final StatusBarStateController mStatusBarStateController; private final boolean mEnableHeadsUpNotificationWhenNotificationShadeOpen; private float mInitialBackgroundAlpha; private float mInitialBackgroundAlpha; private float mBackgroundAlphaDiff; private float mBackgroundAlphaDiff; Loading Loading @@ -144,6 +145,10 @@ public class NotificationPanelViewController extends OverlayPanelViewController + " percentage"); + " percentage"); } } mBackgroundAlphaDiff = finalBackgroundAlpha - mInitialBackgroundAlpha; mBackgroundAlphaDiff = finalBackgroundAlpha - mInitialBackgroundAlpha; mEnableHeadsUpNotificationWhenNotificationShadeOpen = mResources.getBoolean( com.android.car.notification.R.bool .config_enableHeadsUpNotificationWhenNotificationShadeOpen); } } @Override @Override Loading @@ -151,6 +156,16 @@ public class NotificationPanelViewController extends OverlayPanelViewController reinflate(); reinflate(); } } @Override protected boolean shouldShowNavigationBar() { return true; } @Override protected boolean shouldShowHUN() { return mEnableHeadsUpNotificationWhenNotificationShadeOpen; } /** Reinflates the view. */ /** Reinflates the view. */ public void reinflate() { public void reinflate() { ViewGroup container = (ViewGroup) getLayout(); ViewGroup container = (ViewGroup) getLayout(); Loading
packages/CarSystemUI/src/com/android/systemui/car/window/OverlayPanelViewController.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -375,10 +375,10 @@ public abstract class OverlayPanelViewController extends OverlayViewController { } } if (visible && !getOverlayViewGlobalStateController().isWindowVisible()) { if (visible && !getOverlayViewGlobalStateController().isWindowVisible()) { getOverlayViewGlobalStateController().setWindowVisible(true); getOverlayViewGlobalStateController().showView(/* panelViewController= */ this); } } if (!visible && getOverlayViewGlobalStateController().isWindowVisible()) { if (!visible && getOverlayViewGlobalStateController().isWindowVisible()) { getOverlayViewGlobalStateController().setWindowVisible(false); getOverlayViewGlobalStateController().hideView(/* panelViewController= */ this); } } getLayout().setVisibility(visible ? View.VISIBLE : View.INVISIBLE); getLayout().setVisibility(visible ? View.VISIBLE : View.INVISIBLE); getOverlayViewGlobalStateController().setWindowFocusable(visible); getOverlayViewGlobalStateController().setWindowFocusable(visible); Loading
packages/CarSystemUI/src/com/android/systemui/car/window/OverlayViewController.java +15 −2 Original line number Original line Diff line number Diff line Loading @@ -54,7 +54,6 @@ public class OverlayViewController { mOverlayViewGlobalStateController.hideView(/* viewController= */ this, this::hide); mOverlayViewGlobalStateController.hideView(/* viewController= */ this, this::hide); } } /** /** * Inflate layout owned by controller. * Inflate layout owned by controller. */ */ Loading @@ -72,7 +71,7 @@ public class OverlayViewController { } } /** /** * Returns [@code true} if layout owned by controller has been inflated. * Returns {@code true} if layout owned by controller has been inflated. */ */ public final boolean isInflated() { public final boolean isInflated() { return mLayout != null; return mLayout != null; Loading Loading @@ -125,4 +124,18 @@ public class OverlayViewController { protected final OverlayViewGlobalStateController getOverlayViewGlobalStateController() { protected final OverlayViewGlobalStateController getOverlayViewGlobalStateController() { return mOverlayViewGlobalStateController; return mOverlayViewGlobalStateController; } } /** * Returns {@code true} if heads up notifications should be displayed over this view. */ protected boolean shouldShowHUN() { return true; } /** * Returns {@code true} if navigation bar should be displayed over this view. */ protected boolean shouldShowNavigationBar() { return false; } } }