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

Commit 8a49ab16 authored by wilsonshih's avatar wilsonshih
Browse files

Remove enabled flag extending_persistence_snapshot_queue_depth

Bug: 439928984
Test: presubmit
Flag: EXEMPT flag removal
Change-Id: I8abe303c898b46f96e169312acb73e9c7af5e801
parent b84ec57b
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -372,17 +372,6 @@ flag {
    }
}

flag {
    name: "extending_persistence_snapshot_queue_depth"
    namespace: "windowing_frontend"
    description: "Use ImageReader to persist snapshot into disk, and extending the persistence snapshot queue depth."
    bug: "416144425"
    is_fixed_read_only: true
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "predictive_back_delay_wm_transition"
    namespace: "windowing_frontend"
+1 −6
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ package com.android.server.wm;

import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;

import static com.android.server.wm.SnapshotPersistQueue.MAX_HW_STORE_QUEUE_DEPTH;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
@@ -34,7 +32,6 @@ import android.window.TaskSnapshot;

import com.android.internal.annotations.VisibleForTesting;
import com.android.server.wm.BaseAppSnapshotPersister.PersistInfoProvider;
import com.android.window.flags.Flags;

import java.io.File;
import java.io.PrintWriter;
@@ -354,9 +351,7 @@ class ActivitySnapshotController extends AbsAppSnapshotController<ActivityRecord
        if (DEBUG) {
            Slog.d(TAG, "ActivitySnapshotController#recordSnapshot " + activity);
        }
        final int maxStoreQueue = Flags.extendingPersistenceSnapshotQueueDepth()
                ? mSnapshotPersistQueue.mMaxTotalStoreQueue
                : MAX_HW_STORE_QUEUE_DEPTH;
        final int maxStoreQueue = mSnapshotPersistQueue.mMaxTotalStoreQueue;
        if (mSnapshotPersistQueue.peekWriteQueueSize() >= maxStoreQueue
                || mSnapshotPersistQueue.peekQueueSize() > MAX_PERSIST_SNAPSHOT_COUNT) {
            Slog.w(TAG, "Skipping recording activity snapshot, too many requests!");
+7 −39
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import android.annotation.NonNull;
import android.app.ActivityTaskManager;
import android.graphics.Bitmap;
import android.graphics.PixelFormat;
import android.hardware.HardwareBuffer;
import android.os.Process;
import android.os.SystemClock;
@@ -36,7 +35,6 @@ import android.window.TaskSnapshot;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.policy.TransitionAnimation;
import com.android.server.LocalServices;
import com.android.server.pm.UserManagerInternal;
import com.android.server.wm.BaseAppSnapshotPersister.LowResSnapshotSupplier;
@@ -177,7 +175,6 @@ class SnapshotPersistQueue {
    }

    private void addToQueueInternal(WriteQueueItem item, boolean insertToFront) {
        if (Flags.extendingPersistenceSnapshotQueueDepth()) {
        final Iterator<WriteQueueItem> iterator = mWriteQueue.iterator();
        while (iterator.hasNext()) {
            final WriteQueueItem next = iterator.next();
@@ -186,9 +183,6 @@ class SnapshotPersistQueue {
                break;
            }
        }
        } else {
            mWriteQueue.removeFirstOccurrence(item);
        }
        if (insertToFront) {
            mWriteQueue.addFirst(item);
        } else {
@@ -215,15 +209,6 @@ class SnapshotPersistQueue {

    @GuardedBy("mLock")
    private void ensureStoreQueueDepthLocked() {
        if (!Flags.extendingPersistenceSnapshotQueueDepth()) {
            while (mStoreQueueItems.size() > MAX_HW_STORE_QUEUE_DEPTH) {
                final StoreWriteQueueItem item = mStoreQueueItems.poll();
                mWriteQueue.remove(item);
                Slog.i(TAG, "Queue is too deep! Purged item with index=" + item.mId);
            }
            return;
        }

        // Rules for store queue depth:
        //  - Hardware render involved items < MAX_HW_STORE_QUEUE_DEPTH
        //  - Total (SW + HW) items < mMaxTotalStoreQueue
@@ -235,7 +220,7 @@ class SnapshotPersistQueue {
            final StoreWriteQueueItem item = iterator.next();
            totalStoreCount++;
            boolean removeItem = false;
            if (mustPersistByHardwareRender(item.mSnapshot)) {
            if (TaskSnapshotConvertUtil.mustPersistByHardwareRender(item.mSnapshot)) {
                hwStoreCount++;
                if (hwStoreCount > MAX_HW_STORE_QUEUE_DEPTH) {
                    removeItem = true;
@@ -353,23 +338,6 @@ class SnapshotPersistQueue {
        }
    }

    static boolean mustPersistByHardwareRender(@NonNull TaskSnapshot snapshot) {
        final int pixelFormat;
        final boolean hasProtectedContent;
        if (Flags.reduceTaskSnapshotMemoryUsage()) {
            pixelFormat = snapshot.getHardwareBufferFormat();
            hasProtectedContent = snapshot.hasProtectedContent();
        } else {
            final HardwareBuffer hwBuffer = snapshot.getHardwareBuffer();
            pixelFormat = hwBuffer.getFormat();
            hasProtectedContent = TransitionAnimation.hasProtectedContent(hwBuffer);
        }
        return !Flags.extendingPersistenceSnapshotQueueDepth()
                || (pixelFormat != PixelFormat.RGB_565 && pixelFormat != PixelFormat.RGBA_8888)
                || !snapshot.isRealSnapshot()
                || hasProtectedContent;
    }

    StoreWriteQueueItem createStoreWriteQueueItem(int id, int userId, TaskSnapshot snapshot,
            PersistInfoProvider provider,
            Consumer<LowResSnapshotSupplier> lowResSnapshotConsumer) {
+1 −2
Original line number Diff line number Diff line
@@ -75,8 +75,7 @@ public class TaskSnapshotConvertUtil {
            pixelFormat = hwBuffer.getFormat();
            hasProtectedContent = TransitionAnimation.hasProtectedContent(hwBuffer);
        }
        return !Flags.extendingPersistenceSnapshotQueueDepth()
                || (pixelFormat != PixelFormat.RGB_565 && pixelFormat != PixelFormat.RGBA_8888)
        return (pixelFormat != PixelFormat.RGB_565 && pixelFormat != PixelFormat.RGBA_8888)
                || !snapshot.isRealSnapshot()
                || hasProtectedContent;
    }
+1 −6
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
import static com.android.server.wm.ActivitySnapshotController.MAX_PERSIST_SNAPSHOT_COUNT;
import static com.android.server.wm.SnapshotPersistQueue.MAX_HW_STORE_QUEUE_DEPTH;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -40,8 +39,6 @@ import android.window.TaskSnapshot;

import androidx.test.filters.SmallTest;

import com.android.window.flags.Flags;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -278,9 +275,7 @@ public class ActivitySnapshotControllerTests extends TaskSnapshotPersisterTestBa

        mSnapshotPersistQueue.setPaused(true);
        final ArrayList<ActivityRecord> tmpList = new ArrayList<>();
        final int maxStoreQueue = Flags.extendingPersistenceSnapshotQueueDepth()
                ? MAX_PERSIST_SNAPSHOT_COUNT
                : MAX_HW_STORE_QUEUE_DEPTH;
        final int maxStoreQueue = MAX_PERSIST_SNAPSHOT_COUNT;
        for (int i = 0; i < maxStoreQueue; ++i) {
            tmpList.clear();
            final ActivityRecord activity = createActivityRecord(task);
Loading