diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleController.kt b/packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleController.kt index 289398f695e60..d0ac2968ae8e2 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleController.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthRippleController.kt @@ -30,8 +30,10 @@ import com.android.keyguard.KeyguardUpdateMonitorCallback import com.android.keyguard.logging.KeyguardLogger import com.android.settingslib.Utils import com.android.settingslib.udfps.UdfpsOverlayParams +import com.android.systemui.CoreStartable import com.android.systemui.R import com.android.systemui.animation.Interpolators +import com.android.systemui.dagger.SysUISingleton import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags import com.android.systemui.keyguard.WakefulnessLifecycle @@ -45,7 +47,6 @@ import com.android.systemui.statusbar.NotificationShadeWindowController import com.android.systemui.statusbar.commandline.Command import com.android.systemui.statusbar.commandline.CommandRegistry import com.android.systemui.statusbar.phone.BiometricUnlockController -import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent.CentralSurfacesScope import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.ViewController @@ -61,7 +62,7 @@ import javax.inject.Provider * * The ripple uses the accent color of the current theme. */ -@CentralSurfacesScope +@SysUISingleton class AuthRippleController @Inject constructor( private val sysuiContext: Context, private val authController: AuthController, @@ -81,6 +82,7 @@ class AuthRippleController @Inject constructor( rippleView: AuthRippleView? ) : ViewController(rippleView), + CoreStartable, KeyguardStateController.Callback, WakefulnessLifecycle.Observer { @@ -94,6 +96,10 @@ class AuthRippleController @Inject constructor( private var udfpsController: UdfpsController? = null private var udfpsRadius: Float = -1f + override fun start() { + init() + } + @VisibleForTesting public override fun onViewAttached() { authController.addCallback(authControllerCallback) diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt index a1fecf411e780..4c6673cca4735 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt @@ -17,16 +17,28 @@ package com.android.systemui.shade import android.view.LayoutInflater +import com.android.systemui.CoreStartable import com.android.systemui.R +import com.android.systemui.biometrics.AuthRippleController +import com.android.systemui.biometrics.AuthRippleView import com.android.systemui.dagger.SysUISingleton import com.android.systemui.statusbar.LightRevealScrim import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout +import dagger.Binds import dagger.Module import dagger.Provides +import dagger.multibindings.ClassKey +import dagger.multibindings.IntoMap /** Module for classes related to the notification shade. */ @Module abstract class ShadeModule { + + @Binds + @IntoMap + @ClassKey(AuthRippleController::class) + abstract fun bindAuthRippleController(controller: AuthRippleController): CoreStartable + companion object { @Provides @SysUISingleton @@ -68,5 +80,14 @@ abstract class ShadeModule { ): LightRevealScrim { return notificationShadeWindowView.findViewById(R.id.light_reveal_scrim) } + + // TODO(b/277762009): Only allow this view's controller to inject the view. See above. + @Provides + @SysUISingleton + fun providesAuthRippleView( + notificationShadeWindowView: NotificationShadeWindowView, + ): AuthRippleView? { + return notificationShadeWindowView.findViewById(R.id.auth_ripple) + } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 48f647121fe4c..5654772695ffd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -452,7 +452,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { protected PhoneStatusBarView mStatusBarView; private PhoneStatusBarViewController mPhoneStatusBarViewController; private PhoneStatusBarTransitions mStatusBarTransitions; - private AuthRippleController mAuthRippleController; + private final AuthRippleController mAuthRippleController; @WindowVisibleState private int mStatusBarWindowState = WINDOW_STATE_SHOWING; protected final NotificationShadeWindowController mNotificationShadeWindowController; private final StatusBarInitializer mStatusBarInitializer; @@ -768,6 +768,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { ScrimController scrimController, Lazy lockscreenWallpaperLazy, Lazy biometricUnlockControllerLazy, + AuthRippleController authRippleController, DozeServiceHost dozeServiceHost, PowerManager powerManager, ScreenPinningRequest screenPinningRequest, @@ -867,6 +868,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mScreenPinningRequest = screenPinningRequest; mDozeScrimController = dozeScrimController; mBiometricUnlockControllerLazy = biometricUnlockControllerLazy; + mAuthRippleController = authRippleController; mNotificationShadeDepthControllerLazy = notificationShadeDepthControllerLazy; mVolumeComponent = volumeComponent; mCommandQueue = commandQueue; @@ -1667,8 +1669,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mPresenter = mCentralSurfacesComponent.getNotificationPresenter(); mNotificationActivityStarter = mCentralSurfacesComponent.getNotificationActivityStarter(); mNotificationShelfController = mCentralSurfacesComponent.getNotificationShelfController(); - mAuthRippleController = mCentralSurfacesComponent.getAuthRippleController(); - mAuthRippleController.init(); mHeadsUpManager.addListener(mCentralSurfacesComponent.getStatusBarHeadsUpChangeListener()); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/CentralSurfacesComponent.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/CentralSurfacesComponent.java index d80e1d3c9f11d..b16d16a01df8e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/CentralSurfacesComponent.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/CentralSurfacesComponent.java @@ -121,11 +121,6 @@ public interface CentralSurfacesComponent { */ LockIconViewController getLockIconViewController(); - /** - * Creates an AuthRippleViewController. Must be init after creation. - */ - AuthRippleController getAuthRippleController(); - /** * Creates a StatusBarHeadsUpChangeListener. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java index 95d36b082b57b..4f74974e31132 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java @@ -29,7 +29,6 @@ import com.android.keyguard.LockIconView; import com.android.systemui.R; import com.android.systemui.battery.BatteryMeterView; import com.android.systemui.battery.BatteryMeterViewController; -import com.android.systemui.biometrics.AuthRippleView; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; @@ -146,15 +145,6 @@ public abstract class StatusBarViewModule { return notificationShadeWindowView.findViewById(R.id.lock_icon_view); } - /** */ - @Provides - @CentralSurfacesComponent.CentralSurfacesScope - @Nullable - public static AuthRippleView getAuthRippleView( - NotificationShadeWindowView notificationShadeWindowView) { - return notificationShadeWindowView.findViewById(R.id.auth_ripple); - } - /** */ @Provides @Named(SHADE_HEADER) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java index 9de69b042781b..c83769d84d2ad 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java @@ -101,6 +101,7 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.accessibility.floatingmenu.AccessibilityFloatingMenuController; import com.android.systemui.animation.ActivityLaunchAnimator; import com.android.systemui.assist.AssistManager; +import com.android.systemui.biometrics.AuthRippleController; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.charging.WiredChargingRippleController; import com.android.systemui.classifier.FalsingCollectorFake; @@ -237,6 +238,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase { @Mock private DozeScrimController mDozeScrimController; @Mock private Lazy mBiometricUnlockControllerLazy; @Mock private BiometricUnlockController mBiometricUnlockController; + @Mock private AuthRippleController mAuthRippleController; @Mock private NotificationListener mNotificationListener; @Mock private KeyguardViewMediator mKeyguardViewMediator; @Mock private NotificationLockscreenUserManager mLockscreenUserManager; @@ -500,6 +502,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase { mScrimController, mLockscreenWallpaperLazy, mBiometricUnlockControllerLazy, + mAuthRippleController, mDozeServiceHost, mPowerManager, mScreenPinningRequest, mDozeScrimController,