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

Commit 3d73260a authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Disable task snapshots on svelte

Test: Boot low ram device, make sure cache stays empty
Bug: 31339431
Change-Id: I0fac1071f17fcd13872ef68f68eee2c793c6753c
parent df0824ad
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.wm;
import static android.app.ActivityManager.ENABLE_TASK_SNAPSHOTS;

import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManager.StackId;
import android.app.ActivityManager.TaskSnapshot;
import android.graphics.GraphicBuffer;
@@ -65,26 +66,22 @@ class TaskSnapshotController {
    }

    void onTransitionStarting() {
        if (!ENABLE_TASK_SNAPSHOTS) {
            return;
        }
        handleClosingApps(mService.mClosingApps);
    }


    /**
     * Called when the visibility of an app changes outside of the regular app transition flow.
     */
    void notifyAppVisibilityChanged(AppWindowToken appWindowToken, boolean visible) {
        if (!ENABLE_TASK_SNAPSHOTS) {
            return;
        }
        if (!visible) {
            handleClosingApps(Sets.newArraySet(appWindowToken));
        }
    }

    private void handleClosingApps(ArraySet<AppWindowToken> closingApps) {
        if (!ENABLE_TASK_SNAPSHOTS || ActivityManager.isLowRamDeviceStatic()) {
            return;
        }

        // We need to take a snapshot of the task if and only if all activities of the task are
        // either closing or hidden.