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

Commit c028b49a authored by Joshua Mccloskey's avatar Joshua Mccloskey Committed by Automerger Merge Worker
Browse files

Merge "Destroy() client after onClientFinished." into sc-dev am: f5704ec2 am: dc05d601

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15536554

Change-Id: I8fc733829c05cdd6efba792a9dca14cba6bc348e
parents fc522e0e dc05d601
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -206,7 +206,6 @@ public abstract class BaseClientMonitor extends LoggableMonitor
            }
            mToken = null;
        }
        mListener = null;
    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -295,6 +295,7 @@ public class BiometricScheduler {
        @Override
        public void onClientFinished(@NonNull BaseClientMonitor clientMonitor, boolean success) {
            mHandler.post(() -> {
                clientMonitor.destroy();
                if (mCurrentOperation == null) {
                    Slog.e(getTag(), "[Finishing] " + clientMonitor
                            + " but current operation is null, success: " + success
+22 −0
Original line number Diff line number Diff line
@@ -348,6 +348,17 @@ public class BiometricSchedulerTest {
        verify((Interruptable) interruptableMonitor, never()).cancel();
    }

    @Test
    public void testClientDestroyed_afterFinish() {
        final HalClientMonitor.LazyDaemon<Object> nonNullDaemon = () -> mock(Object.class);
        final TestClientMonitor client =
                new TestClientMonitor(mContext, mToken, nonNullDaemon);
        mScheduler.scheduleClientMonitor(client);
        client.mCallback.onClientFinished(client, true /* success */);
        waitForIdle();
        assertTrue(client.wasDestroyed());
    }

    private BiometricSchedulerProto getDump(boolean clearSchedulerBuffer) throws Exception {
        return BiometricSchedulerProto.parseFrom(mScheduler.dumpProtoState(clearSchedulerBuffer));
    }
@@ -437,6 +448,7 @@ public class BiometricSchedulerTest {
    private static class TestClientMonitor extends HalClientMonitor<Object> {
        private boolean mUnableToStart;
        private boolean mStarted;
        private boolean mDestroyed;

        public TestClientMonitor(@NonNull Context context, @NonNull IBinder token,
                @NonNull LazyDaemon<Object> lazyDaemon) {
@@ -475,6 +487,11 @@ public class BiometricSchedulerTest {

        }

        @Override
        public void destroy() {
            mDestroyed = true;
        }

        public boolean wasUnableToStart() {
            return mUnableToStart;
        }
@@ -482,6 +499,11 @@ public class BiometricSchedulerTest {
        public boolean hasStarted() {
            return mStarted;
        }

        public boolean wasDestroyed() {
            return mDestroyed;
        }

    }

    private static void waitForIdle() {