Loading services/core/java/com/android/server/am/CachedAppOptimizer.java +14 −5 Original line number Diff line number Diff line Loading @@ -1014,6 +1014,12 @@ public final class CachedAppOptimizer { */ 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 */ Loading @@ -1031,16 +1037,19 @@ public final class CachedAppOptimizer { // Also check freezer binder ioctl Slog.d(TAG_AM, "Checking binder freezer ioctl"); getBinderFreezeInfo(Process.myPid()); supported = true; // Check if task_profiles.json contains invalid profiles Slog.d(TAG_AM, "Checking freezer profiles"); supported = isFreezerProfileValid(); } else { Slog.e(TAG_AM, "unexpected value in cgroup.freeze"); Slog.e(TAG_AM, "Unexpected value in cgroup.freeze"); } } 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) { Slog.w(TAG_AM, "unable to read freezer info"); Slog.w(TAG_AM, "Unable to read freezer info"); } 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) { Loading services/core/jni/com_android_server_am_CachedAppOptimizer.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -561,6 +561,14 @@ static jstring com_android_server_am_CachedAppOptimizer_getFreezerCheckPath(JNIE 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[] = { /* name, signature, funcPtr */ {"cancelCompaction", "()V", Loading @@ -578,7 +586,9 @@ static const JNINativeMethod sMethods[] = { {"getBinderFreezeInfo", "(I)I", (void*)com_android_server_am_CachedAppOptimizer_getBinderFreezeInfo}, {"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) { Loading Loading
services/core/java/com/android/server/am/CachedAppOptimizer.java +14 −5 Original line number Diff line number Diff line Loading @@ -1014,6 +1014,12 @@ public final class CachedAppOptimizer { */ 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 */ Loading @@ -1031,16 +1037,19 @@ public final class CachedAppOptimizer { // Also check freezer binder ioctl Slog.d(TAG_AM, "Checking binder freezer ioctl"); getBinderFreezeInfo(Process.myPid()); supported = true; // Check if task_profiles.json contains invalid profiles Slog.d(TAG_AM, "Checking freezer profiles"); supported = isFreezerProfileValid(); } else { Slog.e(TAG_AM, "unexpected value in cgroup.freeze"); Slog.e(TAG_AM, "Unexpected value in cgroup.freeze"); } } 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) { Slog.w(TAG_AM, "unable to read freezer info"); Slog.w(TAG_AM, "Unable to read freezer info"); } 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) { Loading
services/core/jni/com_android_server_am_CachedAppOptimizer.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -561,6 +561,14 @@ static jstring com_android_server_am_CachedAppOptimizer_getFreezerCheckPath(JNIE 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[] = { /* name, signature, funcPtr */ {"cancelCompaction", "()V", Loading @@ -578,7 +586,9 @@ static const JNINativeMethod sMethods[] = { {"getBinderFreezeInfo", "(I)I", (void*)com_android_server_am_CachedAppOptimizer_getBinderFreezeInfo}, {"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) { Loading