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

Commit 1384388f authored by Matt Buckley's avatar Matt Buckley
Browse files

Add sendHint method to the PowerHintSession API for load changes

Add a new sendHint(SessionHint hint) method to the PowerHintSession to
allow clients to inform the session about upcoming changes in load ahead
of time.

Bug: b/243973548
Test: atest VtsHalPowerTargetTest
Change-Id: I0a8af42d3b0ccd3bbb72287a9b91ffb13fccaf9c
parent 4e2f9e22
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -432,7 +432,7 @@
    </hal>
    <hal format="aidl" optional="false">
        <name>android.hardware.power</name>
        <version>2-3</version>
        <version>2-4</version>
        <interface>
            <name>IPower</name>
            <instance>default</instance>
+1 −0
Original line number Diff line number Diff line
@@ -39,4 +39,5 @@ interface IPowerHintSession {
  oneway void pause();
  oneway void resume();
  oneway void close();
  oneway void sendHint(android.hardware.power.SessionHint hint);
}
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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.power;
@Backing(type="int") @VintfStability
enum SessionHint {
  CPU_LOAD_UP = 0,
  CPU_LOAD_DOWN = 1,
  CPU_LOAD_RESET = 2,
  CPU_LOAD_RESUME = 3,
}
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.hardware.power;

import android.hardware.power.SessionHint;
import android.hardware.power.WorkDuration;

@VintfStability
@@ -56,4 +57,12 @@ oneway interface IPowerHintSession {
     * Close the session to release resources.
     */
    void close();

    /**
     * Gives information to the PowerHintSession about upcoming or unexpected
     * changes in load to supplement the normal updateTarget/reportActual cycle.
     *
     * @param hint The hint to provide to the PowerHintSession
     */
    void sendHint(SessionHint hint);
}
+46 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2022 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 SessionHint {
    /**
     * This hint indicates an increase in CPU workload intensity. It means that
     * this hint session needs extra CPU resources to meet the target duration.
     * This hint must be sent before reporting the actual duration to the session.
     */
    CPU_LOAD_UP = 0,
    /**
     * This hint indicates a decrease in CPU workload intensity. It means that
     * this hint session can reduce CPU resources and still meet the target duration.
     */
    CPU_LOAD_DOWN = 1,
    /*
     * This hint indicates an upcoming CPU workload that is completely changed and
     * unknown. It means that the hint session should reset CPU resources to a known
     * baseline to prepare for an arbitrary load, and must wake up if inactive.
     */
    CPU_LOAD_RESET = 2,
    /*
     * This hint indicates that the most recent CPU workload is resuming after a
     * period of inactivity. It means that the hint session should allocate similar
     * CPU resources to what was used previously, and must wake up if inactive.
     */
    CPU_LOAD_RESUME = 3,

}
Loading