1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.biometrics.sensors; 18 19 import android.annotation.NonNull; 20 21 /** 22 * Interface that {@link BaseClientMonitor} subclasses eligible for cancellation should implement. 23 */ 24 public interface Interruptable { 25 /** 26 * Requests to end the ClientMonitor's lifecycle. 27 */ cancel()28 void cancel(); 29 30 /** 31 * Notifies the client that it needs to finish before 32 * {@link BaseClientMonitor#start(ClientMonitorCallback)} was invoked. This usually happens 33 * if the client is still waiting in the pending queue and got notified that a subsequent 34 * operation is preempting it. 35 * 36 * This method must invoke 37 * {@link ClientMonitorCallback#onClientFinished(BaseClientMonitor, boolean)} on the 38 * given callback (with success). 39 * 40 * @param callback invoked when the operation is completed. 41 */ cancelWithoutStarting(@onNull ClientMonitorCallback callback)42 void cancelWithoutStarting(@NonNull ClientMonitorCallback callback); 43 } 44