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

Commit 2013f50c authored by Peter Kalauskas's avatar Peter Kalauskas Committed by Android (Google) Code Review
Browse files

Merge "Cancel coroutine job before replacing BiometricContextListener" into main

parents 9daad48c e8ebac7e
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ import javax.inject.Inject;
import javax.inject.Provider;

import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.Job;

/**
 * Receives messages sent from {@link com.android.server.biometrics.BiometricService} and shows the
@@ -136,6 +137,7 @@ public class AuthController implements
    private final Provider<UdfpsController> mUdfpsControllerFactory;
    private final Provider<SideFpsController> mSidefpsControllerFactory;
    private final CoroutineScope mApplicationCoroutineScope;
    private Job mBiometricContextListenerJob = null;

    // TODO: these should be migrated out once ready
    @NonNull private final Provider<PromptCredentialInteractor> mPromptCredentialInteractor;
@@ -914,6 +916,10 @@ public class AuthController implements

    @Override
    public void setBiometricContextListener(IBiometricContextListener listener) {
        if (mBiometricContextListenerJob != null) {
            mBiometricContextListenerJob.cancel(null);
        }
        mBiometricContextListenerJob =
                mLogContextInteractor.get().addBiometricContextListener(listener);
    }