1 /*
2  * Copyright (C) 2022 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.systemui.biometrics.udfps
18 
19 import android.view.MotionEvent
20 import com.android.systemui.biometrics.shared.model.UdfpsOverlayParams
21 
22 /**
23  * Determines whether a finger entered or left the area of the under-display fingerprint sensor
24  * (UDFPS). Maps the touch information from a [MotionEvent] to the orientation and scale independent
25  * [NormalizedTouchData].
26  */
27 interface TouchProcessor {
28 
29     /**
30      * [event] touch event to be processed.
31      *
32      * [previousPointerOnSensorId] pointerId for the finger that was on the sensor prior to this
33      * event. See [MotionEvent.getPointerId]. If there was no finger on the sensor, this should be
34      * set to [MotionEvent.INVALID_POINTER_ID].
35      *
36      * [overlayParams] contains the location and dimensions of the sensor area, as well as the scale
37      * factor and orientation of the overlay. See [UdfpsOverlayParams].
38      *
39      * Returns [TouchProcessorResult.ProcessedTouch] on success, and [TouchProcessorResult.Failure]
40      * on failure.
41      */
processTouchnull42     fun processTouch(
43         event: MotionEvent,
44         previousPointerOnSensorId: Int,
45         overlayParams: UdfpsOverlayParams,
46     ): TouchProcessorResult
47 }
48