nus-yam/ex-repair huggingface dataset:
Program: 1674
Project: 1674
Buggy source:
/** 
 * Get the format for this image. This format determines the number of ByteBuffers needed to represent the image, and the general layout of the pixel data in each in ByteBuffer. The format is one of the values from  {@link android.graphics.ImageFormat}. The mapping between the formats and the planes is as follows: <table> <th> <td>Format</td> <td>Plane count</td> <td>Layout details</td> </th> <tr> <td>  {@link android.graphics.ImageFormat#JPEG}</td> <td>1</td> <td>Compressed data, so row and pixel strides are 0. To uncompress, use  {@link android.graphics.BitmapFactory#decodeByteArray}.</td> </tr> <tr> <td>  {@link android.graphics.ImageFormat#YUV_420_888}</td> <td>3</td> <td>A luminance plane followed by the Cb and Cr chroma planes. The chroma planes have half the width and height of the luminance plane (4:2:0 subsampling). Each pixel sample in each plane has 8 bits. Each plane has its own row stride and pixel stride.</td> </tr> <tr> <td>  {@link android.graphics.ImageFormat#RAW_SENSOR}</td> <td>1</td> <td>A single plane of raw sensor image data, with 16 bits per color sample. The details of the layout need to be queried from the source of the raw sensor data, such as  {@link android.hardware.camera2.CameraDevice}. </td> </tr> </table>
 * @see android.graphics.ImageFormat
 */
public int getFormat();

Fixed version (ground truth):
/** 
 * Get the format for this image. This format determines the number of ByteBuffers needed to represent the image, and the general layout of the pixel data in each in ByteBuffer. The format is one of the values from  {@link android.graphics.ImageFormat}. The mapping between the formats and the planes is as follows: <table> <tr> <th>Format</th> <th>Plane count</th> <th>Layout details</th> </tr> <tr> <td>  {@link android.graphics.ImageFormat#JPEG}</td> <td>1</td> <td>Compressed data, so row and pixel strides are 0. To uncompress, use  {@link android.graphics.BitmapFactory#decodeByteArray}.</td> </tr> <tr> <td>  {@link android.graphics.ImageFormat#YUV_420_888}</td> <td>3</td> <td>A luminance plane followed by the Cb and Cr chroma planes. The chroma planes have half the width and height of the luminance plane (4:2:0 subsampling). Each pixel sample in each plane has 8 bits. Each plane has its own row stride and pixel stride.</td> </tr> <tr> <td>  {@link android.graphics.ImageFormat#RAW_SENSOR}</td> <td>1</td> <td>A single plane of raw sensor image data, with 16 bits per color sample. The details of the layout need to be queried from the source of the raw sensor data, such as  {@link android.hardware.camera2.CameraDevice}. </td> </tr> </table>
 * @see android.graphics.ImageFormat
 */
public int getFormat();
Program: 1675
Project: 1675
Buggy source:
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  int currentHour=getCurrentHour();
  mIs24HourView=is24HourView;
  getHourFormatData();
  updateHourControl();
  setCurrentHour(currentHour);
  updateMinuteControl();
  updateAmPmControl();
}

Fixed version (ground truth):
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  int currentHour=getCurrentHour();
  mIs24HourView=is24HourView;
  getHourFormatData();
  updateHourControl();
  setCurrentHour(currentHour,false);
  updateMinuteControl();
  updateAmPmControl();
}
Program: 1676
Project: 1676
Buggy source:
/** 
 * Set the current hour.
 */
public void setCurrentHour(Integer currentHour){
  if (currentHour == null || currentHour == getCurrentHour()) {
    return;
  }
  if (!is24HourView()) {
    if (currentHour >= HOURS_IN_HALF_DAY) {
      mIsAm=false;
      if (currentHour > HOURS_IN_HALF_DAY) {
        currentHour=currentHour - HOURS_IN_HALF_DAY;
      }
    }
 else {
      mIsAm=true;
      if (currentHour == 0) {
        currentHour=HOURS_IN_HALF_DAY;
      }
    }
    updateAmPmControl();
  }
  mHourSpinner.setValue(currentHour);
  onTimeChanged();
}

Fixed version (ground truth):
private void setCurrentHour(Integer currentHour,boolean notifyTimeChanged){
  if (currentHour == null || currentHour == getCurrentHour()) {
    return;
  }
  if (!is24HourView()) {
    if (currentHour >= HOURS_IN_HALF_DAY) {
      mIsAm=false;
      if (currentHour > HOURS_IN_HALF_DAY) {
        currentHour=currentHour - HOURS_IN_HALF_DAY;
      }
    }
 else {
      mIsAm=true;
      if (currentHour == 0) {
        currentHour=HOURS_IN_HALF_DAY;
      }
    }
    updateAmPmControl();
  }
  mHourSpinner.setValue(currentHour);
  if (notifyTimeChanged) {
    onTimeChanged();
  }
}
Program: 1677
Project: 1677
Buggy source:
/** 
 * Get the format for this image. This format determines the number of ByteBuffers needed to represent the image, and the general layout of the pixel data in each in ByteBuffer. The format is one of the values from  {@link android.graphics.ImageFormat}. The mapping between the formats and the planes is as follows: <table> <th> <td>Format</td> <td>Plane count</td> <td>Layout details</td> </th> <tr> <td>  {@link android.graphics.ImageFormat#JPEG}</td> <td>1</td> <td>Compressed data, so row and pixel strides are 0. To uncompress, use  {@link android.graphics.BitmapFactory#decodeByteArray}.</td> </tr> <tr> <td>  {@link android.graphics.ImageFormat#YUV_420_888}</td> <td>3</td> <td>A luminance plane followed by the Cb and Cr chroma planes. The chroma planes have half the width and height of the luminance plane (4:2:0 subsampling). Each pixel sample in each plane has 8 bits. Each plane has its own row stride and pixel stride.</td> </tr> <tr> <td>  {@link android.graphics.ImageFormat#RAW_SENSOR}</td> <td>1</td> <td>A single plane of raw sensor image data, with 16 bits per color sample. The details of the layout need to be queried from the source of the raw sensor data, such as  {@link android.hardware.camera2.CameraDevice}. </td> </tr> </table>
 * @see android.graphics.ImageFormat
 */
public int getFormat();

Fixed version (ground truth):
/** 
 * Get the format for this image. This format determines the number of ByteBuffers needed to represent the image, and the general layout of the pixel data in each in ByteBuffer. The format is one of the values from  {@link android.graphics.ImageFormat}. The mapping between the formats and the planes is as follows: <table> <tr> <th>Format</th> <th>Plane count</th> <th>Layout details</th> </tr> <tr> <td>  {@link android.graphics.ImageFormat#JPEG}</td> <td>1</td> <td>Compressed data, so row and pixel strides are 0. To uncompress, use  {@link android.graphics.BitmapFactory#decodeByteArray}.</td> </tr> <tr> <td>  {@link android.graphics.ImageFormat#YUV_420_888}</td> <td>3</td> <td>A luminance plane followed by the Cb and Cr chroma planes. The chroma planes have half the width and height of the luminance plane (4:2:0 subsampling). Each pixel sample in each plane has 8 bits. Each plane has its own row stride and pixel stride.</td> </tr> <tr> <td>  {@link android.graphics.ImageFormat#RAW_SENSOR}</td> <td>1</td> <td>A single plane of raw sensor image data, with 16 bits per color sample. The details of the layout need to be queried from the source of the raw sensor data, such as  {@link android.hardware.camera2.CameraDevice}. </td> </tr> </table>
 * @see android.graphics.ImageFormat
 */
public int getFormat();
Program: 1678
Project: 1678
Buggy source:
/** 
 * Get the format for this image. This format determines the number of ByteBuffers needed to represent the image, and the general layout of the pixel data in each in ByteBuffer. The format is one of the values from  {@link android.graphics.ImageFormat}. The mapping between the formats and the planes is as follows: <table> <th> <td>Format</td> <td>Plane count</td> <td>Layout details</td> </th> <tr> <td>  {@link android.graphics.ImageFormat#JPEG}</td> <td>1</td> <td>Compressed data, so row and pixel strides are 0. To uncompress, use  {@link android.graphics.BitmapFactory#decodeByteArray}.</td> </tr> <tr> <td>  {@link android.graphics.ImageFormat#YUV_420_888}</td> <td>3</td> <td>A luminance plane followed by the Cb and Cr chroma planes. The chroma planes have half the width and height of the luminance plane (4:2:0 subsampling). Each pixel sample in each plane has 8 bits. Each plane has its own row stride and pixel stride.</td> </tr> <tr> <td>  {@link android.graphics.ImageFormat#RAW_SENSOR}</td> <td>1</td> <td>A single plane of raw sensor image data, with 16 bits per color sample. The details of the layout need to be queried from the source of the raw sensor data, such as  {@link android.hardware.camera2.CameraDevice}. </td> </tr> </table>
 * @see android.graphics.ImageFormat
 */
public int getFormat();

Fixed version (ground truth):
/** 
 * Get the format for this image. This format determines the number of ByteBuffers needed to represent the image, and the general layout of the pixel data in each in ByteBuffer. The format is one of the values from  {@link android.graphics.ImageFormat}. The mapping between the formats and the planes is as follows: <table> <tr> <th>Format</th> <th>Plane count</th> <th>Layout details</th> </tr> <tr> <td>  {@link android.graphics.ImageFormat#JPEG}</td> <td>1</td> <td>Compressed data, so row and pixel strides are 0. To uncompress, use  {@link android.graphics.BitmapFactory#decodeByteArray}.</td> </tr> <tr> <td>  {@link android.graphics.ImageFormat#YUV_420_888}</td> <td>3</td> <td>A luminance plane followed by the Cb and Cr chroma planes. The chroma planes have half the width and height of the luminance plane (4:2:0 subsampling). Each pixel sample in each plane has 8 bits. Each plane has its own row stride and pixel stride.</td> </tr> <tr> <td>  {@link android.graphics.ImageFormat#RAW_SENSOR}</td> <td>1</td> <td>A single plane of raw sensor image data, with 16 bits per color sample. The details of the layout need to be queried from the source of the raw sensor data, such as  {@link android.hardware.camera2.CameraDevice}. </td> </tr> </table>
 * @see android.graphics.ImageFormat
 */
public int getFormat();
Program: 1679
Project: 1679
Buggy source:
final void freeTextLayoutCachesIfNeeded(int configDiff){
  if (configDiff != 0) {
    boolean hasLocaleConfigChange=((configDiff & ActivityInfo.CONFIG_LOCALE) != 0);
    if (hasLocaleConfigChange) {
      Canvas.freeTextLayoutCaches();
      if (DEBUG_CONFIGURATION)       Slog.v(TAG,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
static void freeTextLayoutCachesIfNeeded(int configDiff){
  if (configDiff != 0) {
    boolean hasLocaleConfigChange=((configDiff & ActivityInfo.CONFIG_LOCALE) != 0);
    if (hasLocaleConfigChange) {
      Canvas.freeTextLayoutCaches();
      if (DEBUG_CONFIGURATION)       Slog.v(TAG,"String_Node_Str");
    }
  }
}
Program: 1680
Project: 1680
Buggy source:
@Override protected void onDetachedFromWindow(){
  cancelClearAnimation();
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  cancelClearAnimation();
}
Program: 1681
Project: 1681
Buggy source:
/** 
 * Reset native resources. This is called when cleaning up the state of display lists during destruction of hardware resources, to ensure that we do not hold onto obsolete resources after related resources are gone.
 * @hide
 */
public abstract void reset();

Fixed version (ground truth):
/** 
 * Reset native resources. This is called when cleaning up the state of display lists during destruction of hardware resources, to ensure that we do not hold onto obsolete resources after related resources are gone.
 * @see #clear()
 * @hide
 */
public abstract void reset();
Program: 1682
Project: 1682
Buggy source:
/** 
 * Clears resources held onto by this display list. After calling this method  {@link #isValid()} will return false.
 * @see #isValid()
 */
public abstract void clear();

Fixed version (ground truth):
/** 
 * Clears resources held onto by this display list. After calling this method  {@link #isValid()} will return false.
 * @see #isValid()
 * @see #reset()
 */
public abstract void clear();
Program: 1683
Project: 1683
Buggy source:
@Override public void reset(){
  if (hasNativeDisplayList()) {
    nReset(mFinalizer.mNativeDisplayList);
  }
}

Fixed version (ground truth):
@Override public void reset(){
  if (hasNativeDisplayList()) {
    nReset(mFinalizer.mNativeDisplayList);
  }
  clear();
}
Program: 1684
Project: 1684
Buggy source:
/** 
 * Destroys all hardware rendering resources. This method is invoked when the system needs to reclaim resources. Upon execution of this method, you should free any OpenGL resources created by the view. Note: you <strong>must</strong> call <code>super.destroyHardwareResources()</code> when overriding this method.
 * @hide
 */
protected void destroyHardwareResources(){
  clearDisplayList();
  destroyLayer(true);
}

Fixed version (ground truth):
/** 
 * Destroys all hardware rendering resources. This method is invoked when the system needs to reclaim resources. Upon execution of this method, you should free any OpenGL resources created by the view. Note: you <strong>must</strong> call <code>super.destroyHardwareResources()</code> when overriding this method.
 * @hide
 */
protected void destroyHardwareResources(){
  resetDisplayList();
  destroyLayer(true);
}
Program: 1685
Project: 1685
Buggy source:
private void cleanupDraw(){
  if (mAttachInfo != null) {
    if (mDisplayList != null) {
      mDisplayList.markDirty();
      mAttachInfo.mViewRootImpl.enqueueDisplayList(mDisplayList);
    }
    mAttachInfo.mViewRootImpl.cancelInvalidate(this);
  }
 else {
    clearDisplayList();
  }
}

Fixed version (ground truth):
private void cleanupDraw(){
  if (mAttachInfo != null) {
    if (mDisplayList != null) {
      mDisplayList.markDirty();
      mAttachInfo.mViewRootImpl.enqueueDisplayList(mDisplayList);
    }
    mAttachInfo.mViewRootImpl.cancelInvalidate(this);
  }
 else {
    resetDisplayList();
  }
}
Program: 1686
Project: 1686
Buggy source:
/** 
 * Destroys this View's hardware layer if possible.
 * @return True if the layer was destroyed, false otherwise.
 * @see #setLayerType(int,android.graphics.Paint)
 * @see #LAYER_TYPE_HARDWARE
 */
boolean destroyLayer(boolean valid){
  if (mHardwareLayer != null) {
    AttachInfo info=mAttachInfo;
    if (info != null && info.mHardwareRenderer != null && info.mHardwareRenderer.isEnabled() && (valid || info.mHardwareRenderer.validate())) {
      info.mHardwareRenderer.cancelLayerUpdate(mHardwareLayer);
      mHardwareLayer.destroy();
      mHardwareLayer=null;
      if (mDisplayList != null) {
        mDisplayList.reset();
      }
      invalidate(true);
      invalidateParentCaches();
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Destroys this View's hardware layer if possible.
 * @return True if the layer was destroyed, false otherwise.
 * @see #setLayerType(int,android.graphics.Paint)
 * @see #LAYER_TYPE_HARDWARE
 */
boolean destroyLayer(boolean valid){
  if (mHardwareLayer != null) {
    AttachInfo info=mAttachInfo;
    if (info != null && info.mHardwareRenderer != null && info.mHardwareRenderer.isEnabled() && (valid || info.mHardwareRenderer.validate())) {
      info.mHardwareRenderer.cancelLayerUpdate(mHardwareLayer);
      mHardwareLayer.destroy();
      mHardwareLayer=null;
      invalidate(true);
      invalidateParentCaches();
    }
    return true;
  }
  return false;
}
Program: 1687
Project: 1687
Buggy source:
void destroyHardwareLayers(){
  if (mThread != Thread.currentThread()) {
    if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
      HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_MODERATE);
    }
  }
 else {
    if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
      mAttachInfo.mHardwareRenderer.destroyLayers(mView);
    }
  }
}

Fixed version (ground truth):
void destroyHardwareLayers(){
  if (mThread != Thread.currentThread()) {
    if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
      HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_MODERATE);
    }
  }
 else {
    invalidateDisplayLists();
    if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
      mAttachInfo.mHardwareRenderer.destroyLayers(mView);
    }
  }
}
Program: 1688
Project: 1688
Buggy source:
void invalidateDisplayLists(){
  final ArrayList<DisplayList> displayLists=mDisplayLists;
  final int count=displayLists.size();
  for (int i=0; i < count; i++) {
    final DisplayList displayList=displayLists.get(i);
    if (displayList.isDirty()) {
      displayList.clear();
    }
  }
  displayLists.clear();
}

Fixed version (ground truth):
void invalidateDisplayLists(){
  final ArrayList<DisplayList> displayLists=mDisplayLists;
  final int count=displayLists.size();
  for (int i=0; i < count; i++) {
    final DisplayList displayList=displayLists.get(i);
    if (displayList.isDirty()) {
      displayList.reset();
    }
  }
  displayLists.clear();
}
Program: 1689
Project: 1689
Buggy source:
void destroyHardwareResources(){
  if (mAttachInfo.mHardwareRenderer != null) {
    if (mAttachInfo.mHardwareRenderer.isEnabled()) {
      mAttachInfo.mHardwareRenderer.destroyLayers(mView);
    }
    mAttachInfo.mHardwareRenderer.destroy(false);
  }
}

Fixed version (ground truth):
void destroyHardwareResources(){
  invalidateDisplayLists();
  if (mAttachInfo.mHardwareRenderer != null) {
    mAttachInfo.mHardwareRenderer.destroyHardwareResources(mView);
    mAttachInfo.mHardwareRenderer.destroy(false);
  }
}
Program: 1690
Project: 1690
Buggy source:
public void startTrimMemory(int level){
  if (HardwareRenderer.isAvailable()) {
    if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE || (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE && !ActivityManager.isHighEndGfx())) {
synchronized (mLock) {
        for (int i=mRoots.size() - 1; i >= 0; --i) {
          mRoots.get(i).terminateHardwareResources();
        }
      }
      mNeedsEglTerminate=true;
      HardwareRenderer.startTrimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
      return;
    }
    HardwareRenderer.startTrimMemory(level);
  }
}

Fixed version (ground truth):
public void startTrimMemory(int level){
  if (HardwareRenderer.isAvailable()) {
    if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE || (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE && !ActivityManager.isHighEndGfx())) {
synchronized (mLock) {
        for (int i=mRoots.size() - 1; i >= 0; --i) {
          mRoots.get(i).destroyHardwareResources();
        }
      }
      mNeedsEglTerminate=true;
      HardwareRenderer.startTrimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
      return;
    }
    HardwareRenderer.startTrimMemory(level);
  }
}
Program: 1691
Project: 1691
Buggy source:
@Override protected void onDetachedFromWindow(){
  removeAllCallbacks();
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  removeAllCallbacks();
}
Program: 1692
Project: 1692
Buggy source:
final void freeTextLayoutCachesIfNeeded(int configDiff){
  if (configDiff != 0) {
    boolean hasLocaleConfigChange=((configDiff & ActivityInfo.CONFIG_LOCALE) != 0);
    if (hasLocaleConfigChange) {
      Canvas.freeTextLayoutCaches();
      if (DEBUG_CONFIGURATION)       Slog.v(TAG,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
static void freeTextLayoutCachesIfNeeded(int configDiff){
  if (configDiff != 0) {
    boolean hasLocaleConfigChange=((configDiff & ActivityInfo.CONFIG_LOCALE) != 0);
    if (hasLocaleConfigChange) {
      Canvas.freeTextLayoutCaches();
      if (DEBUG_CONFIGURATION)       Slog.v(TAG,"String_Node_Str");
    }
  }
}
Program: 1693
Project: 1693
Buggy source:
@Override protected void onDetachedFromWindow(){
  cancelClearAnimation();
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  cancelClearAnimation();
}
Program: 1694
Project: 1694
Buggy source:
/** 
 * Reset native resources. This is called when cleaning up the state of display lists during destruction of hardware resources, to ensure that we do not hold onto obsolete resources after related resources are gone.
 * @hide
 */
public abstract void reset();

Fixed version (ground truth):
/** 
 * Reset native resources. This is called when cleaning up the state of display lists during destruction of hardware resources, to ensure that we do not hold onto obsolete resources after related resources are gone.
 * @see #clear()
 * @hide
 */
public abstract void reset();
Program: 1695
Project: 1695
Buggy source:
/** 
 * Clears resources held onto by this display list. After calling this method  {@link #isValid()} will return false.
 * @see #isValid()
 */
public abstract void clear();

Fixed version (ground truth):
/** 
 * Clears resources held onto by this display list. After calling this method  {@link #isValid()} will return false.
 * @see #isValid()
 * @see #reset()
 */
public abstract void clear();
Program: 1696
Project: 1696
Buggy source:
@Override public void reset(){
  if (hasNativeDisplayList()) {
    nReset(mFinalizer.mNativeDisplayList);
  }
}

Fixed version (ground truth):
@Override public void reset(){
  if (hasNativeDisplayList()) {
    nReset(mFinalizer.mNativeDisplayList);
  }
  clear();
}
Program: 1697
Project: 1697
Buggy source:
/** 
 * Destroys all hardware rendering resources. This method is invoked when the system needs to reclaim resources. Upon execution of this method, you should free any OpenGL resources created by the view. Note: you <strong>must</strong> call <code>super.destroyHardwareResources()</code> when overriding this method.
 * @hide
 */
protected void destroyHardwareResources(){
  clearDisplayList();
  destroyLayer(true);
}

Fixed version (ground truth):
/** 
 * Destroys all hardware rendering resources. This method is invoked when the system needs to reclaim resources. Upon execution of this method, you should free any OpenGL resources created by the view. Note: you <strong>must</strong> call <code>super.destroyHardwareResources()</code> when overriding this method.
 * @hide
 */
protected void destroyHardwareResources(){
  resetDisplayList();
  destroyLayer(true);
}
Program: 1698
Project: 1698
Buggy source:
private void cleanupDraw(){
  if (mAttachInfo != null) {
    if (mDisplayList != null) {
      mDisplayList.markDirty();
      mAttachInfo.mViewRootImpl.enqueueDisplayList(mDisplayList);
    }
    mAttachInfo.mViewRootImpl.cancelInvalidate(this);
  }
 else {
    clearDisplayList();
  }
}

Fixed version (ground truth):
private void cleanupDraw(){
  if (mAttachInfo != null) {
    if (mDisplayList != null) {
      mDisplayList.markDirty();
      mAttachInfo.mViewRootImpl.enqueueDisplayList(mDisplayList);
    }
    mAttachInfo.mViewRootImpl.cancelInvalidate(this);
  }
 else {
    resetDisplayList();
  }
}
Program: 1699
Project: 1699
Buggy source:
/** 
 * Destroys this View's hardware layer if possible.
 * @return True if the layer was destroyed, false otherwise.
 * @see #setLayerType(int,android.graphics.Paint)
 * @see #LAYER_TYPE_HARDWARE
 */
boolean destroyLayer(boolean valid){
  if (mHardwareLayer != null) {
    AttachInfo info=mAttachInfo;
    if (info != null && info.mHardwareRenderer != null && info.mHardwareRenderer.isEnabled() && (valid || info.mHardwareRenderer.validate())) {
      info.mHardwareRenderer.cancelLayerUpdate(mHardwareLayer);
      mHardwareLayer.destroy();
      mHardwareLayer=null;
      if (mDisplayList != null) {
        mDisplayList.reset();
      }
      invalidate(true);
      invalidateParentCaches();
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Destroys this View's hardware layer if possible.
 * @return True if the layer was destroyed, false otherwise.
 * @see #setLayerType(int,android.graphics.Paint)
 * @see #LAYER_TYPE_HARDWARE
 */
boolean destroyLayer(boolean valid){
  if (mHardwareLayer != null) {
    AttachInfo info=mAttachInfo;
    if (info != null && info.mHardwareRenderer != null && info.mHardwareRenderer.isEnabled() && (valid || info.mHardwareRenderer.validate())) {
      info.mHardwareRenderer.cancelLayerUpdate(mHardwareLayer);
      mHardwareLayer.destroy();
      mHardwareLayer=null;
      invalidate(true);
      invalidateParentCaches();
    }
    return true;
  }
  return false;
}
Program: 1700
Project: 1700
Buggy source:
void destroyHardwareLayers(){
  if (mThread != Thread.currentThread()) {
    if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
      HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_MODERATE);
    }
  }
 else {
    if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
      mAttachInfo.mHardwareRenderer.destroyLayers(mView);
    }
  }
}

Fixed version (ground truth):
void destroyHardwareLayers(){
  if (mThread != Thread.currentThread()) {
    if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
      HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_MODERATE);
    }
  }
 else {
    invalidateDisplayLists();
    if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
      mAttachInfo.mHardwareRenderer.destroyLayers(mView);
    }
  }
}
Program: 1701
Project: 1701
Buggy source:
void invalidateDisplayLists(){
  final ArrayList<DisplayList> displayLists=mDisplayLists;
  final int count=displayLists.size();
  for (int i=0; i < count; i++) {
    final DisplayList displayList=displayLists.get(i);
    if (displayList.isDirty()) {
      displayList.clear();
    }
  }
  displayLists.clear();
}

Fixed version (ground truth):
void invalidateDisplayLists(){
  final ArrayList<DisplayList> displayLists=mDisplayLists;
  final int count=displayLists.size();
  for (int i=0; i < count; i++) {
    final DisplayList displayList=displayLists.get(i);
    if (displayList.isDirty()) {
      displayList.reset();
    }
  }
  displayLists.clear();
}
Program: 1702
Project: 1702
Buggy source:
void destroyHardwareResources(){
  if (mAttachInfo.mHardwareRenderer != null) {
    if (mAttachInfo.mHardwareRenderer.isEnabled()) {
      mAttachInfo.mHardwareRenderer.destroyLayers(mView);
    }
    mAttachInfo.mHardwareRenderer.destroy(false);
  }
}

Fixed version (ground truth):
void destroyHardwareResources(){
  invalidateDisplayLists();
  if (mAttachInfo.mHardwareRenderer != null) {
    mAttachInfo.mHardwareRenderer.destroyHardwareResources(mView);
    mAttachInfo.mHardwareRenderer.destroy(false);
  }
}
Program: 1703
Project: 1703
Buggy source:
public void startTrimMemory(int level){
  if (HardwareRenderer.isAvailable()) {
    if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE || (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE && !ActivityManager.isHighEndGfx())) {
synchronized (mLock) {
        for (int i=mRoots.size() - 1; i >= 0; --i) {
          mRoots.get(i).terminateHardwareResources();
        }
      }
      mNeedsEglTerminate=true;
      HardwareRenderer.startTrimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
      return;
    }
    HardwareRenderer.startTrimMemory(level);
  }
}

Fixed version (ground truth):
public void startTrimMemory(int level){
  if (HardwareRenderer.isAvailable()) {
    if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE || (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE && !ActivityManager.isHighEndGfx())) {
synchronized (mLock) {
        for (int i=mRoots.size() - 1; i >= 0; --i) {
          mRoots.get(i).destroyHardwareResources();
        }
      }
      mNeedsEglTerminate=true;
      HardwareRenderer.startTrimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
      return;
    }
    HardwareRenderer.startTrimMemory(level);
  }
}
Program: 1704
Project: 1704
Buggy source:
@Override protected void onDetachedFromWindow(){
  removeAllCallbacks();
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  removeAllCallbacks();
}
Program: 1705
Project: 1705
Buggy source:
final void freeTextLayoutCachesIfNeeded(int configDiff){
  if (configDiff != 0) {
    boolean hasLocaleConfigChange=((configDiff & ActivityInfo.CONFIG_LOCALE) != 0);
    if (hasLocaleConfigChange) {
      Canvas.freeTextLayoutCaches();
      if (DEBUG_CONFIGURATION)       Slog.v(TAG,"String_Node_Str");
    }
  }
}

Fixed version (ground truth):
static void freeTextLayoutCachesIfNeeded(int configDiff){
  if (configDiff != 0) {
    boolean hasLocaleConfigChange=((configDiff & ActivityInfo.CONFIG_LOCALE) != 0);
    if (hasLocaleConfigChange) {
      Canvas.freeTextLayoutCaches();
      if (DEBUG_CONFIGURATION)       Slog.v(TAG,"String_Node_Str");
    }
  }
}
Program: 1706
Project: 1706
Buggy source:
@Override protected void onDetachedFromWindow(){
  cancelClearAnimation();
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  cancelClearAnimation();
}
Program: 1707
Project: 1707
Buggy source:
/** 
 * Reset native resources. This is called when cleaning up the state of display lists during destruction of hardware resources, to ensure that we do not hold onto obsolete resources after related resources are gone.
 * @hide
 */
public abstract void reset();

Fixed version (ground truth):
/** 
 * Reset native resources. This is called when cleaning up the state of display lists during destruction of hardware resources, to ensure that we do not hold onto obsolete resources after related resources are gone.
 * @see #clear()
 * @hide
 */
public abstract void reset();
Program: 1708
Project: 1708
Buggy source:
/** 
 * Clears resources held onto by this display list. After calling this method  {@link #isValid()} will return false.
 * @see #isValid()
 */
public abstract void clear();

Fixed version (ground truth):
/** 
 * Clears resources held onto by this display list. After calling this method  {@link #isValid()} will return false.
 * @see #isValid()
 * @see #reset()
 */
public abstract void clear();
Program: 1709
Project: 1709
Buggy source:
@Override public void reset(){
  if (hasNativeDisplayList()) {
    nReset(mFinalizer.mNativeDisplayList);
  }
}

Fixed version (ground truth):
@Override public void reset(){
  if (hasNativeDisplayList()) {
    nReset(mFinalizer.mNativeDisplayList);
  }
  clear();
}
Program: 1710
Project: 1710
Buggy source:
/** 
 * Destroys all hardware rendering resources. This method is invoked when the system needs to reclaim resources. Upon execution of this method, you should free any OpenGL resources created by the view. Note: you <strong>must</strong> call <code>super.destroyHardwareResources()</code> when overriding this method.
 * @hide
 */
protected void destroyHardwareResources(){
  clearDisplayList();
  destroyLayer(true);
}

Fixed version (ground truth):
/** 
 * Destroys all hardware rendering resources. This method is invoked when the system needs to reclaim resources. Upon execution of this method, you should free any OpenGL resources created by the view. Note: you <strong>must</strong> call <code>super.destroyHardwareResources()</code> when overriding this method.
 * @hide
 */
protected void destroyHardwareResources(){
  resetDisplayList();
  destroyLayer(true);
}
Program: 1711
Project: 1711
Buggy source:
private void cleanupDraw(){
  if (mAttachInfo != null) {
    if (mDisplayList != null) {
      mDisplayList.markDirty();
      mAttachInfo.mViewRootImpl.enqueueDisplayList(mDisplayList);
    }
    mAttachInfo.mViewRootImpl.cancelInvalidate(this);
  }
 else {
    clearDisplayList();
  }
}

Fixed version (ground truth):
private void cleanupDraw(){
  if (mAttachInfo != null) {
    if (mDisplayList != null) {
      mDisplayList.markDirty();
      mAttachInfo.mViewRootImpl.enqueueDisplayList(mDisplayList);
    }
    mAttachInfo.mViewRootImpl.cancelInvalidate(this);
  }
 else {
    resetDisplayList();
  }
}
Program: 1712
Project: 1712
Buggy source:
/** 
 * Destroys this View's hardware layer if possible.
 * @return True if the layer was destroyed, false otherwise.
 * @see #setLayerType(int,android.graphics.Paint)
 * @see #LAYER_TYPE_HARDWARE
 */
boolean destroyLayer(boolean valid){
  if (mHardwareLayer != null) {
    AttachInfo info=mAttachInfo;
    if (info != null && info.mHardwareRenderer != null && info.mHardwareRenderer.isEnabled() && (valid || info.mHardwareRenderer.validate())) {
      info.mHardwareRenderer.cancelLayerUpdate(mHardwareLayer);
      mHardwareLayer.destroy();
      mHardwareLayer=null;
      if (mDisplayList != null) {
        mDisplayList.reset();
      }
      invalidate(true);
      invalidateParentCaches();
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Destroys this View's hardware layer if possible.
 * @return True if the layer was destroyed, false otherwise.
 * @see #setLayerType(int,android.graphics.Paint)
 * @see #LAYER_TYPE_HARDWARE
 */
boolean destroyLayer(boolean valid){
  if (mHardwareLayer != null) {
    AttachInfo info=mAttachInfo;
    if (info != null && info.mHardwareRenderer != null && info.mHardwareRenderer.isEnabled() && (valid || info.mHardwareRenderer.validate())) {
      info.mHardwareRenderer.cancelLayerUpdate(mHardwareLayer);
      mHardwareLayer.destroy();
      mHardwareLayer=null;
      invalidate(true);
      invalidateParentCaches();
    }
    return true;
  }
  return false;
}
Program: 1713
Project: 1713
Buggy source:
void destroyHardwareLayers(){
  if (mThread != Thread.currentThread()) {
    if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
      HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_MODERATE);
    }
  }
 else {
    if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
      mAttachInfo.mHardwareRenderer.destroyLayers(mView);
    }
  }
}

Fixed version (ground truth):
void destroyHardwareLayers(){
  if (mThread != Thread.currentThread()) {
    if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
      HardwareRenderer.trimMemory(ComponentCallbacks2.TRIM_MEMORY_MODERATE);
    }
  }
 else {
    invalidateDisplayLists();
    if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
      mAttachInfo.mHardwareRenderer.destroyLayers(mView);
    }
  }
}
Program: 1714
Project: 1714
Buggy source:
void invalidateDisplayLists(){
  final ArrayList<DisplayList> displayLists=mDisplayLists;
  final int count=displayLists.size();
  for (int i=0; i < count; i++) {
    final DisplayList displayList=displayLists.get(i);
    if (displayList.isDirty()) {
      displayList.clear();
    }
  }
  displayLists.clear();
}

Fixed version (ground truth):
void invalidateDisplayLists(){
  final ArrayList<DisplayList> displayLists=mDisplayLists;
  final int count=displayLists.size();
  for (int i=0; i < count; i++) {
    final DisplayList displayList=displayLists.get(i);
    if (displayList.isDirty()) {
      displayList.reset();
    }
  }
  displayLists.clear();
}
Program: 1715
Project: 1715
Buggy source:
void destroyHardwareResources(){
  if (mAttachInfo.mHardwareRenderer != null) {
    if (mAttachInfo.mHardwareRenderer.isEnabled()) {
      mAttachInfo.mHardwareRenderer.destroyLayers(mView);
    }
    mAttachInfo.mHardwareRenderer.destroy(false);
  }
}

Fixed version (ground truth):
void destroyHardwareResources(){
  invalidateDisplayLists();
  if (mAttachInfo.mHardwareRenderer != null) {
    mAttachInfo.mHardwareRenderer.destroyHardwareResources(mView);
    mAttachInfo.mHardwareRenderer.destroy(false);
  }
}
Program: 1716
Project: 1716
Buggy source:
public void startTrimMemory(int level){
  if (HardwareRenderer.isAvailable()) {
    if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE || (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE && !ActivityManager.isHighEndGfx())) {
synchronized (mLock) {
        for (int i=mRoots.size() - 1; i >= 0; --i) {
          mRoots.get(i).terminateHardwareResources();
        }
      }
      mNeedsEglTerminate=true;
      HardwareRenderer.startTrimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
      return;
    }
    HardwareRenderer.startTrimMemory(level);
  }
}

Fixed version (ground truth):
public void startTrimMemory(int level){
  if (HardwareRenderer.isAvailable()) {
    if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE || (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE && !ActivityManager.isHighEndGfx())) {
synchronized (mLock) {
        for (int i=mRoots.size() - 1; i >= 0; --i) {
          mRoots.get(i).destroyHardwareResources();
        }
      }
      mNeedsEglTerminate=true;
      HardwareRenderer.startTrimMemory(ComponentCallbacks2.TRIM_MEMORY_COMPLETE);
      return;
    }
    HardwareRenderer.startTrimMemory(level);
  }
}
Program: 1717
Project: 1717
Buggy source:
@Override protected void onDetachedFromWindow(){
  removeAllCallbacks();
}

Fixed version (ground truth):
@Override protected void onDetachedFromWindow(){
  super.onDetachedFromWindow();
  removeAllCallbacks();
}
Program: 1719
Project: 1719
Buggy source:
private void updateHourControl(){
  if (is24HourView()) {
    mHourSpinner.setMinValue(0);
    mHourSpinner.setMaxValue(23);
    mHourSpinner.setFormatter(NumberPicker.getTwoDigitFormatter());
  }
 else {
    mHourSpinner.setMinValue(1);
    mHourSpinner.setMaxValue(12);
    mHourSpinner.setFormatter(null);
  }
}

Fixed version (ground truth):
private void updateHourControl(){
  if (is24HourView()) {
    if (mHourFormat == 'k') {
      mHourSpinner.setMinValue(1);
      mHourSpinner.setMaxValue(24);
    }
 else {
      mHourSpinner.setMinValue(0);
      mHourSpinner.setMaxValue(23);
    }
  }
 else {
    if (mHourFormat == 'K') {
      mHourSpinner.setMinValue(0);
      mHourSpinner.setMaxValue(11);
    }
 else {
      mHourSpinner.setMinValue(1);
      mHourSpinner.setMaxValue(12);
    }
  }
  mHourSpinner.setFormatter(mHourWithTwoDigit ? NumberPicker.getTwoDigitFormatter() : null);
}
Program: 1720
Project: 1720
Buggy source:
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  mIs24HourView=is24HourView;
  int currentHour=getCurrentHour();
  updateHourControl();
  setCurrentHour(currentHour);
  updateMinuteControl();
  updateAmPmControl();
}

Fixed version (ground truth):
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  int currentHour=getCurrentHour();
  mIs24HourView=is24HourView;
  getHourFormatData();
  updateHourControl();
  setCurrentHour(currentHour);
  updateMinuteControl();
  updateAmPmControl();
}
Program: 1722
Project: 1722
Buggy source:
private void updateHourControl(){
  if (is24HourView()) {
    mHourSpinner.setMinValue(0);
    mHourSpinner.setMaxValue(23);
    mHourSpinner.setFormatter(NumberPicker.getTwoDigitFormatter());
  }
 else {
    mHourSpinner.setMinValue(1);
    mHourSpinner.setMaxValue(12);
    mHourSpinner.setFormatter(null);
  }
}

Fixed version (ground truth):
private void updateHourControl(){
  if (is24HourView()) {
    if (mHourFormat == 'k') {
      mHourSpinner.setMinValue(1);
      mHourSpinner.setMaxValue(24);
    }
 else {
      mHourSpinner.setMinValue(0);
      mHourSpinner.setMaxValue(23);
    }
  }
 else {
    if (mHourFormat == 'K') {
      mHourSpinner.setMinValue(0);
      mHourSpinner.setMaxValue(11);
    }
 else {
      mHourSpinner.setMinValue(1);
      mHourSpinner.setMaxValue(12);
    }
  }
  mHourSpinner.setFormatter(mHourWithTwoDigit ? NumberPicker.getTwoDigitFormatter() : null);
}
Program: 1723
Project: 1723
Buggy source:
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  mIs24HourView=is24HourView;
  int currentHour=getCurrentHour();
  updateHourControl();
  setCurrentHour(currentHour);
  updateMinuteControl();
  updateAmPmControl();
}

Fixed version (ground truth):
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  int currentHour=getCurrentHour();
  mIs24HourView=is24HourView;
  getHourFormatData();
  updateHourControl();
  setCurrentHour(currentHour);
  updateMinuteControl();
  updateAmPmControl();
}
Program: 1725
Project: 1725
Buggy source:
private void updateHourControl(){
  if (is24HourView()) {
    mHourSpinner.setMinValue(0);
    mHourSpinner.setMaxValue(23);
    mHourSpinner.setFormatter(NumberPicker.getTwoDigitFormatter());
  }
 else {
    mHourSpinner.setMinValue(1);
    mHourSpinner.setMaxValue(12);
    mHourSpinner.setFormatter(null);
  }
}

Fixed version (ground truth):
private void updateHourControl(){
  if (is24HourView()) {
    if (mHourFormat == 'k') {
      mHourSpinner.setMinValue(1);
      mHourSpinner.setMaxValue(24);
    }
 else {
      mHourSpinner.setMinValue(0);
      mHourSpinner.setMaxValue(23);
    }
  }
 else {
    if (mHourFormat == 'K') {
      mHourSpinner.setMinValue(0);
      mHourSpinner.setMaxValue(11);
    }
 else {
      mHourSpinner.setMinValue(1);
      mHourSpinner.setMaxValue(12);
    }
  }
  mHourSpinner.setFormatter(mHourWithTwoDigit ? NumberPicker.getTwoDigitFormatter() : null);
}
Program: 1726
Project: 1726
Buggy source:
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  mIs24HourView=is24HourView;
  int currentHour=getCurrentHour();
  updateHourControl();
  setCurrentHour(currentHour);
  updateMinuteControl();
  updateAmPmControl();
}

Fixed version (ground truth):
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  int currentHour=getCurrentHour();
  mIs24HourView=is24HourView;
  getHourFormatData();
  updateHourControl();
  setCurrentHour(currentHour);
  updateMinuteControl();
  updateAmPmControl();
}
Program: 1728
Project: 1728
Buggy source:
private void updateHourControl(){
  if (is24HourView()) {
    mHourSpinner.setMinValue(0);
    mHourSpinner.setMaxValue(23);
    mHourSpinner.setFormatter(NumberPicker.getTwoDigitFormatter());
  }
 else {
    mHourSpinner.setMinValue(1);
    mHourSpinner.setMaxValue(12);
    mHourSpinner.setFormatter(null);
  }
}

Fixed version (ground truth):
private void updateHourControl(){
  if (is24HourView()) {
    if (mHourFormat == 'k') {
      mHourSpinner.setMinValue(1);
      mHourSpinner.setMaxValue(24);
    }
 else {
      mHourSpinner.setMinValue(0);
      mHourSpinner.setMaxValue(23);
    }
  }
 else {
    if (mHourFormat == 'K') {
      mHourSpinner.setMinValue(0);
      mHourSpinner.setMaxValue(11);
    }
 else {
      mHourSpinner.setMinValue(1);
      mHourSpinner.setMaxValue(12);
    }
  }
  mHourSpinner.setFormatter(mHourWithTwoDigit ? NumberPicker.getTwoDigitFormatter() : null);
}
Program: 1729
Project: 1729
Buggy source:
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  mIs24HourView=is24HourView;
  int currentHour=getCurrentHour();
  updateHourControl();
  setCurrentHour(currentHour);
  updateMinuteControl();
  updateAmPmControl();
}

Fixed version (ground truth):
/** 
 * Set whether in 24 hour or AM/PM mode.
 * @param is24HourView True = 24 hour mode. False = AM/PM.
 */
public void setIs24HourView(Boolean is24HourView){
  if (mIs24HourView == is24HourView) {
    return;
  }
  int currentHour=getCurrentHour();
  mIs24HourView=is24HourView;
  getHourFormatData();
  updateHourControl();
  setCurrentHour(currentHour);
  updateMinuteControl();
  updateAmPmControl();
}
Program: 1734
Project: 1734
Buggy source:
/** 
 * Resolve the Drawables depending on the layout direction. This is implicitly supposing that the View directionality can and will be resolved before its Drawables. Will call   {@link View#onResolveDrawables} when resolution is done.
 * @hide
 */
protected void resolveDrawables(){
  if (canResolveLayoutDirection()) {
    if (mBackground != null) {
      mBackground.setLayoutDirection(getLayoutDirection());
    }
    mPrivateFlags2|=PFLAG2_DRAWABLE_RESOLVED;
    onResolveDrawables(getLayoutDirection());
  }
}

Fixed version (ground truth):
/** 
 * Resolve the Drawables depending on the layout direction. This is implicitly supposing that the View directionality can and will be resolved before its Drawables. Will call   {@link View#onResolveDrawables} when resolution is done.
 * @hide
 */
protected void resolveDrawables(){
  if (!isLayoutDirectionResolved() && getRawLayoutDirection() == View.LAYOUT_DIRECTION_INHERIT) {
    return;
  }
  final int layoutDirection=isLayoutDirectionResolved() ? getLayoutDirection() : getRawLayoutDirection();
  if (mBackground != null) {
    mBackground.setLayoutDirection(layoutDirection);
  }
  mPrivateFlags2|=PFLAG2_DRAWABLE_RESOLVED;
  onResolveDrawables(layoutDirection);
}
Program: 1735
Project: 1735
Buggy source:
private void setRelativeDrawablesIfNeeded(Drawable start,Drawable end){
  boolean hasRelativeDrawables=(start != null) || (end != null);
  if (hasRelativeDrawables) {
    Drawables dr=mDrawables;
    if (dr == null) {
      mDrawables=dr=new Drawables(getContext());
    }
    mDrawables.mOverride=true;
    final Rect compoundRect=dr.mCompoundRect;
    int[] state=getDrawableState();
    if (start != null) {
      start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
      start.setState(state);
      start.copyBounds(compoundRect);
      start.setCallback(this);
      dr.mDrawableStart=start;
      dr.mDrawableSizeStart=compoundRect.width();
      dr.mDrawableHeightStart=compoundRect.height();
    }
 else {
      dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;
    }
    if (end != null) {
      end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
      end.setState(state);
      end.copyBounds(compoundRect);
      end.setCallback(this);
      dr.mDrawableEnd=end;
      dr.mDrawableSizeEnd=compoundRect.width();
      dr.mDrawableHeightEnd=compoundRect.height();
    }
 else {
      dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;
    }
  }
}

Fixed version (ground truth):
private void setRelativeDrawablesIfNeeded(Drawable start,Drawable end){
  boolean hasRelativeDrawables=(start != null) || (end != null);
  if (hasRelativeDrawables) {
    Drawables dr=mDrawables;
    if (dr == null) {
      mDrawables=dr=new Drawables(getContext());
    }
    mDrawables.mOverride=true;
    final Rect compoundRect=dr.mCompoundRect;
    int[] state=getDrawableState();
    if (start != null) {
      start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
      start.setState(state);
      start.copyBounds(compoundRect);
      start.setCallback(this);
      dr.mDrawableStart=start;
      dr.mDrawableSizeStart=compoundRect.width();
      dr.mDrawableHeightStart=compoundRect.height();
    }
 else {
      dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;
    }
    if (end != null) {
      end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
      end.setState(state);
      end.copyBounds(compoundRect);
      end.setCallback(this);
      dr.mDrawableEnd=end;
      dr.mDrawableSizeEnd=compoundRect.width();
      dr.mDrawableHeightEnd=compoundRect.height();
    }
 else {
      dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;
    }
    resetResolvedDrawables();
    resolveDrawables();
  }
}