Loading core/api/current.txt +20 −0 Original line number Diff line number Diff line Loading @@ -33344,6 +33344,14 @@ package android.os { method public final android.os.CountDownTimer start(); } @FlaggedApi("android.os.cpu_gpu_headrooms") public final class CpuHeadroomParams { ctor public CpuHeadroomParams(); method public int getCalculationType(); method public void setCalculationType(int); field public static final int CPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1; // 0x1 field public static final int CPU_HEADROOM_CALCULATION_TYPE_MIN = 0; // 0x0 } public final class CpuUsageInfo implements android.os.Parcelable { method public int describeContents(); method public long getActive(); Loading Loading @@ -33591,6 +33599,14 @@ package android.os { method public void onProgress(long); } @FlaggedApi("android.os.cpu_gpu_headrooms") public final class GpuHeadroomParams { ctor public GpuHeadroomParams(); method public int getCalculationType(); method public void setCalculationType(int); field public static final int GPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1; // 0x1 field public static final int GPU_HEADROOM_CALCULATION_TYPE_MIN = 0; // 0x0 } public class Handler { ctor @Deprecated public Handler(); ctor @Deprecated public Handler(@Nullable android.os.Handler.Callback); Loading Loading @@ -34841,6 +34857,10 @@ package android.os.health { } public class SystemHealthManager { method @FlaggedApi("android.os.cpu_gpu_headrooms") @FloatRange(from=0.0f, to=100.0f) public float getCpuHeadroom(@Nullable android.os.CpuHeadroomParams); method @FlaggedApi("android.os.cpu_gpu_headrooms") public long getCpuHeadroomMinIntervalMillis(); method @FlaggedApi("android.os.cpu_gpu_headrooms") @FloatRange(from=0.0f, to=100.0f) public float getGpuHeadroom(@Nullable android.os.GpuHeadroomParams); method @FlaggedApi("android.os.cpu_gpu_headrooms") public long getGpuHeadroomMinIntervalMillis(); method @FlaggedApi("com.android.server.power.optimization.power_monitor_api") public void getPowerMonitorReadings(@NonNull java.util.List<android.os.PowerMonitor>, @Nullable java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.os.PowerMonitorReadings,java.lang.RuntimeException>); method @FlaggedApi("com.android.server.power.optimization.power_monitor_api") public void getSupportedPowerMonitors(@Nullable java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.util.List<android.os.PowerMonitor>>); method public android.os.health.HealthStats takeMyUidSnapshot(); core/java/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -232,6 +232,8 @@ aidl_interface { "android.hardware.power-aidl", ], srcs: [ "android/os/CpuHeadroomParamsInternal.aidl", "android/os/GpuHeadroomParamsInternal.aidl", "android/os/IHintManager.aidl", "android/os/IHintSession.aidl", ], Loading core/java/android/app/SystemServiceRegistry.java +4 −1 Original line number Diff line number Diff line Loading @@ -190,6 +190,7 @@ import android.os.IBatteryPropertiesRegistrar; import android.os.IBinder; import android.os.IDumpstate; import android.os.IHardwarePropertiesManager; import android.os.IHintManager; import android.os.IPowerManager; import android.os.IPowerStatsService; import android.os.IRecoverySystem; Loading Loading @@ -1195,8 +1196,10 @@ public final class SystemServiceRegistry { public SystemHealthManager createService(ContextImpl ctx) throws ServiceNotFoundException { IBinder batteryStats = ServiceManager.getServiceOrThrow(BatteryStats.SERVICE_NAME); IBinder powerStats = ServiceManager.getService(Context.POWER_STATS_SERVICE); IBinder perfHint = ServiceManager.getService(Context.PERFORMANCE_HINT_SERVICE); return new SystemHealthManager(IBatteryStats.Stub.asInterface(batteryStats), IPowerStatsService.Stub.asInterface(powerStats)); IPowerStatsService.Stub.asInterface(powerStats), IHintManager.Stub.asInterface(perfHint)); }}); registerService(Context.CONTEXTHUB_SERVICE, ContextHubManager.class, Loading core/java/android/os/CpuHeadroomParams.java 0 → 100644 +91 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.os; import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.os.health.SystemHealthManager; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Headroom request params used by {@link SystemHealthManager#getCpuHeadroom(CpuHeadroomParams)}. */ @FlaggedApi(Flags.FLAG_CPU_GPU_HEADROOMS) public final class CpuHeadroomParams { final CpuHeadroomParamsInternal mInternal; public CpuHeadroomParams() { mInternal = new CpuHeadroomParamsInternal(); } /** @hide */ @IntDef(flag = false, prefix = {"CPU_HEADROOM_CALCULATION_TYPE_"}, value = { CPU_HEADROOM_CALCULATION_TYPE_MIN, // 0 CPU_HEADROOM_CALCULATION_TYPE_AVERAGE, // 1 }) @Retention(RetentionPolicy.SOURCE) public @interface CpuHeadroomCalculationType { } /** * Calculates the headroom based on minimum value over a device-defined window. */ public static final int CPU_HEADROOM_CALCULATION_TYPE_MIN = 0; /** * Calculates the headroom based on average value over a device-defined window. */ public static final int CPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1; /** * Sets the headroom calculation type. * <p> * * @throws IllegalArgumentException if the type is invalid. */ public void setCalculationType(@CpuHeadroomCalculationType int calculationType) { switch (calculationType) { case CPU_HEADROOM_CALCULATION_TYPE_MIN: case CPU_HEADROOM_CALCULATION_TYPE_AVERAGE: mInternal.calculationType = (byte) calculationType; return; } throw new IllegalArgumentException("Invalid calculation type: " + calculationType); } /** * Gets the headroom calculation type. * Default to {@link #CPU_HEADROOM_CALCULATION_TYPE_MIN} if not set. */ public @CpuHeadroomCalculationType int getCalculationType() { @CpuHeadroomCalculationType int validatedType = switch ((int) mInternal.calculationType) { case CPU_HEADROOM_CALCULATION_TYPE_MIN, CPU_HEADROOM_CALCULATION_TYPE_AVERAGE -> mInternal.calculationType; default -> CPU_HEADROOM_CALCULATION_TYPE_MIN; }; return validatedType; } /** * @hide */ public CpuHeadroomParamsInternal getInternal() { return mInternal; } } core/java/android/os/CpuHeadroomParamsInternal.aidl 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.os; import android.hardware.power.CpuHeadroomParams; /** * Changes should be synced with match function of HintManagerService#CpuHeadroomCacheItem. * {@hide} */ @JavaDerive(equals = true, toString = true) parcelable CpuHeadroomParamsInternal { boolean usesDeviceHeadroom = false; CpuHeadroomParams.CalculationType calculationType = CpuHeadroomParams.CalculationType.MIN; CpuHeadroomParams.SelectionType selectionType = CpuHeadroomParams.SelectionType.ALL; } Loading
core/api/current.txt +20 −0 Original line number Diff line number Diff line Loading @@ -33344,6 +33344,14 @@ package android.os { method public final android.os.CountDownTimer start(); } @FlaggedApi("android.os.cpu_gpu_headrooms") public final class CpuHeadroomParams { ctor public CpuHeadroomParams(); method public int getCalculationType(); method public void setCalculationType(int); field public static final int CPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1; // 0x1 field public static final int CPU_HEADROOM_CALCULATION_TYPE_MIN = 0; // 0x0 } public final class CpuUsageInfo implements android.os.Parcelable { method public int describeContents(); method public long getActive(); Loading Loading @@ -33591,6 +33599,14 @@ package android.os { method public void onProgress(long); } @FlaggedApi("android.os.cpu_gpu_headrooms") public final class GpuHeadroomParams { ctor public GpuHeadroomParams(); method public int getCalculationType(); method public void setCalculationType(int); field public static final int GPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1; // 0x1 field public static final int GPU_HEADROOM_CALCULATION_TYPE_MIN = 0; // 0x0 } public class Handler { ctor @Deprecated public Handler(); ctor @Deprecated public Handler(@Nullable android.os.Handler.Callback); Loading Loading @@ -34841,6 +34857,10 @@ package android.os.health { } public class SystemHealthManager { method @FlaggedApi("android.os.cpu_gpu_headrooms") @FloatRange(from=0.0f, to=100.0f) public float getCpuHeadroom(@Nullable android.os.CpuHeadroomParams); method @FlaggedApi("android.os.cpu_gpu_headrooms") public long getCpuHeadroomMinIntervalMillis(); method @FlaggedApi("android.os.cpu_gpu_headrooms") @FloatRange(from=0.0f, to=100.0f) public float getGpuHeadroom(@Nullable android.os.GpuHeadroomParams); method @FlaggedApi("android.os.cpu_gpu_headrooms") public long getGpuHeadroomMinIntervalMillis(); method @FlaggedApi("com.android.server.power.optimization.power_monitor_api") public void getPowerMonitorReadings(@NonNull java.util.List<android.os.PowerMonitor>, @Nullable java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.os.PowerMonitorReadings,java.lang.RuntimeException>); method @FlaggedApi("com.android.server.power.optimization.power_monitor_api") public void getSupportedPowerMonitors(@Nullable java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.util.List<android.os.PowerMonitor>>); method public android.os.health.HealthStats takeMyUidSnapshot();
core/java/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -232,6 +232,8 @@ aidl_interface { "android.hardware.power-aidl", ], srcs: [ "android/os/CpuHeadroomParamsInternal.aidl", "android/os/GpuHeadroomParamsInternal.aidl", "android/os/IHintManager.aidl", "android/os/IHintSession.aidl", ], Loading
core/java/android/app/SystemServiceRegistry.java +4 −1 Original line number Diff line number Diff line Loading @@ -190,6 +190,7 @@ import android.os.IBatteryPropertiesRegistrar; import android.os.IBinder; import android.os.IDumpstate; import android.os.IHardwarePropertiesManager; import android.os.IHintManager; import android.os.IPowerManager; import android.os.IPowerStatsService; import android.os.IRecoverySystem; Loading Loading @@ -1195,8 +1196,10 @@ public final class SystemServiceRegistry { public SystemHealthManager createService(ContextImpl ctx) throws ServiceNotFoundException { IBinder batteryStats = ServiceManager.getServiceOrThrow(BatteryStats.SERVICE_NAME); IBinder powerStats = ServiceManager.getService(Context.POWER_STATS_SERVICE); IBinder perfHint = ServiceManager.getService(Context.PERFORMANCE_HINT_SERVICE); return new SystemHealthManager(IBatteryStats.Stub.asInterface(batteryStats), IPowerStatsService.Stub.asInterface(powerStats)); IPowerStatsService.Stub.asInterface(powerStats), IHintManager.Stub.asInterface(perfHint)); }}); registerService(Context.CONTEXTHUB_SERVICE, ContextHubManager.class, Loading
core/java/android/os/CpuHeadroomParams.java 0 → 100644 +91 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.os; import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.os.health.SystemHealthManager; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Headroom request params used by {@link SystemHealthManager#getCpuHeadroom(CpuHeadroomParams)}. */ @FlaggedApi(Flags.FLAG_CPU_GPU_HEADROOMS) public final class CpuHeadroomParams { final CpuHeadroomParamsInternal mInternal; public CpuHeadroomParams() { mInternal = new CpuHeadroomParamsInternal(); } /** @hide */ @IntDef(flag = false, prefix = {"CPU_HEADROOM_CALCULATION_TYPE_"}, value = { CPU_HEADROOM_CALCULATION_TYPE_MIN, // 0 CPU_HEADROOM_CALCULATION_TYPE_AVERAGE, // 1 }) @Retention(RetentionPolicy.SOURCE) public @interface CpuHeadroomCalculationType { } /** * Calculates the headroom based on minimum value over a device-defined window. */ public static final int CPU_HEADROOM_CALCULATION_TYPE_MIN = 0; /** * Calculates the headroom based on average value over a device-defined window. */ public static final int CPU_HEADROOM_CALCULATION_TYPE_AVERAGE = 1; /** * Sets the headroom calculation type. * <p> * * @throws IllegalArgumentException if the type is invalid. */ public void setCalculationType(@CpuHeadroomCalculationType int calculationType) { switch (calculationType) { case CPU_HEADROOM_CALCULATION_TYPE_MIN: case CPU_HEADROOM_CALCULATION_TYPE_AVERAGE: mInternal.calculationType = (byte) calculationType; return; } throw new IllegalArgumentException("Invalid calculation type: " + calculationType); } /** * Gets the headroom calculation type. * Default to {@link #CPU_HEADROOM_CALCULATION_TYPE_MIN} if not set. */ public @CpuHeadroomCalculationType int getCalculationType() { @CpuHeadroomCalculationType int validatedType = switch ((int) mInternal.calculationType) { case CPU_HEADROOM_CALCULATION_TYPE_MIN, CPU_HEADROOM_CALCULATION_TYPE_AVERAGE -> mInternal.calculationType; default -> CPU_HEADROOM_CALCULATION_TYPE_MIN; }; return validatedType; } /** * @hide */ public CpuHeadroomParamsInternal getInternal() { return mInternal; } }
core/java/android/os/CpuHeadroomParamsInternal.aidl 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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.os; import android.hardware.power.CpuHeadroomParams; /** * Changes should be synced with match function of HintManagerService#CpuHeadroomCacheItem. * {@hide} */ @JavaDerive(equals = true, toString = true) parcelable CpuHeadroomParamsInternal { boolean usesDeviceHeadroom = false; CpuHeadroomParams.CalculationType calculationType = CpuHeadroomParams.CalculationType.MIN; CpuHeadroomParams.SelectionType selectionType = CpuHeadroomParams.SelectionType.ALL; }