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

Commit cc465c76 authored by wilsonshih's avatar wilsonshih
Browse files

Close TaskSnapshot hardware buffer before remove from cache.

Bug: 325263625
Test: verify hardware buffer will be close immediately.
Change-Id: I0c568378b8c79adaf11a247ccf77d165d2a923b8
parent 12e867a9
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package com.android.server.wm;

import android.annotation.Nullable;
import android.hardware.HardwareBuffer;
import android.util.ArrayMap;
import android.window.TaskSnapshot;

@@ -92,6 +93,10 @@ abstract class SnapshotCache<TYPE extends WindowContainer> {
            if (entry != null) {
                mAppIdMap.remove(entry.topApp);
                mRunningCache.remove(id);
                final HardwareBuffer buffer = entry.snapshot.getHardwareBuffer();
                if (buffer != null) {
                    buffer.close();
                }
            }
        }
    }