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

Commit c9827471 authored by Ivailo Karamanolev's avatar Ivailo Karamanolev Committed by Android (Google) Code Review
Browse files

Merge "Add AIDL Lights HAL to support multiple lights per type"

parents a207171b bb89a958
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -289,6 +289,13 @@
            <instance>default</instance>
        </interface>
    </hal>
    <hal format="aidl" optional="true">
        <name>android.hardware.light</name>
        <interface>
            <name>ILights</name>
            <instance>default</instance>
        </interface>
    </hal>
    <hal format="hidl" optional="true">
        <name>android.hardware.media.c2</name>
        <version>1.0-1</version>

light/aidl/Android.bp

0 → 100644
+18 −0
Original line number Diff line number Diff line
aidl_interface {
    name: "android.hardware.light",
    vendor_available: true,
    srcs: [
        "android/hardware/light/*.aidl",
    ],
    stability: "vintf",
    backend: {
        java: {
            platform_apis: true,
        },
        ndk: {
            vndk: {
                enabled: true,
            },
        },
    },
}
+58 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.light;

@VintfStability
enum BrightnessMode {
    /**
     * Light brightness is managed by a user setting.
     */
    USER = 0,

    /**
     * Light brightness is managed by a light sensor. This is typically used
     * to control the display backlight, but not limited to it. HALs and
     * hardware implementations are free to support sensor for other lights or
     * none whatsoever.
     */
    SENSOR = 1,

    /**
     * Use a low-persistence mode for display backlights, where the pixel
     * color transition times are lowered.
     *
     * When set, the device driver must switch to a mode optimized for low display
     * persistence that is intended to be used when the device is being treated as a
     * head mounted display (HMD). The actual display brightness in this mode is
     * implementation dependent, and any value set for color in LightState may be
     * overridden by the HAL implementation.
     *
     * For an optimal HMD viewing experience, the display must meet the following
     * criteria in this mode:
     * - Gray-to-Gray, White-to-Black, and Black-to-White switching time must be ≤ 3 ms.
     * - The display must support low-persistence with ≤ 3.5 ms persistence.
     *   Persistence is defined as the amount of time for which a pixel is
     *   emitting light for a single frame.
     * - Any "smart panel" or other frame buffering options that increase display
     *   latency are disabled.
     * - Display brightness is set so that the display is still visible to the user
     *   under normal indoor lighting.
     * - The display must update at 60 Hz at least, but higher refresh rates are
     *   recommended for low latency.
     *
     */
    LOW_PERSISTENCE = 2,
}
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.light;

@VintfStability
enum FlashMode {
    /**
     * Keep the light steady on or off.
     */
    NONE = 0,
    /**
     * Flash the light at specified rate, potentially using a software-based
     * implementation.
     */
    TIMED = 1,
    /**
     * Flash the light using hardware flashing support. This may or may not
     * support a user-defined flashing rate or other features.
     */
    HARDWARE = 2,
}
+42 −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.light;

import android.hardware.light.LightType;

/**
 * A description of a single light. Multiple lights can map to the same physical
 * LED. Separate physical LEDs are always represented by separate instances.
 */
@VintfStability
parcelable HwLight {
    /**
     * Integer ID used for controlling this light
     */
    int id;

    /**
     * For a group of lights of the same logical type, sorting by ordinal should
     * be give their physical order. No other meaning is carried by it.
     */
    int ordinal;

    /**
     * Logical type use of this light.
     */
    LightType type;
}
Loading