Program: 199114
Project: 199114
Buggy source:
/** 
 * Returns a DisplayList. If the incoming displayList is null, one will be created. Otherwise, the same display list will be returned (after having been rendered into along the way, depending on the invalidation state of the view).
 * @param renderNode The previous version of this displayList, could be null.
 * @param isLayer Whether the requester of the display list is a layer. If so,the view will avoid creating a layer inside the resulting display list.
 * @return A new or reused DisplayList object.
 */
private void updateDisplayListIfDirty(@NonNull RenderNode renderNode,boolean isLayer){
  if (renderNode == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (!canHaveDisplayList()) {
    return;
  }
  renderNode.setScrollPosition(mScrollX,mScrollY);
  if ((mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == 0 || !renderNode.isValid() || (!isLayer && mRecreateDisplayList)) {
    if (renderNode.isValid() && !isLayer && !mRecreateDisplayList) {
      mPrivateFlags|=PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID;
      mPrivateFlags&=~PFLAG_DIRTY_MASK;
      dispatchGetDisplayList();
      return;
    }
    if (!isLayer) {
      mRecreateDisplayList=true;
    }
    boolean caching=false;
    int width=mRight - mLeft;
    int height=mBottom - mTop;
    int layerType=getLayerType();
    final HardwareCanvas canvas=renderNode.start(width,height);
    try {
      if (!isLayer && layerType != LAYER_TYPE_NONE) {
        if (layerType == LAYER_TYPE_HARDWARE) {
          final HardwareLayer layer=getHardwareLayer();
          if (layer != null && layer.isValid()) {
            canvas.drawHardwareLayer(layer,0,0,mLayerPaint);
          }
 else {
            canvas.saveLayer(0,0,mRight - mLeft,mBottom - mTop,mLayerPaint,Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG);
          }
          caching=true;
        }
 else {
          buildDrawingCache(true);
          Bitmap cache=getDrawingCache(true);
          if (cache != null) {
            canvas.drawBitmap(cache,0,0,mLayerPaint);
            caching=true;
          }
        }
      }
 else {
        computeScroll();
        canvas.translate(-mScrollX,-mScrollY);
        if (!isLayer) {
          mPrivateFlags|=PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID;
          mPrivateFlags&=~PFLAG_DIRTY_MASK;
        }
        if ((mPrivateFlags & PFLAG_SKIP_DRAW) == PFLAG_SKIP_DRAW) {
          dispatchDraw(canvas);
          if (mOverlay != null && !mOverlay.isEmpty()) {
            mOverlay.getOverlayView().draw(canvas);
          }
        }
 else {
          draw(canvas);
        }
      }
    }
  finally {
      renderNode.end(canvas);
      renderNode.setCaching(caching);
      if (isLayer) {
        renderNode.setLeftTopRightBottom(0,0,width,height);
      }
 else {
        setDisplayListProperties(renderNode);
      }
    }
  }
 else   if (!isLayer) {
    mPrivateFlags|=PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID;
    mPrivateFlags&=~PFLAG_DIRTY_MASK;
  }
}

Fixed version (ground truth):
/** 
 * Returns a DisplayList. If the incoming displayList is null, one will be created. Otherwise, the same display list will be returned (after having been rendered into along the way, depending on the invalidation state of the view).
 * @param renderNode The previous version of this displayList, could be null.
 * @param isLayer Whether the requester of the display list is a layer. If so,the view will avoid creating a layer inside the resulting display list.
 * @return A new or reused DisplayList object.
 */
private void updateDisplayListIfDirty(@NonNull RenderNode renderNode,boolean isLayer){
  if (renderNode == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (!canHaveDisplayList()) {
    return;
  }
  if ((mPrivateFlags & PFLAG_DRAWING_CACHE_VALID) == 0 || !renderNode.isValid() || (!isLayer && mRecreateDisplayList)) {
    if (renderNode.isValid() && !isLayer && !mRecreateDisplayList) {
      mPrivateFlags|=PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID;
      mPrivateFlags&=~PFLAG_DIRTY_MASK;
      dispatchGetDisplayList();
      return;
    }
    if (!isLayer) {
      mRecreateDisplayList=true;
    }
    boolean caching=false;
    int width=mRight - mLeft;
    int height=mBottom - mTop;
    int layerType=getLayerType();
    final HardwareCanvas canvas=renderNode.start(width,height);
    try {
      if (!isLayer && layerType != LAYER_TYPE_NONE) {
        if (layerType == LAYER_TYPE_HARDWARE) {
          final HardwareLayer layer=getHardwareLayer();
          if (layer != null && layer.isValid()) {
            canvas.drawHardwareLayer(layer,0,0,mLayerPaint);
          }
 else {
            canvas.saveLayer(0,0,mRight - mLeft,mBottom - mTop,mLayerPaint,Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | Canvas.CLIP_TO_LAYER_SAVE_FLAG);
          }
          caching=true;
        }
 else {
          buildDrawingCache(true);
          Bitmap cache=getDrawingCache(true);
          if (cache != null) {
            canvas.drawBitmap(cache,0,0,mLayerPaint);
            caching=true;
          }
        }
      }
 else {
        computeScroll();
        canvas.translate(-mScrollX,-mScrollY);
        if (!isLayer) {
          mPrivateFlags|=PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID;
          mPrivateFlags&=~PFLAG_DIRTY_MASK;
        }
        if ((mPrivateFlags & PFLAG_SKIP_DRAW) == PFLAG_SKIP_DRAW) {
          dispatchDraw(canvas);
          if (mOverlay != null && !mOverlay.isEmpty()) {
            mOverlay.getOverlayView().draw(canvas);
          }
        }
 else {
          draw(canvas);
        }
      }
    }
  finally {
      renderNode.end(canvas);
      renderNode.setCaching(caching);
      if (isLayer) {
        renderNode.setLeftTopRightBottom(0,0,width,height);
      }
 else {
        setDisplayListProperties(renderNode);
      }
    }
  }
 else   if (!isLayer) {
    mPrivateFlags|=PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID;
    mPrivateFlags&=~PFLAG_DIRTY_MASK;
  }
}