nus-yam/ex-repair huggingface dataset:
Program: 197503
Project: 197503
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    positionClockAndNotifications();
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  positionClockAndNotifications();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}
Program: 197504
Project: 197504
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    positionClockAndNotifications();
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  positionClockAndNotifications();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}
Program: 197508
Project: 197508
Buggy source:
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level.
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);

Fixed version (ground truth):
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level. <p>Prior to   {@link android.os.Build.VERSION_CODES#L}, if you did not have regular permission access to a Uri, but had received access to it through a specific Uri permission grant, you could not revoke that grant with this function and a   {@link SecurityException} would be thrown.  As of{@link android.os.Build.VERSION_CODES#L}, this function will not throw a security exception, but will remove whatever permission grants to the Uri had been given to the app (or none).</p>
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);
Program: 197510
Project: 197510
Buggy source:
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.
 */
public long getCpuTimeForPid(int pid){
  final String statFile="String_Node_Str" + pid + "String_Node_Str";
  final long[] statsData=mSinglePidStatsData;
  if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
    long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
    return time;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.  Safe to call without lock held.
 */
public long getCpuTimeForPid(int pid){
synchronized (mSinglePidStatsData) {
    final String statFile="String_Node_Str" + pid + "String_Node_Str";
    final long[] statsData=mSinglePidStatsData;
    if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
      long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
      return time;
    }
    return 0;
  }
}
Program: 197515
Project: 197515
Buggy source:
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
synchronized (mService.mProcessCpuThread) {
      next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
    }
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}

Fixed version (ground truth):
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
    next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}
Program: 197517
Project: 197517
Buggy source:
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level.
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);

Fixed version (ground truth):
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level. <p>Prior to   {@link android.os.Build.VERSION_CODES#L}, if you did not have regular permission access to a Uri, but had received access to it through a specific Uri permission grant, you could not revoke that grant with this function and a   {@link SecurityException} would be thrown.  As of{@link android.os.Build.VERSION_CODES#L}, this function will not throw a security exception, but will remove whatever permission grants to the Uri had been given to the app (or none).</p>
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);
Program: 197519
Project: 197519
Buggy source:
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.
 */
public long getCpuTimeForPid(int pid){
  final String statFile="String_Node_Str" + pid + "String_Node_Str";
  final long[] statsData=mSinglePidStatsData;
  if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
    long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
    return time;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.  Safe to call without lock held.
 */
public long getCpuTimeForPid(int pid){
synchronized (mSinglePidStatsData) {
    final String statFile="String_Node_Str" + pid + "String_Node_Str";
    final long[] statsData=mSinglePidStatsData;
    if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
      long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
      return time;
    }
    return 0;
  }
}
Program: 197524
Project: 197524
Buggy source:
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
synchronized (mService.mProcessCpuThread) {
      next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
    }
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}

Fixed version (ground truth):
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
    next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}
Program: 197526
Project: 197526
Buggy source:
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level.
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);

Fixed version (ground truth):
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level. <p>Prior to   {@link android.os.Build.VERSION_CODES#L}, if you did not have regular permission access to a Uri, but had received access to it through a specific Uri permission grant, you could not revoke that grant with this function and a   {@link SecurityException} would be thrown.  As of{@link android.os.Build.VERSION_CODES#L}, this function will not throw a security exception, but will remove whatever permission grants to the Uri had been given to the app (or none).</p>
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);
Program: 197528
Project: 197528
Buggy source:
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.
 */
public long getCpuTimeForPid(int pid){
  final String statFile="String_Node_Str" + pid + "String_Node_Str";
  final long[] statsData=mSinglePidStatsData;
  if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
    long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
    return time;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.  Safe to call without lock held.
 */
public long getCpuTimeForPid(int pid){
synchronized (mSinglePidStatsData) {
    final String statFile="String_Node_Str" + pid + "String_Node_Str";
    final long[] statsData=mSinglePidStatsData;
    if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
      long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
      return time;
    }
    return 0;
  }
}
Program: 197533
Project: 197533
Buggy source:
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
synchronized (mService.mProcessCpuThread) {
      next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
    }
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}

Fixed version (ground truth):
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
    next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}
Program: 197535
Project: 197535
Buggy source:
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.
 */
public long getCpuTimeForPid(int pid){
  final String statFile="String_Node_Str" + pid + "String_Node_Str";
  final long[] statsData=mSinglePidStatsData;
  if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
    long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
    return time;
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * Returns the total time (in clock ticks, or 1/100 sec) spent executing in both user and system code.  Safe to call without lock held.
 */
public long getCpuTimeForPid(int pid){
synchronized (mSinglePidStatsData) {
    final String statFile="String_Node_Str" + pid + "String_Node_Str";
    final long[] statsData=mSinglePidStatsData;
    if (Process.readProcFile(statFile,PROCESS_STATS_FORMAT,null,statsData,null)) {
      long time=statsData[PROCESS_STAT_UTIME] + statsData[PROCESS_STAT_STIME];
      return time;
    }
    return 0;
  }
}
Program: 197540
Project: 197540
Buggy source:
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
synchronized (mService.mProcessCpuThread) {
      next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
    }
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}

Fixed version (ground truth):
/** 
 * Once we know that we have asked an application to put an activity in the resumed state (either by launching it or explicitly telling it), this function updates the rest of our state to match that fact.
 */
private void completeResumeLocked(ActivityRecord next){
  next.idle=false;
  next.results=null;
  next.newIntents=null;
  if (next.isHomeActivity() && next.isNotResolverActivity()) {
    ProcessRecord app=next.task.mActivities.get(0).app;
    if (app != null && app != mService.mHomeProcess) {
      mService.mHomeProcess=app;
    }
  }
  if (next.nowVisible) {
    mStackSupervisor.notifyActivityDrawnForKeyguard();
  }
  mStackSupervisor.scheduleIdleTimeoutLocked(next);
  mStackSupervisor.reportResumedActivityLocked(next);
  next.resumeKeyDispatchingLocked();
  mNoAnimActivities.clear();
  if (next.app != null) {
    next.cpuTimeAtResume=mService.mProcessCpuTracker.getCpuTimeForPid(next.app.pid);
  }
 else {
    next.cpuTimeAtResume=0;
  }
  if (next == mLastScreenshotActivity) {
    invalidateLastScreenshot();
  }
  next.returningOptions=null;
}
Program: 197542
Project: 197542
Buggy source:
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level.
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);

Fixed version (ground truth):
/** 
 * Remove all permissions to access a particular content provider Uri that were previously added with   {@link #grantUriPermission}.  The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri.  That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo".  It will not remove any prefix grants that exist at a higher level. <p>Prior to   {@link android.os.Build.VERSION_CODES#L}, if you did not have regular permission access to a Uri, but had received access to it through a specific Uri permission grant, you could not revoke that grant with this function and a   {@link SecurityException} would be thrown.  As of{@link android.os.Build.VERSION_CODES#L}, this function will not throw a security exception, but will remove whatever permission grants to the Uri had been given to the app (or none).</p>
 * @param uri The Uri you would like to revoke access to.
 * @param modeFlags The desired access modes.  Any combination of{@link Intent#FLAG_GRANT_READ_URI_PERMISSION Intent.FLAG_GRANT_READ_URI_PERMISSION} or{@link Intent#FLAG_GRANT_WRITE_URI_PERMISSION Intent.FLAG_GRANT_WRITE_URI_PERMISSION}.
 * @see #grantUriPermission
 */
public abstract void revokeUriPermission(Uri uri,@Intent.AccessUriMode int modeFlags);
Program: 197544
Project: 197544
Buggy source:
void readArrayMapSafelyInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    Object key=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.put(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapSafelyInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  while (N > 0) {
    String key=readString();
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (key != null ? key.hashCode() : 0)+ "String_Node_Str"+ key);
    Object value=readValue(loader);
    outVal.put(key,value);
    N--;
  }
}
Program: 197545
Project: 197545
Buggy source:
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    Object key=readValue(loader);
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
}

Fixed version (ground truth):
void readArrayMapInternal(ArrayMap outVal,int N,ClassLoader loader){
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  while (N > 0) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    String key=readString();
    Object value=readValue(loader);
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + (N - 1) + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString((key != null ? key.hashCode() : 0))+ "String_Node_Str"+ key);
    outVal.append(key,value);
    N--;
  }
  outVal.validate();
}
Program: 197546
Project: 197546
Buggy source:
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeValue(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}

Fixed version (ground truth):
/** 
 * Flatten an ArrayMap into the parcel at the current dataPosition(), growing dataCapacity() if needed.  The Map keys must be String objects.
 */
void writeArrayMapInternal(ArrayMap<String,Object> val){
  if (val == null) {
    writeInt(-1);
    return;
  }
  final int N=val.size();
  writeInt(N);
  if (DEBUG_ARRAY_MAP) {
    RuntimeException here=new RuntimeException("String_Node_Str");
    here.fillInStackTrace();
    Log.d(TAG,"String_Node_Str" + N + "String_Node_Str",here);
  }
  int startPos;
  for (int i=0; i < N; i++) {
    if (DEBUG_ARRAY_MAP)     startPos=dataPosition();
    writeString(val.keyAt(i));
    writeValue(val.valueAt(i));
    if (DEBUG_ARRAY_MAP)     Log.d(TAG,"String_Node_Str" + i + "String_Node_Str"+ (dataPosition() - startPos)+ "String_Node_Str"+ Integer.toHexString(val.keyAt(i) != null ? val.keyAt(i).hashCode() : 0)+ "String_Node_Str"+ val.keyAt(i));
  }
}
Program: 197547
Project: 197547
Buggy source:
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Sets the master auto-sync setting that applies to all the providers and accounts. If this is false then the per-provider auto-sync setting is ignored. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param sync the master auto-sync setting that applies to all the providers and accounts
 */
public static void setMasterSyncAutomatically(boolean sync){
  setMasterSyncAutomaticallyAsUser(sync,UserHandle.myUserId());
}
Program: 197548
Project: 197548
Buggy source:
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Set whether or not the provider is synced when it receives a network tickle. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#WRITE_SYNC_SETTINGS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being controlled
 * @param sync true if the provider should be synced when tickles are received for it
 */
public static void setSyncAutomatically(Account account,String authority,boolean sync){
  setSyncAutomaticallyAsUser(account,authority,sync,UserHandle.myUserId());
}
Program: 197549
Project: 197549
Buggy source:
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.getCallingUserId());
}

Fixed version (ground truth):
/** 
 * Return true if the pending status is true of any matching authorities. <p>This method requires the caller to hold the permission  {@link android.Manifest.permission#READ_SYNC_STATS}.
 * @param account the account whose setting we are querying
 * @param authority the provider whose behavior is being queried
 * @return true if there is a pending sync with the matching account and authority
 */
public static boolean isSyncPending(Account account,String authority){
  return isSyncPendingAsUser(account,authority,UserHandle.myUserId());
}
Program: 197550
Project: 197550
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    positionClockAndNotifications();
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  mKeyguardStatusView.setPivotX(getWidth() / 2);
  mKeyguardStatusView.setPivotY((FONT_HEIGHT - CAP_HEIGHT) / 2048f * mClockView.getTextSize());
  mQsMinExpansionHeight=mKeyguardShowing ? 0 : mHeader.getCollapsedHeight() + mQsPeekHeight;
  mQsMaxExpansionHeight=mHeader.getExpandedHeight() + mQsContainer.getHeight();
  positionClockAndNotifications();
  if (mQsExpanded) {
    if (mQsFullyExpanded) {
      mQsExpansionHeight=mQsMaxExpansionHeight;
      requestScrollerTopPaddingUpdate(false);
    }
  }
 else {
    setQsExpansion(mQsMinExpansionHeight + mLastOverscroll);
    mNotificationStackScroller.setStackHeight(getExpandedHeight());
    updateHeader();
  }
  mNotificationStackScroller.updateIsSmallScreen(mHeader.getCollapsedHeight() + mQsPeekHeight);
}
Program: 197552
Project: 197552
Buggy source:
public QSDualTileLabel(Context context){
  super(context);
  mContext=context;
  mHorizontalPaddingPx=mContext.getResources().getDimensionPixelSize(R.dimen.qs_dual_tile_padding_horizontal);
  mFirstLine=initTextView();
  mFirstLine.setPadding(mHorizontalPaddingPx,0,0,0);
  final LinearLayout firstLineLayout=new LinearLayout(mContext);
  firstLineLayout.setPadding(0,0,0,0);
  firstLineLayout.setOrientation(LinearLayout.HORIZONTAL);
  firstLineLayout.setClickable(false);
  firstLineLayout.setBackground(null);
  firstLineLayout.addView(mFirstLine);
  mFirstLineCaret=new ImageView(mContext);
  mFirstLineCaret.setScaleType(ImageView.ScaleType.MATRIX);
  mFirstLineCaret.setClickable(false);
  firstLineLayout.addView(mFirstLineCaret);
  addView(firstLineLayout,newFrameLayoutParams());
  mSecondLine=initTextView();
  mSecondLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  mSecondLine.setEllipsize(TruncateAt.END);
  mSecondLine.setVisibility(GONE);
  addView(mSecondLine,newFrameLayoutParams());
  addOnLayoutChangeListener(new OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      if ((oldRight - oldLeft) != (right - left)) {
        rescheduleUpdateText();
      }
    }
  }
);
}

Fixed version (ground truth):
public QSDualTileLabel(Context context){
  super(context);
  mContext=context;
  setOrientation(LinearLayout.VERTICAL);
  mHorizontalPaddingPx=mContext.getResources().getDimensionPixelSize(R.dimen.qs_dual_tile_padding_horizontal);
  mFirstLine=initTextView();
  mFirstLine.setPadding(mHorizontalPaddingPx,0,0,0);
  final LinearLayout firstLineLayout=new LinearLayout(mContext);
  firstLineLayout.setPadding(0,0,0,0);
  firstLineLayout.setOrientation(LinearLayout.HORIZONTAL);
  firstLineLayout.setClickable(false);
  firstLineLayout.setBackground(null);
  firstLineLayout.addView(mFirstLine);
  mFirstLineCaret=new ImageView(mContext);
  mFirstLineCaret.setScaleType(ImageView.ScaleType.MATRIX);
  mFirstLineCaret.setClickable(false);
  firstLineLayout.addView(mFirstLineCaret);
  addView(firstLineLayout,newLinearLayoutParams());
  mSecondLine=initTextView();
  mSecondLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  mSecondLine.setEllipsize(TruncateAt.END);
  mSecondLine.setVisibility(GONE);
  addView(mSecondLine,newLinearLayoutParams());
  addOnLayoutChangeListener(new OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      if ((oldRight - oldLeft) != (right - left)) {
        rescheduleUpdateText();
      }
    }
  }
);
}
Program: 197553
Project: 197553
Buggy source:
public QSDualTileLabel(Context context){
  super(context);
  mContext=context;
  mHorizontalPaddingPx=mContext.getResources().getDimensionPixelSize(R.dimen.qs_dual_tile_padding_horizontal);
  mFirstLine=initTextView();
  mFirstLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  final LinearLayout firstLineLayout=new LinearLayout(mContext);
  firstLineLayout.setPadding(0,0,0,0);
  firstLineLayout.setOrientation(LinearLayout.HORIZONTAL);
  firstLineLayout.setClickable(false);
  firstLineLayout.setBackground(null);
  firstLineLayout.addView(mFirstLine);
  mFirstLineCaret=new ImageView(mContext);
  mFirstLineCaret.setScaleType(ImageView.ScaleType.MATRIX);
  mFirstLineCaret.setClickable(false);
  firstLineLayout.addView(mFirstLineCaret);
  addView(firstLineLayout,newFrameLayoutParams());
  mSecondLine=initTextView();
  mSecondLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  mSecondLine.setEllipsize(TruncateAt.END);
  mSecondLine.setVisibility(GONE);
  addView(mSecondLine,newFrameLayoutParams());
  addOnLayoutChangeListener(new OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      if ((oldRight - oldLeft) != (right - left)) {
        rescheduleUpdateText();
      }
    }
  }
);
}

Fixed version (ground truth):
public QSDualTileLabel(Context context){
  super(context);
  mContext=context;
  setOrientation(LinearLayout.VERTICAL);
  mHorizontalPaddingPx=mContext.getResources().getDimensionPixelSize(R.dimen.qs_dual_tile_padding_horizontal);
  mFirstLine=initTextView();
  mFirstLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  final LinearLayout firstLineLayout=new LinearLayout(mContext);
  firstLineLayout.setPadding(0,0,0,0);
  firstLineLayout.setOrientation(LinearLayout.HORIZONTAL);
  firstLineLayout.setClickable(false);
  firstLineLayout.setBackground(null);
  firstLineLayout.addView(mFirstLine);
  mFirstLineCaret=new ImageView(mContext);
  mFirstLineCaret.setScaleType(ImageView.ScaleType.MATRIX);
  mFirstLineCaret.setClickable(false);
  firstLineLayout.addView(mFirstLineCaret);
  addView(firstLineLayout,newLinearLayoutParams());
  mSecondLine=initTextView();
  mSecondLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  mSecondLine.setEllipsize(TruncateAt.END);
  mSecondLine.setVisibility(GONE);
  addView(mSecondLine,newLinearLayoutParams());
  addOnLayoutChangeListener(new OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      if ((oldRight - oldLeft) != (right - left)) {
        rescheduleUpdateText();
      }
    }
  }
);
}
Program: 197554
Project: 197554
Buggy source:
public QSDualTileLabel(Context context){
  super(context);
  mContext=context;
  mHorizontalPaddingPx=mContext.getResources().getDimensionPixelSize(R.dimen.qs_dual_tile_padding_horizontal);
  mFirstLine=initTextView();
  mFirstLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  final LinearLayout firstLineLayout=new LinearLayout(mContext);
  firstLineLayout.setPadding(0,0,0,0);
  firstLineLayout.setOrientation(LinearLayout.HORIZONTAL);
  firstLineLayout.setClickable(false);
  firstLineLayout.setBackground(null);
  firstLineLayout.addView(mFirstLine);
  mFirstLineCaret=new ImageView(mContext);
  mFirstLineCaret.setScaleType(ImageView.ScaleType.MATRIX);
  mFirstLineCaret.setClickable(false);
  firstLineLayout.addView(mFirstLineCaret);
  addView(firstLineLayout,newFrameLayoutParams());
  mSecondLine=initTextView();
  mSecondLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  mSecondLine.setEllipsize(TruncateAt.END);
  mSecondLine.setVisibility(GONE);
  addView(mSecondLine,newFrameLayoutParams());
  addOnLayoutChangeListener(new OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      if ((oldRight - oldLeft) != (right - left)) {
        rescheduleUpdateText();
      }
    }
  }
);
}

Fixed version (ground truth):
public QSDualTileLabel(Context context){
  super(context);
  mContext=context;
  setOrientation(LinearLayout.VERTICAL);
  mHorizontalPaddingPx=mContext.getResources().getDimensionPixelSize(R.dimen.qs_dual_tile_padding_horizontal);
  mFirstLine=initTextView();
  mFirstLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  final LinearLayout firstLineLayout=new LinearLayout(mContext);
  firstLineLayout.setPadding(0,0,0,0);
  firstLineLayout.setOrientation(LinearLayout.HORIZONTAL);
  firstLineLayout.setClickable(false);
  firstLineLayout.setBackground(null);
  firstLineLayout.addView(mFirstLine);
  mFirstLineCaret=new ImageView(mContext);
  mFirstLineCaret.setScaleType(ImageView.ScaleType.MATRIX);
  mFirstLineCaret.setClickable(false);
  firstLineLayout.addView(mFirstLineCaret);
  addView(firstLineLayout,newLinearLayoutParams());
  mSecondLine=initTextView();
  mSecondLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  mSecondLine.setEllipsize(TruncateAt.END);
  mSecondLine.setVisibility(GONE);
  addView(mSecondLine,newLinearLayoutParams());
  addOnLayoutChangeListener(new OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      if ((oldRight - oldLeft) != (right - left)) {
        rescheduleUpdateText();
      }
    }
  }
);
}
Program: 197555
Project: 197555
Buggy source:
public QSDualTileLabel(Context context){
  super(context);
  mContext=context;
  mHorizontalPaddingPx=mContext.getResources().getDimensionPixelSize(R.dimen.qs_dual_tile_padding_horizontal);
  mFirstLine=initTextView();
  mFirstLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  final LinearLayout firstLineLayout=new LinearLayout(mContext);
  firstLineLayout.setPadding(0,0,0,0);
  firstLineLayout.setOrientation(LinearLayout.HORIZONTAL);
  firstLineLayout.setClickable(false);
  firstLineLayout.setBackground(null);
  firstLineLayout.addView(mFirstLine);
  mFirstLineCaret=new ImageView(mContext);
  mFirstLineCaret.setScaleType(ImageView.ScaleType.MATRIX);
  mFirstLineCaret.setClickable(false);
  firstLineLayout.addView(mFirstLineCaret);
  addView(firstLineLayout,newFrameLayoutParams());
  mSecondLine=initTextView();
  mSecondLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  mSecondLine.setEllipsize(TruncateAt.END);
  mSecondLine.setVisibility(GONE);
  addView(mSecondLine,newFrameLayoutParams());
  addOnLayoutChangeListener(new OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      if ((oldRight - oldLeft) != (right - left)) {
        rescheduleUpdateText();
      }
    }
  }
);
}

Fixed version (ground truth):
public QSDualTileLabel(Context context){
  super(context);
  mContext=context;
  setOrientation(LinearLayout.VERTICAL);
  mHorizontalPaddingPx=mContext.getResources().getDimensionPixelSize(R.dimen.qs_dual_tile_padding_horizontal);
  mFirstLine=initTextView();
  mFirstLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  final LinearLayout firstLineLayout=new LinearLayout(mContext);
  firstLineLayout.setPadding(0,0,0,0);
  firstLineLayout.setOrientation(LinearLayout.HORIZONTAL);
  firstLineLayout.setClickable(false);
  firstLineLayout.setBackground(null);
  firstLineLayout.addView(mFirstLine);
  mFirstLineCaret=new ImageView(mContext);
  mFirstLineCaret.setScaleType(ImageView.ScaleType.MATRIX);
  mFirstLineCaret.setClickable(false);
  firstLineLayout.addView(mFirstLineCaret);
  addView(firstLineLayout,newLinearLayoutParams());
  mSecondLine=initTextView();
  mSecondLine.setPadding(mHorizontalPaddingPx,0,mHorizontalPaddingPx,0);
  mSecondLine.setEllipsize(TruncateAt.END);
  mSecondLine.setVisibility(GONE);
  addView(mSecondLine,newLinearLayoutParams());
  addOnLayoutChangeListener(new OnLayoutChangeListener(){
    @Override public void onLayoutChange(    View v,    int left,    int top,    int right,    int bottom,    int oldLeft,    int oldTop,    int oldRight,    int oldBottom){
      if ((oldRight - oldLeft) != (right - left)) {
        rescheduleUpdateText();
      }
    }
  }
);
}
Program: 197556
Project: 197556
Buggy source:
/** 
 * Hides the recents 
 */
public void onHideRecents(boolean triggeredFromAltTab,boolean triggeredFromHomeKey){
  if (mBootCompleted) {
    if (isRecentsTopMost(getTopMostTask(),null)) {
      Intent intent=new Intent(ACTION_HIDE_RECENTS_ACTIVITY);
      intent.setPackage(mContext.getPackageName());
      intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
      intent.putExtra(EXTRA_TRIGGERED_FROM_ALT_TAB,triggeredFromAltTab);
      intent.putExtra(EXTRA_TRIGGERED_FROM_HOME_KEY,triggeredFromHomeKey);
      mContext.sendBroadcastAsUser(intent,UserHandle.CURRENT);
    }
  }
}

Fixed version (ground truth):
/** 
 * Hides the recents 
 */
public void onHideRecents(boolean triggeredFromAltTab,boolean triggeredFromHomeKey){
  if (mBootCompleted) {
    if (isRecentsTopMost(getTopMostTask(),null)) {
      Intent intent=new Intent(ACTION_HIDE_RECENTS_ACTIVITY);
      intent.setPackage(mContext.getPackageName());
      intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT | Intent.FLAG_RECEIVER_FOREGROUND);
      intent.putExtra(EXTRA_TRIGGERED_FROM_ALT_TAB,triggeredFromAltTab);
      intent.putExtra(EXTRA_TRIGGERED_FROM_HOME_KEY,triggeredFromHomeKey);
      mContext.sendBroadcastAsUser(intent,UserHandle.CURRENT);
    }
  }
}