Repository: flutter/flutter
File: engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java (Java)

Code before:
   * behavior if set to true while running in a Vulkan (Impeller) context.
   */
  @VisibleForTesting public static boolean debugForceSurfaceProducerGlTextures = false;

  /**
   * Returns true if this device has a known {@link android.hardware.HardwareBuffer} defect.
   *
   * <p>Huawei devices on API 29 or below have {@link android.media.ImageReader} issues that cause
   * video playback failures due to defective HardwareBuffer implementations.
   *
   * @see <a href="https://github.com/flutter/flutter/issues/166481">#166481</a>
   */
  private static boolean hasAndroidHardwareBufferDefect() {
    return Build.VERSION.SDK_INT <= API_LEVELS.API_29
        && "HUAWEI".equalsIgnoreCase(Build.MANUFACTURER);
  }

  /** Whether to disable clearing of the Surface used to render platform views. */
  @VisibleForTesting public static boolean debugDisableSurfaceClear = false;

  private static final String TAG = "FlutterRenderer";

  @NonNull private final FlutterJNI flutterJNI;
  @NonNull private final AtomicLong nextTextureId = new AtomicLong(0L);
  @Nullable private Surface surface;
  private boolean isDisplayingFlutterUi = false;
  private final Handler handler = new Handler();

  @NonNull
  private final Set<WeakReference<TextureRegistry.OnTrimMemoryListener>> onTrimMemoryListeners =
      new HashSet<>();

  @NonNull private final List<ImageReaderSurfaceProducer> imageReaderProducers = new ArrayList<>();

  @NonNull
  private final FlutterUiDisplayListener flutterUiDisplayListener =
      new FlutterUiDisplayListener() {
        @Override
        public void onFlutterUiDisplayed() {
          isDisplayingFlutterUi = true;
        }

        @Override
        public void onFlutterUiNoLongerDisplayed() {
          isDisplayingFlutterUi = false;
        }
      };

  public FlutterRenderer(@NonNull FlutterJNI flutterJNI) {
    this.flutterJNI = flutterJNI;
    this.flutterJNI.addIsDisplayingFlutterUiListener(flutterUiDisplayListener);

Review comment (bug):
```suggestion
    // To test if some device should be added from this list app developers first should attempt to play a video and see a failure in the logs. 
    /// ```E/ACodec: Failed to allocate buffers after transitioning to IDLE state (error 0xfffffc0e)
    /// W/ACodec: [OMX.hisi.video.decoder.avc] setting nBufferCountActual to 12 failed: -1010 E/MediaCodecVideoRenderer: Video codec error```
     /// Then try setting `FlutterRenderer.debugForceSurfaceProducerGlTextures = true` in an example app. 
    /// If the video plays then that is a strong signal that this method should be updated to include the tested device. 
    return Build.VERSION.SDK_INT <= API_LEVELS.API_29
```

Code after:
   * behavior if set to true while running in a Vulkan (Impeller) context.
   */
  @VisibleForTesting public static boolean debugForceSurfaceProducerGlTextures = false;

  /**
   * Returns true if this device has a known {@link android.hardware.HardwareBuffer} defect.
   *
   * <p>Huawei devices on API 29 or below have {@link android.media.ImageReader} issues that cause
   * video playback failures due to defective HardwareBuffer implementations.
   *
   * @see <a href="https://github.com/flutter/flutter/issues/166481">#166481</a> See <a
   *     href="https://github.com/flutter/flutter/issues/156459">#156459</a> See <a
   *     href="https://github.com/flutter/flutter/issues/154068">#154068</a> See <a
   *     href="https://github.com/flutter/engine/pull/54879">engine pr #54879</a>
   */
  private static boolean hasAndroidHardwareBufferDefect() {
    // To test if some device should be added from this list app developers first should attempt to
    // play a video and see a failure in the logs.
    /// ```E/ACodec: Failed to allocate buffers after transitioning to IDLE state (error 0xfffffc0e)
    /// W/ACodec: [OMX.hisi.video.decoder.avc] setting nBufferCountActual to 12 failed: -1010
    // E/MediaCodecVideoRenderer: Video codec error```
    /// Then try setting `FlutterRenderer.debugForceSurfaceProducerGlTextures = true` in an example
    // app.
    /// If the video plays then that is a strong signal that this method should be updated to
    // include the tested device.
    return Build.VERSION.SDK_INT <= API_LEVELS.API_29
        && "HUAWEI".equalsIgnoreCase(Build.MANUFACTURER);
  }

  /** Whether to disable clearing of the Surface used to render platform views. */
  @VisibleForTesting public static boolean debugDisableSurfaceClear = false;

  private static final String TAG = "FlutterRenderer";

  @NonNull private final FlutterJNI flutterJNI;
  @NonNull private final AtomicLong nextTextureId = new AtomicLong(0L);
  @Nullable private Surface surface;
  private boolean isDisplayingFlutterUi = false;
  private final Handler handler = new Handler();

  @NonNull
  private final Set<WeakReference<TextureRegistry.OnTrimMemoryListener>> onTrimMemoryListeners =
      new HashSet<>();

  @NonNull private final List<ImageReaderSurfaceProducer> imageReaderProducers = new ArrayList<>();

  @NonNull
  private final FlutterUiDisplayListener flutterUiDisplayListener =
      new FlutterUiDisplayListener() {
        @Override
        public void onFlutterUiDisplayed() {