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 
21 /** Contains all the possible returns types for [TouchProcessor.processTouch] */
22 sealed class TouchProcessorResult {
23 
24     /**
25      * [event] whether a finger entered or left the sensor area. See [InteractionEvent].
26      *
27      * [pointerOnSensorId] pointerId fof the finger that's currently on the sensor. See
28      * [MotionEvent.getPointerId]. If there is no finger on the sensor, the value is set to
29      * [MotionEvent.INVALID_POINTER_ID].
30      *
31      * [touchData] relevant data from the MotionEvent, mapped to natural orientation and native
32      * resolution. See [NormalizedTouchData].
33      */
34     data class ProcessedTouch(
35         val event: InteractionEvent,
36         val pointerOnSensorId: Int,
37         val touchData: NormalizedTouchData
38     ) : TouchProcessorResult()
39 
40     /** [reason] the reason for the failure. */
41     data class Failure(val reason: String = "") : TouchProcessorResult()
42 }
43