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

Commit 384eb8a2 authored by Wei Wang's avatar Wei Wang Committed by Gerrit Code Review
Browse files

Merge "Power: PowerHAL AIDL interface"

parents ca61d1a3 61c2a337
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -331,9 +331,8 @@
            <instance>default</instance>
            <instance>default</instance>
        </interface>
        </interface>
    </hal>
    </hal>
    <hal format="hidl" optional="true">
    <hal format="aidl" optional="true">
        <name>android.hardware.power</name>
        <name>android.hardware.power</name>
        <version>1.0-3</version>
        <interface>
        <interface>
            <name>IPower</name>
            <name>IPower</name>
            <instance>default</instance>
            <instance>default</instance>

power/aidl/Android.bp

0 → 100644
+32 −0
Original line number Original line 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.

aidl_interface {
    name: "android.hardware.power",
    vendor_available: true,
    srcs: [
        "android/hardware/power/*.aidl",
    ],
    stability: "vintf",
    backend: {
        java: {
            platform_apis: true,
        },
        ndk: {
            vndk: {
                enabled: true,
            },
        },
    },
}
+55 −0
Original line number Original line 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.power;

@VintfStability
@Backing(type="int")
enum Boost {
    /**
     * This boost is set when user interacting with the device, for example,
     * touchscreen events are incoming. CPU and GPU load may be expected soon,
     * and it may be appropriate to raise speeds of CPU, memory bus etc.
     * Note that this is different from INTERACTIVE mode, which only indicates
     * that such interaction *may* occur, not that it is actively occurring.
     */
    INTERACTION,

    /**
     * Below hints are currently not sent in Android framework but OEM might choose to
     * implement for power/perf optimizations.
     */

    /**
     * This boost indicates that the device is interacting with ML accelerator.
     */
    ML_ACC,

    /**
     * This boost indicates that the device is setting up audio stream.
     */
    AUDIO_LAUNCH,

    /**
     * This boost indicates that camera is being launched.
     */
    CAMERA_LAUNCH,

    /**
     * This boost indicates that camera shot is being taken.
     */
    CAMERA_SHOT,
}
+72 −0
Original line number Original line 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.power;

import android.hardware.power.Boost;
import android.hardware.power.Mode;

@VintfStability
interface IPower {
    /**
     * setMode() is called to enable/disable specific hint mode, which
     * may result in adjustment of power/performance parameters of the
     * cpufreq governor and other controls on device side.
     *
     * A particular platform may choose to ignore any mode hint.
     *
     * @param type Mode which is to be enable/disable.
     * @param enabled true to enable, false to disable the mode.
     */
    oneway void setMode(in Mode type, in boolean enabled);

    /**
     * isModeSupported() is called to query if the given mode hint is
     * supported by vendor.
     *
     * @return true if the hint passed is supported on this platform.
     *         If false, setting the mode will have no effect.
     * @param type Mode to be queried
     */
    boolean isModeSupported(in Mode type);

   /**
     * setBoost() indicates the device may need to boost some resources, as the
     * the load is likely to increase before the kernel governors can react.
     * Depending on the boost, it may be appropriate to raise the frequencies of
     * CPU, GPU, memory subsystem, or stop CPU from going into deep sleep state.
     * A particular platform may choose to ignore this hint.
     *
     * @param type Boost type which is to be set with a timeout.
     * @param durationMs The expected duration of the user's interaction, if
     *        known, or 0 if the expected duration is unknown.
     *        a negative value indicates canceling previous boost.
     *        A given platform can choose to boost some time based on durationMs,
     *        and may also pick an appropriate timeout for 0 case.
     */
    oneway void setBoost(in Boost type, in int durationMs);

    /**
     * isBoostSupported() is called to query if the given boost hint is
     * supported by vendor. When returns false, set the boost will have
     * no effect on the platform.
     *
     * @return true if the hint passed is supported on this platform.
     *         If false, setting the boost will have no effect.
     * @param type Boost to be queried
     */
    boolean isBoostSupported(in Boost type);
}
+109 −0
Original line number Original line 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.power;

@VintfStability
@Backing(type="int")
enum Mode {
    /**
     * This mode indicates that the device is to allow wake up when the
     * screen is tapped twice.
     */
    DOUBLE_TAP_TO_WAKE,

    /**
     * This mode indidates Low power mode is activated or not. Low power
     * mode is intended to save battery at the cost of performance.
     */
    LOW_POWER,

    /**
     * This mode indidates Sustained Performance mode is activated or not.
     * Sustained performance mode is intended to provide a consistent level of
     * performance for a prolonged amount of time.
     */
    SUSTAINED_PERFORMANCE,

    /**
     * This mode indidates VR Mode is activated or not. VR mode is intended
     * to provide minimum guarantee for performance for the amount of time the
     * device can sustain it.
     */
    VR,

    /**
     * This mode indicates that an application has been launched.
     */
    LAUNCH,

    /**
     * This mode indicates that the device is about to enter a period of
     * expensive rendering.
     */
    EXPENSIVE_RENDERING,

    /**
     * This mode indicates that the device is about entering/leaving
     * interactive state. (that is, the system is awake and ready for
     * interaction, often with UI devices such as display and touchscreen
     * enabled) or non-interactive state (the
     * system appears asleep, display usually turned off). The
     * non-interactive state may be entered after a period of
     * inactivity in order to conserve battery power during
     * such inactive periods.
     *
     * Typical actions are to turn on or off devices and adjust
     * cpufreq parameters. This function may also call the
     * appropriate interfaces to allow the kernel to suspend the
     * system to low-power sleep state when entering non-interactive
     * state, and to disallow low-power suspend when the system is in
     * interactive state. When low-power suspend state is allowed, the
     * kernel may suspend the system whenever no wakelocks are held.
     */
    INTERACTIVE,


    /**
     * Below hints are currently not sent in Android framework but OEM might choose to
     * implement for power/perf optimizations.
     */

    /**
     * This mode indicates that low latency audio is active.
     */
    AUDIO_STREAMING_LOW_LATENCY,

    /**
     * This hint indicates that camera secure stream is being started.
     */
    CAMERA_STREAMING_SECURE,

    /**
     * This hint indicates that camera low resolution stream is being started.
     */
    CAMERA_STREAMING_LOW,

    /**
     * This hint indicates that camera mid resolution stream is being started.
     */
    CAMERA_STREAMING_MID,

    /**
     * This hint indicates that camera high resolution stream is being started.
     */
    CAMERA_STREAMING_HIGH,
}
Loading