Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef6d127e authored by Kathan Shukla's avatar Kathan Shukla Committed by Android (Google) Code Review
Browse files

Merge changes from topic "occupant_awareness@1.0"

* changes:
  Default hal for Occupant Awareness.
  Occupant Awareness HAL definitions.
parents e1410905 b6261cb2
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
aidl_interface {
    name: "android.hardware.automotive.occupant_awareness",
    vendor_available: true,
    srcs: [
        "android/hardware/automotive/occupant_awareness/*.aidl",
    ],
    stability: "vintf",
    backend: {
        java: {
            enabled: false,
        },
    }
}
+40 −0
Original line number Diff line number Diff line
/*
 * 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,
}
+36 −0
Original line number Diff line number Diff line
/*
 * 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;
}
+57 −0
Original line number Diff line number Diff line
/*
 * 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;
}
+88 −0
Original line number Diff line number Diff line
/*
 * 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);
}
Loading