Merge "Issue scheduleWatchdog command on background thread" into udc-qpr-dev

This commit is contained in:
Jernej Virag
2023-07-07 17:14:19 +00:00
committed by Android (Google) Code Review
3 changed files with 22 additions and 10 deletions

View File

@@ -4543,13 +4543,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
* Cancels all operations in the scheduler if it is hung for 10 seconds.
*/
public void startBiometricWatchdog() {
if (mFaceManager != null && !isFaceAuthInteractorEnabled()) {
mLogger.scheduleWatchdog("face");
mFaceManager.scheduleWatchdog();
}
if (mFpm != null) {
mLogger.scheduleWatchdog("fingerprint");
mFpm.scheduleWatchdog();
}
final boolean isFaceAuthInteractorEnabled = isFaceAuthInteractorEnabled();
mBackgroundExecutor.execute(() -> {
Trace.beginSection("#startBiometricWatchdog");
if (mFaceManager != null && !isFaceAuthInteractorEnabled) {
mLogger.scheduleWatchdog("face");
mFaceManager.scheduleWatchdog();
}
if (mFpm != null) {
mLogger.scheduleWatchdog("fingerprint");
mFpm.scheduleWatchdog();
}
Trace.endSection();
});
}
}

View File

@@ -31,6 +31,7 @@ import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLoggin
import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.dump.DumpManager
import com.android.systemui.flags.FeatureFlags
@@ -126,6 +127,7 @@ constructor(
private val keyguardBypassController: KeyguardBypassController? = null,
@Application private val applicationScope: CoroutineScope,
@Main private val mainDispatcher: CoroutineDispatcher,
@Background private val backgroundDispatcher: CoroutineDispatcher,
private val sessionTracker: SessionTracker,
private val uiEventsLogger: UiEventLogger,
private val faceAuthLogger: FaceAuthenticationLogger,
@@ -228,8 +230,12 @@ constructor(
keyguardTransitionInteractor.anyStateToGoneTransition
.filter { it.transitionState == TransitionState.FINISHED }
.onEach {
faceAuthLogger.watchdogScheduled()
faceManager?.scheduleWatchdog()
// We deliberately want to run this in background because scheduleWatchdog does
// a Binder IPC.
withContext(backgroundDispatcher) {
faceAuthLogger.watchdogScheduled()
faceManager?.scheduleWatchdog()
}
}
.launchIn(applicationScope)
}

View File

@@ -228,6 +228,7 @@ class DeviceEntryFaceAuthRepositoryTest : SysuiTestCase() {
bypassControllerOverride,
testScope.backgroundScope,
testDispatcher,
testDispatcher,
sessionTracker,
uiEventLogger,
FaceAuthenticationLogger(logcatLogBuffer("DeviceEntryFaceAuthRepositoryLog")),