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

Commit 145e5c1d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Disable task snapshots on svelte"

parents e44f60ec 3d73260a
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.