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

Commit 1c1efeea authored by Diya Bera's avatar Diya Bera Committed by Android (Google) Code Review
Browse files

Merge "Removed Interruptable interface."

parents e252fe80 64362b9d
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -38,8 +38,7 @@ import java.util.function.Supplier;
 * Abstract {@link HalClientMonitor} subclass that operations eligible/interested in acquisition
 * messages should extend.
 */
public abstract class AcquisitionClient<T> extends HalClientMonitor<T> implements Interruptable,
        ErrorConsumer {
public abstract class AcquisitionClient<T> extends HalClientMonitor<T> implements ErrorConsumer {

    private static final String TAG = "Biometrics/AcquisitionClient";

@@ -217,4 +216,9 @@ public abstract class AcquisitionClient<T> extends HalClientMonitor<T> implement
                    HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES);
        }
    }

    @Override
    public boolean isInterruptable() {
        return true;
    }
}
+10 −2
Original line number Diff line number Diff line
@@ -193,9 +193,9 @@ public abstract class BaseClientMonitor implements IBinder.DeathRecipient {
        }

        // If the current client dies we should cancel the current operation.
        if (this instanceof Interruptable) {
        if (this.isInterruptable()) {
            Slog.e(TAG, "Binder died, cancelling client");
            ((Interruptable) this).cancel();
            this.cancel();
        }
        mToken = null;
        if (clearListener) {
@@ -320,4 +320,12 @@ public abstract class BaseClientMonitor implements IBinder.DeathRecipient {
        }
        callback.onClientFinished(this, true /* success */);
    }

    /**
     * Checks if other client monitor can interrupt current client monitor
     * @return if current client can be interrupted
     */
    public boolean isInterruptable() {
        return false;
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ public class BiometricSchedulerOperation {

    /**
     * The operation is added to the list of pending operations, but a subsequent operation
     * has been added. This state only applies to {@link Interruptable} operations. When this
     * has been added. This state only applies to interruptable operations. When this
     * operation reaches the head of the queue, it will send ERROR_CANCELED and finish.
     */
    protected static final int STATE_WAITING_IN_QUEUE_CANCELING = 1;
@@ -347,9 +347,9 @@ public class BiometricSchedulerOperation {
        return mClientMonitor == clientMonitor;
    }

    /** If this operation is {@link Interruptable}. */
    /** If this operation is interruptable. */
    public boolean isInterruptable() {
        return mClientMonitor instanceof Interruptable;
        return mClientMonitor.isInterruptable();
    }

    private boolean isHalOperation() {
+0 −43
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.server.biometrics.sensors;

import android.annotation.NonNull;

/**
 * Interface that {@link BaseClientMonitor} subclasses eligible for cancellation should implement.
 */
public interface Interruptable {
    /**
     * Requests to end the ClientMonitor's lifecycle.
     */
    void cancel();

    /**
     * Notifies the client that it needs to finish before
     * {@link BaseClientMonitor#start(ClientMonitorCallback)} was invoked. This usually happens
     * if the client is still waiting in the pending queue and got notified that a subsequent
     * operation is preempting it.
     *
     * This method must invoke
     * {@link ClientMonitorCallback#onClientFinished(BaseClientMonitor, boolean)} on the
     * given callback (with success).
     *
     * @param callback invoked when the operation is completed.
     */
    void cancelWithoutStarting(@NonNull ClientMonitorCallback callback);
}
+1 −2
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ import com.android.server.biometrics.sensors.BaseClientMonitor;
import com.android.server.biometrics.sensors.BiometricScheduler;
import com.android.server.biometrics.sensors.EnumerateConsumer;
import com.android.server.biometrics.sensors.ErrorConsumer;
import com.android.server.biometrics.sensors.Interruptable;
import com.android.server.biometrics.sensors.LockoutCache;
import com.android.server.biometrics.sensors.LockoutConsumer;
import com.android.server.biometrics.sensors.LockoutResetDispatcher;
@@ -638,7 +637,7 @@ public class Sensor {

    public void onBinderDied() {
        final BaseClientMonitor client = mScheduler.getCurrentClient();
        if (client instanceof Interruptable) {
        if (client.isInterruptable()) {
            Slog.e(mTag, "Sending ERROR_HW_UNAVAILABLE for client: " + client);
            final ErrorConsumer errorConsumer = (ErrorConsumer) client;
            errorConsumer.onError(FaceManager.FACE_ERROR_HW_UNAVAILABLE,
Loading