Add wake reason to OperationContext.

This additional metadata can optionally be used by the HAL to make optimizations when an operation is started.

Bug: 246363169
Test: N/A (builds)
Change-Id: I493cba04f54d09f976b31a68661a18397af02ce9
This commit is contained in:
Joe Bolinger
2023-02-01 01:34:19 +00:00
parent 6a330bf2ef
commit f3661ff85c
7 changed files with 149 additions and 6 deletions

View File

@@ -39,4 +39,5 @@ parcelable OperationContext {
android.hardware.biometrics.common.OperationReason reason = android.hardware.biometrics.common.OperationReason.UNKNOWN;
boolean isAod = false;
boolean isCrypto = false;
android.hardware.biometrics.common.WakeReason wakeReason = android.hardware.biometrics.common.WakeReason.UNKNOWN;
}

View File

@@ -35,7 +35,7 @@ package android.hardware.biometrics.common;
/* @hide */
@Backing(type="byte") @VintfStability
enum OperationReason {
UNKNOWN = 0,
BIOMETRIC_PROMPT = 1,
KEYGUARD = 2,
UNKNOWN,
BIOMETRIC_PROMPT,
KEYGUARD,
}

View File

@@ -35,7 +35,7 @@ package android.hardware.biometrics.common;
/* @hide */
@Backing(type="byte") @VintfStability
enum SensorStrength {
CONVENIENCE = 0,
WEAK = 1,
STRONG = 2,
CONVENIENCE,
WEAK,
STRONG,
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2023 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.
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.biometrics.common;
/* @hide */
@Backing(type="int") @VintfStability
enum WakeReason {
UNKNOWN,
POWER_BUTTON,
GESTURE,
WAKE_KEY,
WAKE_MOTION,
LID,
DISPLAY_GROUP_ADDED,
TAP,
LIFT,
BIOMETRIC,
}

View File

@@ -17,6 +17,7 @@
package android.hardware.biometrics.common;
import android.hardware.biometrics.common.OperationReason;
import android.hardware.biometrics.common.WakeReason;
/**
* Additional context associated with an operation.
@@ -47,4 +48,14 @@ parcelable OperationContext {
/** Flag indicating that crypto was requested. */
boolean isCrypto = false;
/**
* An associated wake reason for this operation or WakeReason.UNKNOWN if this
* operation was not associated with a device wake up event.
*
* This should be interpreted as a hint to enable optimizations or tracing. The
* framework may choose to use WakeReason.UNKNOWN at any time based on the device's
* policy.
*/
WakeReason wakeReason = WakeReason.UNKNOWN;
}

View File

@@ -15,7 +15,9 @@
*/
package android.hardware.biometrics.common;
/**
* The reason for invoking an operation.
* @hide
*/
@VintfStability

View File

@@ -0,0 +1,81 @@
/*
* Copyright (C) 2023 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 android.hardware.biometrics.common;
/**
* The wake event associated with an operation, if applicable.
*
* The events largely shadow constants defined in PowerManager but they may deviate over time.
* @hide
*/
@VintfStability
@Backing(type="int")
enum WakeReason {
/**
* A normal operation without an explicit reason.
*/
UNKNOWN,
/**
* Waking up due to power button press.
*/
POWER_BUTTON,
/**
* Waking up due to a user performed gesture. This includes user
* interactions with UI on the screen such as the notification shade. This does not include
* WakeReason.TAP or WakeReason.LIFT.
*/
GESTURE,
/**
* Waking up because a wake key other than power was pressed.
*/
WAKE_KEY,
/**
* Waking up because a wake motion was performed.
*/
WAKE_MOTION,
/**
* Waking due to the lid being opened.
*/
LID,
/**
* Waking due to display group being added.
*/
DISPLAY_GROUP_ADDED,
/**
* Waking up due to the user single or double tapping on the screen. This
* wake reason is used when the user is not tapping on a specific UI element; rather, the device
* wakes up due to a generic tap on the screen.
*/
TAP,
/**
* Waking up due to a user performed lift gesture.
*/
LIFT,
/**
* Waking up due to a user interacting with a biometric.
*/
BIOMETRIC,
}