Wei Wang | 0500341 | 2021-04-01 10:44:29 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.hardware.power; |
| 18 | |
Matt Buckley | 1384388 | 2022-09-15 22:32:56 +0000 | [diff] [blame] | 19 | import android.hardware.power.SessionHint; |
Wei Wang | 0500341 | 2021-04-01 10:44:29 -0700 | [diff] [blame] | 20 | import android.hardware.power.WorkDuration; |
| 21 | |
| 22 | @VintfStability |
Peiyong Lin | c785459 | 2022-10-13 00:10:31 +0000 | [diff] [blame] | 23 | interface IPowerHintSession { |
Wei Wang | 0500341 | 2021-04-01 10:44:29 -0700 | [diff] [blame] | 24 | /** |
| 25 | * Updates the desired duration of a previously-created thread group. |
| 26 | * |
| 27 | * See {@link IPowerHintSession#createHintSession} for more information on how |
| 28 | * the desired duration will be used. |
| 29 | * |
| 30 | * @param targetDurationNanos the new desired duration in nanoseconds |
| 31 | */ |
Peiyong Lin | c785459 | 2022-10-13 00:10:31 +0000 | [diff] [blame] | 32 | oneway void updateTargetWorkDuration(long targetDurationNanos); |
Wei Wang | 0500341 | 2021-04-01 10:44:29 -0700 | [diff] [blame] | 33 | |
| 34 | /** |
| 35 | * Reports the actual duration of a thread group. |
| 36 | * |
| 37 | * The system will attempt to adjust the core placement of the threads within |
| 38 | * the thread group and/or the frequency of the core on which they are run to bring |
| 39 | * the actual duration close to the target duration. |
| 40 | * |
| 41 | * @param actualDurationMicros how long the thread group took to complete its |
| 42 | * last task in nanoseconds |
| 43 | */ |
Peiyong Lin | c785459 | 2022-10-13 00:10:31 +0000 | [diff] [blame] | 44 | oneway void reportActualWorkDuration(in WorkDuration[] durations); |
Wei Wang | 0500341 | 2021-04-01 10:44:29 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
Wei Wang | 12495d2 | 2021-04-06 19:43:00 -0700 | [diff] [blame] | 47 | * Pause the session when the application is not allowed to send hint in framework. |
Wei Wang | 0500341 | 2021-04-01 10:44:29 -0700 | [diff] [blame] | 48 | */ |
Peiyong Lin | c785459 | 2022-10-13 00:10:31 +0000 | [diff] [blame] | 49 | oneway void pause(); |
Wei Wang | 0500341 | 2021-04-01 10:44:29 -0700 | [diff] [blame] | 50 | |
| 51 | /** |
Wei Wang | 12495d2 | 2021-04-06 19:43:00 -0700 | [diff] [blame] | 52 | * Resume the session when the application is allowed to send hint in framework. |
Wei Wang | 0500341 | 2021-04-01 10:44:29 -0700 | [diff] [blame] | 53 | */ |
Peiyong Lin | c785459 | 2022-10-13 00:10:31 +0000 | [diff] [blame] | 54 | oneway void resume(); |
Wei Wang | 0500341 | 2021-04-01 10:44:29 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
Wei Wang | 12495d2 | 2021-04-06 19:43:00 -0700 | [diff] [blame] | 57 | * Close the session to release resources. |
Wei Wang | 0500341 | 2021-04-01 10:44:29 -0700 | [diff] [blame] | 58 | */ |
Peiyong Lin | c785459 | 2022-10-13 00:10:31 +0000 | [diff] [blame] | 59 | oneway void close(); |
Matt Buckley | 1384388 | 2022-09-15 22:32:56 +0000 | [diff] [blame] | 60 | |
| 61 | /** |
| 62 | * Gives information to the PowerHintSession about upcoming or unexpected |
| 63 | * changes in load to supplement the normal updateTarget/reportActual cycle. |
| 64 | * |
| 65 | * @param hint The hint to provide to the PowerHintSession |
| 66 | */ |
Peiyong Lin | c785459 | 2022-10-13 00:10:31 +0000 | [diff] [blame] | 67 | oneway void sendHint(SessionHint hint); |
| 68 | |
| 69 | /** |
| 70 | * Sets a list of threads to the power hint session. This operation will replace |
| 71 | * the current list of threads with the given list of threads. If there's already |
| 72 | * boost for the replaced threads, a reset must be performed for the replaced |
| 73 | * threads. Note that this is not an oneway method. |
| 74 | * |
| 75 | * @param threadIds The list of threads to be associated |
| 76 | * with this session. |
| 77 | * |
| 78 | * @throws ScopedAStatus Status of the operation. If status code is not |
| 79 | * STATUS_OK, getMessage() must be populated with the human-readable |
| 80 | * error message. If the list of thread ids is empty, EX_ILLEGAL_ARGUMENT |
| 81 | * must be thrown. |
| 82 | */ |
| 83 | void setThreads(in int[] threadIds); |
Wei Wang | 0500341 | 2021-04-01 10:44:29 -0700 | [diff] [blame] | 84 | } |