Enum TextureRegistry.SurfaceLifecycle

java.lang.Object
java.lang.Enum<TextureRegistry.SurfaceLifecycle>
io.flutter.view.TextureRegistry.SurfaceLifecycle
All Implemented Interfaces:
Serializable, Comparable<TextureRegistry.SurfaceLifecycle>, java.lang.constant.Constable
Enclosing interface:
TextureRegistry

public static enum TextureRegistry.SurfaceLifecycle extends Enum<TextureRegistry.SurfaceLifecycle>
How a TextureRegistry.SurfaceProducer created by TextureRegistry.createSurfaceProducer() manages the lifecycle of the created surface.
  • Enum Constant Details

    • manual

      public static final TextureRegistry.SurfaceLifecycle manual
      The surface and latest image should be kept, even if the app enters the background.

      The application, or calling code, can choose to (manually) reset the surface at the appropriate time (such as to lower memory pressure, or cleanup an unused surface), but by default the surface will never be reset, and as a result, new images do not have to be drawn to the surface.

      This is an appropriate lifecycle for external textures, as it is not guaranteed that new images will be drawn to the surface, and whether the image should be kept when the app is backgrounded.

    • resetInBackground

      public static final TextureRegistry.SurfaceLifecycle resetInBackground
      The surface will be reset if the app enters the background.

      While the application can choose to manually reset the surface, Flutter may automatically reset the surface when the app enters the background. If the surface is reset, and no new images are drawn to the surface, the texture will appear blank.

      This is an appropriate lifecycle for platform views, as the platform implementation will request a new surface, and draw to, as appropriate when resuming from the background, and producing a new image when coming back to the foreground.

  • Method Details

    • values

      public static TextureRegistry.SurfaceLifecycle[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static TextureRegistry.SurfaceLifecycle valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null