private static AnimatedDrawableFrameInfo.DisposalMethod translateFrameDisposal(int raw) {
    switch (raw) {
      case 2: // restore to background
        return AnimatedDrawableFrameInfo.DisposalMethod.DISPOSE_TO_BACKGROUND;
      case 3: // restore to previous
        return AnimatedDrawableFrameInfo.DisposalMethod.DISPOSE_TO_PREVIOUS;
      case 1: // do not dispose
      // fallthrough
      default: // unspecified
        return AnimatedDrawableFrameInfo.DisposalMethod.DISPOSE_DO_NOT;
    }
  }
A simple Gif decoder that uses Android's {@link Movie} class to decode Gif images.
animated-gif-lite/src/main/java/com/facebook/animated/giflite/GifDecoder.java