Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f354af53 authored by Marco Ballesio's avatar Marco Ballesio
Browse files

CachedAppOptimizer: remove native freezer enabling code

After merging the cgroup v2 uid/pid, processes are handled individually
at freezer enable/disable, and the native freezer enable/disable code is
not mapped to a profile anymore. For this reason all the related code
ought to be removed.

Bug: 181130874
Test: booted, verified freezer proper functioning
Change-Id: Ibd958e7a34cf979c3db3a92d21155de551b00e5a
parent 1f212657
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -535,18 +535,6 @@ public final class CachedAppOptimizer {
        return true;
    }

    /**
     * Enable or disable the freezer. When enable == false all frozen processes are unfrozen,
     * but aren't removed from the freezer. While in this state, processes can be added or removed
     * by using Process.setProcessFrozen(), but they wouldn't be actually frozen until the freezer
     * is enabled. If enable == true all processes in the freezer are frozen.
     *
     * @param enable Specify whether to enable (true) or disable (false) the freezer.
     *
     * @hide
     */
    private static native void enableFreezerInternal(boolean enable);

    /**
     * Informs binder that a process is about to be frozen. If freezer is enabled on a process via
     * this method, this method will synchronously dispatch all pending transactions to the
@@ -590,10 +578,6 @@ public final class CachedAppOptimizer {

            if (state == '1' || state == '0') {
                supported = true;
                // This is a workaround after reverting the cgroup v2 uid/pid hierarchy due to
                // http://b/179006802.
                // TODO: remove once the uid/pid hierarchy is restored
                enableFreezerInternal(true);
            } else {
                Slog.e(TAG_AM, "unexpected value in cgroup.freeze");
            }
+0 −17
Original line number Diff line number Diff line
@@ -232,21 +232,6 @@ static void com_android_server_am_CachedAppOptimizer_compactProcess(JNIEnv*, job
    compactProcessOrFallback(pid, compactionFlags);
}

static void com_android_server_am_CachedAppOptimizer_enableFreezerInternal(
        JNIEnv *env, jobject clazz, jboolean enable) {
    bool success = true;

    if (enable) {
        success = SetTaskProfiles(0, {"FreezerEnabled"}, true);
    } else {
        success = SetTaskProfiles(0, {"FreezerDisabled"}, true);
    }

    if (!success) {
        jniThrowException(env, "java/lang/RuntimeException", "Unknown error");
    }
}

static void com_android_server_am_CachedAppOptimizer_freezeBinder(
        JNIEnv *env, jobject clazz, jint pid, jboolean freeze) {

@@ -287,8 +272,6 @@ static const JNINativeMethod sMethods[] = {
        /* name, signature, funcPtr */
        {"compactSystem", "()V", (void*)com_android_server_am_CachedAppOptimizer_compactSystem},
        {"compactProcess", "(II)V", (void*)com_android_server_am_CachedAppOptimizer_compactProcess},
        {"enableFreezerInternal", "(Z)V",
         (void*)com_android_server_am_CachedAppOptimizer_enableFreezerInternal},
        {"freezeBinder", "(IZ)V", (void*)com_android_server_am_CachedAppOptimizer_freezeBinder},
        {"getBinderFreezeInfo", "(I)I",
         (void*)com_android_server_am_CachedAppOptimizer_getBinderFreezeInfo},