From 16d740a9900ac86ee23ba4fe75e1fdc2969b18a4 Mon Sep 17 00:00:00 2001 From: Heemin Seog Date: Mon, 4 May 2020 23:43:27 -0700 Subject: [PATCH] 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 --- .../android/systemui/CarSystemUIModule.java | 6 ++ ...ummyNotificationShadeWindowController.java | 71 +++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 packages/CarSystemUI/src/com/android/systemui/car/statusbar/DummyNotificationShadeWindowController.java diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java index f066bf589b64a..ab7bf5e2eac0c 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.CarDeviceProvisionedControllerImpl; 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.HeadsUpManagerPhone; 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 @@ public abstract class CarSystemUIModule { @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 0000000000000..a4230032858e5 --- /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); + } +}