Create a dummy notification shade window controller
Bug: 154763636
Test: manual (make sure DummyNotificationShadeWindowController is used.
This should avoid certain method calls in BiometricUnlockController
which reference phone sysui views)
Change-Id: Ib13e20a4d4cc136904f54ffc3fc16aea050552da
diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
index f066bf5..ab7bf5e 100644
--- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
+++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java
@@ -27,6 +27,7 @@
import com.android.systemui.car.keyguard.CarKeyguardViewController;
import com.android.systemui.car.statusbar.CarStatusBar;
import com.android.systemui.car.statusbar.CarStatusBarKeyguardViewManager;
+import com.android.systemui.car.statusbar.DummyNotificationShadeWindowController;
import com.android.systemui.car.volume.CarVolumeDialogComponent;
import com.android.systemui.dagger.SystemUIRootComponent;
import com.android.systemui.dock.DockManager;
@@ -47,6 +48,7 @@
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.ShadeControllerImpl;
import com.android.systemui.statusbar.phone.StatusBar;
@@ -156,4 +158,8 @@
@Binds
abstract CarDeviceProvisionedController bindCarDeviceProvisionedController(
CarDeviceProvisionedControllerImpl deviceProvisionedController);
+
+ @Binds
+ abstract NotificationShadeWindowController bindNotificationShadeWindowController(
+ DummyNotificationShadeWindowController notificationShadeWindowController);
}
diff --git a/packages/CarSystemUI/src/com/android/systemui/car/statusbar/DummyNotificationShadeWindowController.java b/packages/CarSystemUI/src/com/android/systemui/car/statusbar/DummyNotificationShadeWindowController.java
new file mode 100644
index 0000000..a423003
--- /dev/null
+++ b/packages/CarSystemUI/src/com/android/systemui/car/statusbar/DummyNotificationShadeWindowController.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.car.statusbar;
+
+import android.app.IActivityManager;
+import android.content.Context;
+import android.view.WindowManager;
+
+import com.android.systemui.car.window.SystemUIOverlayWindowController;
+import com.android.systemui.colorextraction.SysuiColorExtractor;
+import com.android.systemui.dump.DumpManager;
+import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.statusbar.phone.BiometricUnlockController;
+import com.android.systemui.statusbar.phone.DozeParameters;
+import com.android.systemui.statusbar.phone.KeyguardBypassController;
+import com.android.systemui.statusbar.phone.NotificationShadeWindowController;
+import com.android.systemui.statusbar.policy.ConfigurationController;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+/**
+ * A dummy implementation of {@link NotificationShadeWindowController}.
+ *
+ * TODO(b/155711562): This should be replaced with a longer term solution (i.e. separating
+ * {@link BiometricUnlockController} from the views it depends on).
+ */
+@Singleton
+public class DummyNotificationShadeWindowController extends NotificationShadeWindowController {
+ private final SystemUIOverlayWindowController mOverlayWindowController;
+
+ @Inject
+ public DummyNotificationShadeWindowController(Context context,
+ WindowManager windowManager, IActivityManager activityManager,
+ DozeParameters dozeParameters,
+ StatusBarStateController statusBarStateController,
+ ConfigurationController configurationController,
+ KeyguardBypassController keyguardBypassController,
+ SysuiColorExtractor colorExtractor,
+ DumpManager dumpManager,
+ SystemUIOverlayWindowController overlayWindowController) {
+ super(context, windowManager, activityManager, dozeParameters, statusBarStateController,
+ configurationController, keyguardBypassController, colorExtractor, dumpManager);
+ mOverlayWindowController = overlayWindowController;
+ }
+
+ @Override
+ public void setForceDozeBrightness(boolean forceDozeBrightness) {
+ // No op.
+ }
+
+ @Override
+ public void setNotificationShadeFocusable(boolean focusable) {
+ // The overlay window is the car sysui equivalent of the notification shade.
+ mOverlayWindowController.setWindowFocusable(focusable);
+ }
+}