CachedAppOptimizer: use new cgroup api for freezer path

Use the new cgroup API in place of the hardcoded path.
The new libprocessgroup API is defined in https://r.android.com/1607196

Bug: 180056337
Test: verified the freezer work via logs
Change-Id: I73c0976f3a917890bcd888c232975e2258f87b5c
This commit is contained in:
Marco Ballesio
2021-02-24 16:28:48 -08:00
parent 1f21265785
commit 9767e2a416

View File

@@ -280,7 +280,13 @@ static jint com_android_server_am_CachedAppOptimizer_getBinderFreezeInfo(JNIEnv
static jstring com_android_server_am_CachedAppOptimizer_getFreezerCheckPath(JNIEnv* env,
jobject clazz) {
return env->NewStringUTF(CGROUP_FREEZE_PATH);
std::string path;
if (!getAttributePathForTask("FreezerState", getpid(), &path)) {
path = "";
}
return env->NewStringUTF(path.c_str());
}
static const JNINativeMethod sMethods[] = {