1 /* 2 * 3 * Copyright 2021, The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package android.os; 19 20 import android.os.CpuHeadroomParamsInternal; 21 import android.os.GpuHeadroomParamsInternal; 22 import android.os.IHintSession; 23 import android.os.SessionCreationConfig; 24 25 import android.hardware.power.ChannelConfig; 26 import android.hardware.power.CpuHeadroomResult; 27 import android.hardware.power.GpuHeadroomResult; 28 import android.hardware.power.SessionConfig; 29 import android.hardware.power.SessionTag; 30 import android.hardware.power.SupportInfo; 31 32 /** {@hide} */ 33 interface IHintManager { 34 /** 35 * Creates a {@link Session} for the given set of threads and associates to a binder token. 36 * Returns a config if creation is not supported, and HMS had to use the 37 * legacy creation method. 38 * 39 * Throws UnsupportedOperationException if ADPF is not supported, and IllegalStateException 40 * if creation is supported but fails. 41 */ createHintSessionWithConfig(in IBinder token, in SessionTag tag, in SessionCreationConfig creationConfig, out SessionConfig config)42 SessionCreationReturn createHintSessionWithConfig(in IBinder token, in SessionTag tag, 43 in SessionCreationConfig creationConfig, out SessionConfig config); 44 setHintSessionThreads(in IHintSession hintSession, in int[] tids)45 void setHintSessionThreads(in IHintSession hintSession, in int[] tids); getHintSessionThreadIds(in IHintSession hintSession)46 int[] getHintSessionThreadIds(in IHintSession hintSession); 47 48 parcelable SessionCreationReturn { 49 IHintSession session; 50 // True if the graphics pipeline thread limit is being exceeded 51 boolean pipelineThreadLimitExceeded = false; 52 } 53 54 /** 55 * Returns FMQ channel information for the caller, which it associates to a binder token. 56 * 57 * Throws IllegalStateException if FMQ channel creation fails. 58 */ getSessionChannel(in IBinder token)59 @nullable ChannelConfig getSessionChannel(in IBinder token); closeSessionChannel()60 oneway void closeSessionChannel(); getCpuHeadroom(in CpuHeadroomParamsInternal params)61 @nullable CpuHeadroomResult getCpuHeadroom(in CpuHeadroomParamsInternal params); getCpuHeadroomMinIntervalMillis()62 long getCpuHeadroomMinIntervalMillis(); getGpuHeadroom(in GpuHeadroomParamsInternal params)63 @nullable GpuHeadroomResult getGpuHeadroom(in GpuHeadroomParamsInternal params); getGpuHeadroomMinIntervalMillis()64 long getGpuHeadroomMinIntervalMillis(); 65 66 /** 67 * Used by the JNI to pass an interface to the SessionManager; 68 * for internal use only. 69 */ passSessionManagerBinder(in IBinder sessionManager)70 oneway void passSessionManagerBinder(in IBinder sessionManager); 71 72 parcelable HintManagerClientData { 73 int powerHalVersion; 74 int maxGraphicsPipelineThreads; 75 int maxCpuHeadroomThreads; 76 long preferredRateNanos; 77 SupportInfo supportInfo; 78 } 79 80 interface IHintManagerClient { 81 /** 82 * Returns FMQ channel information for the caller, which it associates to the callback binder lifespan. 83 */ receiveChannelConfig(in ChannelConfig config)84 oneway void receiveChannelConfig(in ChannelConfig config); 85 } 86 87 /** 88 * Set up an ADPF client, receiving a remote client binder interface and 89 * passing back a bundle of support and configuration information. 90 */ registerClient(in IHintManagerClient client)91 HintManagerClientData registerClient(in IHintManagerClient client); 92 getClientData()93 HintManagerClientData getClientData(); 94 } 95