Make sendHint private in platform
* Convert PerformanceHintManager sendHint to a private API * Have HWUI depend on private implementation Bug: b/261640114 Test: atest PerformanceHintNativeTestCases Test: atest FrameworksCoreTests:android.os.PerformanceHintManagerTest Change-Id: Ic65eef1fbd1c26040e86ddf3cf7c59581fee4374
This commit is contained in:
@@ -32329,12 +32329,7 @@ package android.os {
|
||||
public static class PerformanceHintManager.Session implements java.io.Closeable {
|
||||
method public void close();
|
||||
method public void reportActualWorkDuration(long);
|
||||
method public void sendHint(int);
|
||||
method public void updateTargetWorkDuration(long);
|
||||
field public static final int CPU_LOAD_DOWN = 1; // 0x1
|
||||
field public static final int CPU_LOAD_RESET = 2; // 0x2
|
||||
field public static final int CPU_LOAD_RESUME = 3; // 0x3
|
||||
field public static final int CPU_LOAD_UP = 0; // 0x0
|
||||
}
|
||||
|
||||
public final class PersistableBundle extends android.os.BaseBundle implements java.lang.Cloneable android.os.Parcelable {
|
||||
|
||||
@@ -1835,6 +1835,14 @@ package android.os {
|
||||
method public static java.io.File getFile(java.io.FileDescriptor) throws java.io.IOException;
|
||||
}
|
||||
|
||||
public static class PerformanceHintManager.Session implements java.io.Closeable {
|
||||
method public void sendHint(int);
|
||||
field public static final int CPU_LOAD_DOWN = 1; // 0x1
|
||||
field public static final int CPU_LOAD_RESET = 2; // 0x2
|
||||
field public static final int CPU_LOAD_RESUME = 3; // 0x3
|
||||
field public static final int CPU_LOAD_UP = 0; // 0x0
|
||||
}
|
||||
|
||||
public final class PowerManager {
|
||||
method public boolean areAutoPowerSaveModesEnabled();
|
||||
method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_LOW_POWER_STANDBY, android.Manifest.permission.DEVICE_POWER}) public void forceLowPowerStandbyActive(boolean);
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemService;
|
||||
import android.annotation.TestApi;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.internal.util.Preconditions;
|
||||
@@ -113,24 +114,36 @@ public final class PerformanceHintManager {
|
||||
* This hint indicates a sudden increase in CPU workload intensity. It means
|
||||
* that this hint session needs extra CPU resources immediately to meet the
|
||||
* target duration for the current work cycle.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public static final int 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.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public static final int 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.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public static final int 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.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public static final int CPU_LOAD_RESUME = 3;
|
||||
|
||||
/** @hide */
|
||||
@@ -196,7 +209,10 @@ public final class PerformanceHintManager {
|
||||
* Sends performance hints to inform the hint session of changes in the workload.
|
||||
*
|
||||
* @param hint The hint to send to the session.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@TestApi
|
||||
public void sendHint(@Hint int hint) {
|
||||
Preconditions.checkArgumentNonNegative(hint, "the hint ID should be at least"
|
||||
+ " zero.");
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "HintSessionWrapper.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <private/performance_hint_private.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -330,7 +330,6 @@ LIBANDROID {
|
||||
APerformanceHint_updateTargetWorkDuration; # introduced=Tiramisu
|
||||
APerformanceHint_reportActualWorkDuration; # introduced=Tiramisu
|
||||
APerformanceHint_closeSession; # introduced=Tiramisu
|
||||
APerformanceHint_sendHint; # introduced=UpsideDownCake
|
||||
local:
|
||||
*;
|
||||
};
|
||||
@@ -338,6 +337,7 @@ LIBANDROID {
|
||||
LIBANDROID_PLATFORM {
|
||||
global:
|
||||
APerformanceHint_setIHintManagerForTesting;
|
||||
APerformanceHint_sendHint;
|
||||
extern "C++" {
|
||||
ASurfaceControl_registerSurfaceStatsListener*;
|
||||
ASurfaceControl_unregisterSurfaceStatsListener*;
|
||||
|
||||
@@ -263,14 +263,14 @@ int APerformanceHint_reportActualWorkDuration(APerformanceHintSession* session,
|
||||
return session->reportActualWorkDuration(actualDurationNanos);
|
||||
}
|
||||
|
||||
int APerformanceHint_sendHint(APerformanceHintSession* session, int32_t hint) {
|
||||
return session->sendHint(hint);
|
||||
}
|
||||
|
||||
void APerformanceHint_closeSession(APerformanceHintSession* session) {
|
||||
delete session;
|
||||
}
|
||||
|
||||
int APerformanceHint_sendHint(void* session, int32_t hint) {
|
||||
return reinterpret_cast<APerformanceHintSession*>(session)->sendHint(hint);
|
||||
}
|
||||
|
||||
void APerformanceHint_setIHintManagerForTesting(void* iManager) {
|
||||
delete gHintManagerForTesting;
|
||||
gHintManagerForTesting = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user