Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa5de702 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[Central Surfaces] Make AuthRipple(view&controller) a singleton.

Bug: 277762009
Test: compiles
Test: auth ripple still works on various devices
Test: atest AuthRippleControllerTest CentralSurfacesImplTest
Change-Id: I24021161cfa49675a8856d9d4c0ea3ae464ef872
parent 08c87d50
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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<AuthRippleView>(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)
+21 −0
Original line number Diff line number Diff line
@@ -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)
        }
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -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<LockscreenWallpaper> lockscreenWallpaperLazy,
            Lazy<BiometricUnlockController> 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());

+0 −5
Original line number Diff line number Diff line
@@ -121,11 +121,6 @@ public interface CentralSurfacesComponent {
     */
    LockIconViewController getLockIconViewController();

    /**
     * Creates an AuthRippleViewController. Must be init after creation.
     */
    AuthRippleController getAuthRippleController();

    /**
     * Creates a StatusBarHeadsUpChangeListener.
     */
+0 −10
Original line number Diff line number Diff line
@@ -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)
Loading