File tree Expand file tree Collapse file tree
io/flutter/embedding/engine/renderer
test/io/flutter/embedding/engine/renderer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -414,6 +414,11 @@ final class ImageReaderSurfaceProducer
414414 // Flip when debugging to see verbose logs.
415415 private static final boolean VERBOSE_LOGS = false ;
416416
417+ // If we cleanup the ImageReaders on memory pressure it breaks VirtualDisplay
418+ // backed platform views. Disable for now as this is only necessary to work
419+ // around a Samsung-specific Android 14 bug.
420+ private static final boolean CLEANUP_ON_MEMORY_PRESSURE = false ;
421+
417422 private final long id ;
418423
419424 private boolean released ;
@@ -649,6 +654,9 @@ PerImage dequeueImage() {
649654
650655 @ Override
651656 public void onTrimMemory (int level ) {
657+ if (!CLEANUP_ON_MEMORY_PRESSURE ) {
658+ return ;
659+ }
652660 cleanup ();
653661 createNewReader = true ;
654662 }
Original file line number Diff line number Diff line change @@ -648,11 +648,12 @@ public void ImageReaderSurfaceProducerTrimMemoryCallback() {
648648 assertEquals (1 , texture .numImages ());
649649
650650 // Invoke the onTrimMemory callback.
651+ // This should do nothing.
651652 texture .onTrimMemory (0 );
652653 shadowOf (Looper .getMainLooper ()).idle ();
653654
654- assertEquals (0 , texture .numImageReaders ());
655- assertEquals (0 , texture .numImages ());
655+ assertEquals (1 , texture .numImageReaders ());
656+ assertEquals (1 , texture .numImages ());
656657 }
657658
658659 // A 0x0 ImageReader is a runtime error.
You can’t perform that action at this time.
0 commit comments