Occupant Awareness HAL definitions.

Occupant awareness default HAL and VTS tests will be added as part of a
separate commit / CL.

Bug: 142383127
Test: Verified that system starts default hal.
Change-Id: I24e1c52c9873fc4e0fc09db24d0def9a04175120
This commit is contained in:
Kathan Shukla
2019-11-25 22:50:53 -08:00
parent f3b8f482be
commit 382ed1d65d
12 changed files with 550 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
aidl_interface {
name: "android.hardware.automotive.occupant_awareness",
vendor_available: true,
srcs: [
"android/hardware/automotive/occupant_awareness/*.aidl",
],
stability: "vintf",
backend: {
java: {
enabled: false,
},
}
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2019 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.automotive.occupant_awareness;
@VintfStability
@Backing(type="byte")
enum ConfidenceLevel {
/**
* No prediction could be made.
*/
NONE,
/**
* Best-guess, low-confidence prediction. Predictions exceeding this threshold are adequate
* for non-critical applications.
*/
LOW,
/**
* High-confidence prediction. Predictions exceeding this threshold are adequate for
* applications that require reliable predictions.
*/
HIGH,
/**
* Highest confidence rate achievable.
*/
MAX,
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (C) 2019 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.automotive.occupant_awareness;
import android.hardware.automotive.occupant_awareness.ConfidenceLevel;
@VintfStability
parcelable DriverMonitoringDetection {
/*
* Confidence of the computed attention data.
*/
ConfidenceLevel confidenceScore;
/*
* Is the driver currently looking on-road?
*/
boolean isLookingOnRoad;
/*
* Duration the driver has been looking on or off road, in milliseconds.
*/
long gazeDurationMillis;
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) 2019 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.automotive.occupant_awareness;
import android.hardware.automotive.occupant_awareness.VehicleRegion;
import android.hardware.automotive.occupant_awareness.ConfidenceLevel;
@VintfStability
parcelable GazeDetection {
/*
* Confidence level for the gaze detection.
*/
ConfidenceLevel gazeConfidence;
/*
* Head position, in millimeters. The vehicle coordinate system is specified in the cabin space
* configuration. headPosition is double[3] array.
*/
double[] headPosition;
/*
* Unit vector for the head pose direction. The vehicle coordinate system is specified in the
* cabin space configuration. headAngleUnitVector is double[3] array.
*/
double[] headAngleUnitVector;
/*
* Unit vector for the gaze direction. The vehicle coordinate system is specified in the cabin
* space configuration. gazeAngleUnitVector is double[3] array.
*/
double[] gazeAngleUnitVector;
/*
* Current gaze target.
*/
VehicleRegion gazeTarget;
/*
* Custom gaze target string. This only need to be populated when gazeTarget is CUSTOM_TARGET.
* Vendors should use "com.vendor_name.target_name" format to avoid name collision with other
* vendors.
*/
String customGazeTarget;
/*
* Duration that the subject has been looking at the current gaze target in milliseconds.
*/
long timeOnTargetMillis;
}

View File

@@ -0,0 +1,88 @@
/*
* Copyright (C) 2019 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.automotive.occupant_awareness;
import android.hardware.automotive.occupant_awareness.OccupantAwarenessStatus;
import android.hardware.automotive.occupant_awareness.Role;
import android.hardware.automotive.occupant_awareness.IOccupantAwarenessClientCallback;
import android.hardware.automotive.occupant_awareness.OccupantDetections;
@VintfStability
interface IOccupantAwareness {
/*
* System not able to generate any occupancy awareness.
*/
const int CAP_NONE = 0;
/*
* System is able to detect the presence of humans.
*/
const int CAP_PRESENSE_DETECTION = 1 << 0;
/*
* System is able to detect the gaze of humans.
*/
const int CAP_GAZE_DETECTION = 1 << 1;
/*
* System is able to compute the attention details of humans.
*/
const int CAP_DRIVER_MONITORING_DETECTION = 1 << 2;
/**
* Starts the occupant awareness detection system. This is a non-blocking function call.
* Once system is ready, state will be modified. State update can be inrquired using callback
* or getState() function.
* @return status is the current system state.
*/
OccupantAwarenessStatus startDetection();
/**
* Stops the occupant awareness detection system. This is a non-blocking function call.
* Once system is reset, state will be modified. State update can be inrquired using callback
* or getState() function.
* @return status is the current system state.
*/
OccupantAwarenessStatus stopDetection();
/**
* Returns list of Awareness Capability supported for the given type of occupants.
*
* @param out Bitwise OR of supported capabilities (CAP_* mask).
*/
int getCapabilityForRole(in Role occupantRole);
/**
* Inquires the current state of the occupant awareness system.
* @param occupantRole specifies the role of occupants of interest.
* @param detectionCapability specifies a single detection capability (CAP_* ) of interest.
*
* @return status is the current system state.
*/
OccupantAwarenessStatus getState(in Role occupantRole, in int detectionCapability);
/**
* Registers a callback for data streaming. Only single callback is supported. setCallback()
* should replace existing callback with new callback.
* @return: returns ok if successful.
*/
void setCallback(in IOccupantAwarenessClientCallback callback);
/**
* Returns the most recent set of detections.
* @param OccupantDetections output detections.
* @return returns ok if successful.
*/
void getLatestDetection(out OccupantDetections detections);
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2019 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.automotive.occupant_awareness;
import android.hardware.automotive.occupant_awareness.OccupantAwarenessStatus;
import android.hardware.automotive.occupant_awareness.OccupantDetections;
@VintfStability
interface IOccupantAwarenessClientCallback {
/**
* A callback invoked when the system status changes.
*
* @param detectionFlags The detection subsystem(s) whose status has changed.
* @param status The new system status.
*/
oneway void onSystemStatusChanged(in int detectionFlags, in OccupantAwarenessStatus status);
/**
* A callback invoked when a new set of detections are available.
*
* @param detections Occupant detections.
*/
oneway void onDetectionEvent(in OccupantDetections detections);
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (C) 2019 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.automotive.occupant_awareness;
@VintfStability
@Backing(type="byte")
enum OccupantAwarenessStatus {
/*
* System is online and ready to serve requests.
*/
READY = 0,
/**
* Detection is not supported in this vehicle due to a permanent lack of capabilities. Clients
* need not retry.
*/
NOT_SUPPORTED = 1,
/*
* The system has not yet been initialized. No requests can be served until the
* initialization process completes. This state does not indicate any error and
* clients should retry later.
*/
NOT_INITIALIZED = 2,
/*
* A permanent failure has occurred. No detections will be provided.
*/
FAILURE = 3,
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (C) 2019 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.automotive.occupant_awareness;
import android.hardware.automotive.occupant_awareness.Role;
import android.hardware.automotive.occupant_awareness.PresenceDetection;
import android.hardware.automotive.occupant_awareness.GazeDetection;
import android.hardware.automotive.occupant_awareness.DriverMonitoringDetection;
/*
* A complete detection for a single occupant in the vehicle. Includes data about the subject's
* presence in the vehicle, gaze and attention.
*/
@VintfStability
parcelable OccupantDetection {
/*
* Role of the occupant (e.g., driver, passenger).
*/
Role role;
/*
* Occupant presence state for a single occupant.
* If the vector is empty, no data could be generated.
*/
PresenceDetection[] presenceData;
/*
* Gaze data for a single occupant.
* If the vector is empty, no data could be generated.
*/
GazeDetection[] gazeData;
/*
* Attention data for a single occupant.
* If the vector is empty, no data could be generated.
*/
DriverMonitoringDetection[] attentionData;
}

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) 2019 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.automotive.occupant_awareness;
import android.hardware.automotive.occupant_awareness.OccupantDetection;
@VintfStability
parcelable OccupantDetections {
/**
* Timestamp that the underlying source image was captured, in milliseconds since Jan 1, 1970
* (Unix time).
*/
long timeStampMillis;
/**
* A vector of detections for all occupants in the vehicle. One OccupantDetection will be
* generated per detected face.
*/
OccupantDetection[] detections;
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 2019 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.automotive.occupant_awareness;
@VintfStability
parcelable PresenceDetection {
/*
* Boolean representing whether an occupant was detected.
*/
boolean isOccupantDetected;
/**
* Duration that a particular occupant has been continuously
* detected, in milliseconds. Will be zero duration if the occupant is not
* currently detected.
*/
long detectionDurationMillis;
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright (C) 2019 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.automotive.occupant_awareness;
@VintfStability
@Backing(type="int")
enum Role {
/*
* All valid role(s) must have at least 1 bit set.
*/
INVALID = 0,
/*
* System could not determine role for this occupant.
*/
UNKNOWN = 1 << 0,
/*
* Occupants that the system detects as front seat passengers.
*/
FRONT_PASSENGER = 1 << 1,
/*
* Occupants that the system detects as driver(s).
*/
DRIVER = 1 << 2,
/*
* Occupants on left seat of row 2.
*/
ROW_2_PASSENGER_LEFT = 1 << 3,
/*
* Occupants on center seat of row 2.
*/
ROW_2_PASSENGER_CENTER = 1 << 4,
/*
* Occupants on right seat of row 2.
*/
ROW_2_PASSENGER_RIGHT = 1 << 5,
/*
* Occupants on left seat of row 3.
*/
ROW_3_PASSENGER_LEFT = 1 << 6,
/*
* Occupants on center seat of row 3.
*/
ROW_3_PASSENGER_CENTER = 1 << 7,
/*
* Occupants on right seat of row 3.
*/
ROW_3_PASSENGER_RIGHT = 1 << 8,
/*
* Occupants that the system detects as front seat occupant.
* FRONT_OCCUPANTS = DRIVER | FRONT_PASSENGER
*/
FRONT_OCCUPANTS = 1 << 1 | 1 << 2,
/*
* Occupants of row 2.
* ROW_2_OCCUPANTS = ROW_2_PASSENGER_LEFT | ROW_2_PASSENGER_CENTER | ROW_2_PASSENGER_RIGHT
*/
ROW_2_OCCUPANTS = 1 << 3 | 1 << 4 | 1 << 5,
/*
* Occupants of row 3.
* ROW_3_OCCUPANTS = ROW_3_PASSENGER_LEFT | ROW_3_PASSENGER_CENTER | ROW_3_PASSENGER_RIGHT
*/
ROW_3_OCCUPANTS = 1 << 6 | 1 << 7 | 1 << 8,
/*
* All the occupants in the vehicle.
* ALL_OCCUPANTS = UNKNOWN | FRONT_OCCUPANTS | ROW_2_OCCUPANTS | ROW_3_OCCUPANTS
*/
ALL_OCCUPANTS = 0x1FF,
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2019 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.automotive.occupant_awareness;
@VintfStability
@Backing(type="int")
enum VehicleRegion {
/*
* List of targets in the car.
*/
UNKNOWN = 0,
INSTRUMENT_CLUSTER = 1,
REAR_VIEW_MIRROR = 2,
LEFT_SIDE_MIRROR = 3,
RIGHT_SIDE_MIRROR = 4,
FORWARD_ROADWAY = 5,
LEFT_ROADWAY = 6,
RIGHT_ROADWAY = 7,
HEAD_UNIT_DISPLAY = 8,
/*
* Vendors can use this value along with customGazeTarget string to uniquely identify their
* custom region.
*/
CUSTOM_TARGET = 200,
}