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

Commit 15962e94 authored by wilsonshih's avatar wilsonshih
Browse files

Add debug logging to SnapshotPersistQueue.

The crash only occur in Monkey test, add log to check what happen
and revert then. It is safe because those log are behind flag.

Bug: 424273966
Flag: com.android.window.flags.extending_persistence_snapshot_queue_depth
Test: Manual

Change-Id: I506599bb3dfc5c88c382357deabd963b1054c4d2
parent 79071c28
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -178,10 +178,12 @@ class SnapshotPersistQueue {

    private void addToQueueInternal(WriteQueueItem item, boolean insertToFront) {
        if (Flags.extendingPersistenceSnapshotQueueDepth()) {
            Slog.d(TAG, "SPQ#addToQueueInternal item " + item);
            final Iterator<WriteQueueItem> iterator = mWriteQueue.iterator();
            while (iterator.hasNext()) {
                final WriteQueueItem next = iterator.next();
                if (item.isDuplicateOrExclusiveItem(next)) {
                    Slog.d(TAG, "SPQ#addToQueueInternal remove " + item);
                    iterator.remove();
                    break;
                }
@@ -227,6 +229,7 @@ class SnapshotPersistQueue {
        // Rules for store queue depth:
        //  - Hardware render involved items < MAX_HW_STORE_QUEUE_DEPTH
        //  - Total (SW + HW) items < mMaxTotalStoreQueue
        Slog.d(TAG, "SPQ#ensureStoreQueueDepthLocked now=" + mStoreQueueItems);
        int hwStoreCount = 0;
        int totalStoreCount = 0;
        // Use descending iterator to keep the latest items.
@@ -355,6 +358,9 @@ class SnapshotPersistQueue {

    static boolean mustPersistByHardwareRender(@NonNull TaskSnapshot snapshot) {
        final HardwareBuffer hwBuffer = snapshot.getHardwareBuffer();
        if (hwBuffer.isClosed()) {
            Slog.d(TAG, "SPQ#mustPersistByHardwareRender snapshot is closed=" + snapshot);
        }
        final int pixelFormat = hwBuffer.getFormat();
        return !Flags.extendingPersistenceSnapshotQueueDepth()
                || (pixelFormat != PixelFormat.RGB_565 && pixelFormat != PixelFormat.RGBA_8888)
@@ -385,6 +391,9 @@ class SnapshotPersistQueue {
            // Remove duplicate request.
            mStoreQueueItems.removeIf(item -> {
                if (item.equals(this) && item.mSnapshot != mSnapshot) {
                    if (Flags.extendingPersistenceSnapshotQueueDepth()) {
                        Slog.d(TAG, "SPQ#onQueuedLocked remove item " + item + " this " + this);
                    }
                    item.mSnapshot.removeReference(TaskSnapshot.REFERENCE_PERSIST);
                    return true;
                }
@@ -577,6 +586,7 @@ class SnapshotPersistQueue {
            if (equals(testItem)) {
                final StoreWriteQueueItem swqi = (StoreWriteQueueItem) testItem;
                if (swqi.mSnapshot != mSnapshot) {
                    Slog.d(TAG, "SPQ#onRemovedFromWriteQueue add=" + this + " remove=" + swqi);
                    swqi.onRemovedFromWriteQueue();
                    return true;
                }
@@ -633,6 +643,7 @@ class SnapshotPersistQueue {
                final StoreWriteQueueItem swqi = (StoreWriteQueueItem) testItem;
                if (swqi.mId == mId && swqi.mUserId == mUserId
                        && swqi.mPersistInfoProvider == mPersistInfoProvider) {
                    Slog.d(TAG, "SPQ#onRemovedFromWriteQueue add=" + this + " remove=" + swqi);
                    swqi.onRemovedFromWriteQueue();
                    return true;
                }