Merge "Check if freezer cgroup configuration is valid" into udc-dev
This commit is contained in:
@@ -1014,6 +1014,12 @@ public final class CachedAppOptimizer {
|
|||||||
*/
|
*/
|
||||||
private static native String getFreezerCheckPath();
|
private static native String getFreezerCheckPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if task_profiles.json includes valid freezer profiles and actions
|
||||||
|
* @return false if there are invalid profiles or actions
|
||||||
|
*/
|
||||||
|
private static native boolean isFreezerProfileValid();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the freezer is supported by this system
|
* Determines whether the freezer is supported by this system
|
||||||
*/
|
*/
|
||||||
@@ -1031,16 +1037,19 @@ public final class CachedAppOptimizer {
|
|||||||
// Also check freezer binder ioctl
|
// Also check freezer binder ioctl
|
||||||
Slog.d(TAG_AM, "Checking binder freezer ioctl");
|
Slog.d(TAG_AM, "Checking binder freezer ioctl");
|
||||||
getBinderFreezeInfo(Process.myPid());
|
getBinderFreezeInfo(Process.myPid());
|
||||||
supported = true;
|
|
||||||
|
// Check if task_profiles.json contains invalid profiles
|
||||||
|
Slog.d(TAG_AM, "Checking freezer profiles");
|
||||||
|
supported = isFreezerProfileValid();
|
||||||
} else {
|
} else {
|
||||||
Slog.e(TAG_AM, "unexpected value in cgroup.freeze");
|
Slog.e(TAG_AM, "Unexpected value in cgroup.freeze");
|
||||||
}
|
}
|
||||||
} catch (java.io.FileNotFoundException e) {
|
} catch (java.io.FileNotFoundException e) {
|
||||||
Slog.w(TAG_AM, "cgroup.freeze not present");
|
Slog.w(TAG_AM, "File cgroup.freeze not present");
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Slog.w(TAG_AM, "unable to read freezer info");
|
Slog.w(TAG_AM, "Unable to read freezer info");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Slog.w(TAG_AM, "unable to read cgroup.freeze: " + e.toString());
|
Slog.w(TAG_AM, "Unable to read cgroup.freeze: " + e.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fr != null) {
|
if (fr != null) {
|
||||||
|
|||||||
@@ -561,6 +561,14 @@ static jstring com_android_server_am_CachedAppOptimizer_getFreezerCheckPath(JNIE
|
|||||||
return env->NewStringUTF(path.c_str());
|
return env->NewStringUTF(path.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static jboolean com_android_server_am_CachedAppOptimizer_isFreezerProfileValid(JNIEnv* env) {
|
||||||
|
int uid = getuid();
|
||||||
|
int pid = getpid();
|
||||||
|
|
||||||
|
return isProfileValidForProcess("Frozen", uid, pid) &&
|
||||||
|
isProfileValidForProcess("Unfrozen", uid, pid);
|
||||||
|
}
|
||||||
|
|
||||||
static const JNINativeMethod sMethods[] = {
|
static const JNINativeMethod sMethods[] = {
|
||||||
/* name, signature, funcPtr */
|
/* name, signature, funcPtr */
|
||||||
{"cancelCompaction", "()V",
|
{"cancelCompaction", "()V",
|
||||||
@@ -578,7 +586,9 @@ static const JNINativeMethod sMethods[] = {
|
|||||||
{"getBinderFreezeInfo", "(I)I",
|
{"getBinderFreezeInfo", "(I)I",
|
||||||
(void*)com_android_server_am_CachedAppOptimizer_getBinderFreezeInfo},
|
(void*)com_android_server_am_CachedAppOptimizer_getBinderFreezeInfo},
|
||||||
{"getFreezerCheckPath", "()Ljava/lang/String;",
|
{"getFreezerCheckPath", "()Ljava/lang/String;",
|
||||||
(void*)com_android_server_am_CachedAppOptimizer_getFreezerCheckPath}};
|
(void*)com_android_server_am_CachedAppOptimizer_getFreezerCheckPath},
|
||||||
|
{"isFreezerProfileValid", "()Z",
|
||||||
|
(void*)com_android_server_am_CachedAppOptimizer_isFreezerProfileValid}};
|
||||||
|
|
||||||
int register_android_server_am_CachedAppOptimizer(JNIEnv* env)
|
int register_android_server_am_CachedAppOptimizer(JNIEnv* env)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user