nus-yam/ex-repair huggingface dataset:
Program: 198117
Project: 198117
Buggy source:
private static byte[] physicalAddressToParam(int physicalAddress){
  return new byte[]{(byte)(physicalAddress >> 8),(byte)(physicalAddress & 0xFF)};
}

Fixed version (ground truth):
private static byte[] physicalAddressToParam(int physicalAddress){
  return new byte[]{(byte)((physicalAddress >> 8) & 0xFF),(byte)(physicalAddress & 0xFF)};
}
Program: 198118
Project: 198118
Buggy source:
/** 
 * Build &lt;Set Menu Language &gt; command. <p>This is a broadcast message sent to all devices on the bus.
 * @param src source address of command
 * @param language 3-letter ISO639-2 based language code
 * @return newly created {@link HdmiCecMessage} if language is valid.Otherwise, return null
 */
static HdmiCecMessage buildSetMenuLanguageCommand(int src,String language){
  if (language.length() != 3) {
    return null;
  }
  String normalized=language.toLowerCase();
  byte[] params=new byte[]{(byte)normalized.charAt(0),(byte)normalized.charAt(1),(byte)normalized.charAt(2)};
  return buildCommand(src,Constants.ADDR_BROADCAST,Constants.MESSAGE_SET_MENU_LANGUAGE,params);
}

Fixed version (ground truth):
/** 
 * Build &lt;Set Menu Language &gt; command. <p>This is a broadcast message sent to all devices on the bus.
 * @param src source address of command
 * @param language 3-letter ISO639-2 based language code
 * @return newly created {@link HdmiCecMessage} if language is valid.Otherwise, return null
 */
static HdmiCecMessage buildSetMenuLanguageCommand(int src,String language){
  if (language.length() != 3) {
    return null;
  }
  String normalized=language.toLowerCase();
  byte[] params=new byte[]{(byte)(normalized.charAt(0) & 0xFF),(byte)(normalized.charAt(1) & 0xFF),(byte)(normalized.charAt(2) & 0xFF)};
  return buildCommand(src,Constants.ADDR_BROADCAST,Constants.MESSAGE_SET_MENU_LANGUAGE,params);
}
Program: 198119
Project: 198119
Buggy source:
/** 
 * Build &lt;Report Menu Status&gt; command.
 * @param src source address of command
 * @param dest destination address of command
 * @param menuStatus menu status of the device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportMenuStatus(int src,int dest,int menuStatus){
  byte[] param=new byte[]{(byte)(menuStatus)};
  return buildCommand(src,dest,Constants.MESSAGE_MENU_STATUS,param);
}

Fixed version (ground truth):
/** 
 * Build &lt;Report Menu Status&gt; command.
 * @param src source address of command
 * @param dest destination address of command
 * @param menuStatus menu status of the device
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildReportMenuStatus(int src,int dest,int menuStatus){
  byte[] param=new byte[]{(byte)(menuStatus & 0xFF)};
  return buildCommand(src,dest,Constants.MESSAGE_MENU_STATUS,param);
}
Program: 198120
Project: 198120
Buggy source:
/** 
 * Build &lt;Device Vendor Id&gt; command. It has one byte cec version as parameter.
 * @param src source address of command
 * @param dest destination address of command
 * @param version version of cec. Use 0x04 for "Version 1.3a" and 0x05 for"Version 1.4 or 1.4a or 1.4b
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildCecVersion(int src,int dest,int version){
  byte[] params=new byte[]{(byte)version};
  return buildCommand(src,dest,Constants.MESSAGE_CEC_VERSION,params);
}

Fixed version (ground truth):
/** 
 * Build &lt;Device Vendor Id&gt; command. It has one byte cec version as parameter.
 * @param src source address of command
 * @param dest destination address of command
 * @param version version of cec. Use 0x04 for "Version 1.3a" and 0x05 for"Version 1.4 or 1.4a or 1.4b
 * @return newly created {@link HdmiCecMessage}
 */
static HdmiCecMessage buildCecVersion(int src,int dest,int version){
  byte[] params=new byte[]{(byte)(version & 0xFF)};
  return buildCommand(src,dest,Constants.MESSAGE_CEC_VERSION,params);
}
Program: 198121
Project: 198121
Buggy source:
/** 
 * Whether a device of the specified physical address is connected to ARC enabled port.
 */
boolean isConnectedToArcPort(int physicalAddress){
  int portId=mPortIdMap.get(physicalAddress);
  if (portId != Constants.INVALID_PORT_ID) {
    return mPortInfoMap.get(portId).isArcSupported();
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Whether a device of the specified physical address is connected to ARC enabled port.
 */
boolean isConnectedToArcPort(int physicalAddress){
  int portId=pathToPortId(physicalAddress);
  if (portId != Constants.INVALID_PORT_ID) {
    return mPortInfoMap.get(portId).isArcSupported();
  }
  return false;
}
Program: 198122
Project: 198122
Buggy source:
private String buildMessage(String message,Pair<Long,Integer> timing,long curTime){
  return new StringBuilder().append("String_Node_Str").append(timing == null ? curTime : timing.second).append("String_Node_Str").append(message).toString();
}

Fixed version (ground truth):
private String buildMessage(String message,@Nullable Pair<Long,Integer> timing){
  return new StringBuilder().append("String_Node_Str").append(timing == null ? 1 : timing.second).append("String_Node_Str").append(message).toString();
}
Program: 198123
Project: 198123
Buggy source:
void warning(String logMessage){
  long curTime=SystemClock.uptimeMillis();
  Pair<Long,Integer> timing=mWarningTimingCache.get(logMessage);
  if (shouldLogNow(timing,curTime)) {
    Slog.w(mTag,buildMessage(logMessage,timing,curTime));
    mWarningTimingCache.put(logMessage,new Pair<>(curTime,1));
  }
 else {
    increaseLogCount(mWarningTimingCache,logMessage);
  }
}

Fixed version (ground truth):
void warning(String logMessage){
  long curTime=SystemClock.uptimeMillis();
  Pair<Long,Integer> timing=mWarningTimingCache.get(logMessage);
  if (shouldLogNow(timing,curTime)) {
    Slog.w(mTag,buildMessage(logMessage,timing));
    mWarningTimingCache.put(logMessage,new Pair<>(curTime,1));
  }
 else {
    increaseLogCount(mWarningTimingCache,logMessage);
  }
}
Program: 198124
Project: 198124
Buggy source:
private boolean shouldLogNow(Pair<Long,Integer> timing,long curTime){
  return timing == null || curTime - timing.first > ERROR_LOG_DURATTION_MILLIS;
}

Fixed version (ground truth):
private boolean shouldLogNow(@Nullable Pair<Long,Integer> timing,long curTime){
  return timing == null || curTime - timing.first > ERROR_LOG_DURATTION_MILLIS;
}
Program: 198125
Project: 198125
Buggy source:
void error(String logMessage){
  long curTime=SystemClock.uptimeMillis();
  Pair<Long,Integer> timing=mErrorTimingCache.get(logMessage);
  if (shouldLogNow(timing,curTime)) {
    Slog.e(mTag,buildMessage(logMessage,timing,curTime));
    mErrorTimingCache.put(logMessage,new Pair<>(curTime,1));
  }
 else {
    increaseLogCount(mErrorTimingCache,logMessage);
  }
}

Fixed version (ground truth):
void error(String logMessage){
  long curTime=SystemClock.uptimeMillis();
  Pair<Long,Integer> timing=mErrorTimingCache.get(logMessage);
  if (shouldLogNow(timing,curTime)) {
    Slog.e(mTag,buildMessage(logMessage,timing));
    mErrorTimingCache.put(logMessage,new Pair<>(curTime,1));
  }
 else {
    increaseLogCount(mErrorTimingCache,logMessage);
  }
}
Program: 198126
Project: 198126
Buggy source:
@Override protected void onViewRemoved(View child){
  super.onViewRemoved(child);
  mStackScrollAlgorithm.notifyChildrenChanged(this);
  if (mChangePositionInProgress) {
    return;
  }
  ((ExpandableView)child).setOnHeightChangedListener(null);
  mCurrentStackScrollState.removeViewStateForView(child);
  updateScrollStateForRemovedChild(child);
  boolean animationGenerated=generateRemoveAnimation(child);
  if (animationGenerated && !mSwipedOutViews.contains(child)) {
    getOverlay().add(child);
  }
}

Fixed version (ground truth):
@Override protected void onViewRemoved(View child){
  super.onViewRemoved(child);
  mStackScrollAlgorithm.notifyChildrenChanged(this);
  if (mChangePositionInProgress) {
    return;
  }
  ((ExpandableView)child).setOnHeightChangedListener(null);
  mCurrentStackScrollState.removeViewStateForView(child);
  updateScrollStateForRemovedChild(child);
  boolean animationGenerated=generateRemoveAnimation(child);
  if (animationGenerated && !mSwipedOutViews.contains(child)) {
    getOverlay().add(child);
  }
  child.setClipBounds(null);
}
Program: 198127
Project: 198127
Buggy source:
/** 
 * Get the list of tasks associated with the calling application.
 * @return The list of tasks associated with the application making this call.
 * @throws SecurityException
 */
public List<ActivityManager.AppTask> getAppTasks(){
  ArrayList<AppTask> tasks=new ArrayList<AppTask>();
  List<IAppTask> appTasks;
  try {
    appTasks=ActivityManagerNative.getDefault().getAppTasks();
  }
 catch (  RemoteException e) {
    return null;
  }
  int numAppTasks=appTasks.size();
  for (int i=0; i < numAppTasks; i++) {
    tasks.add(new AppTask(appTasks.get(i)));
  }
  return tasks;
}

Fixed version (ground truth):
/** 
 * Get the list of tasks associated with the calling application.
 * @return The list of tasks associated with the application making this call.
 * @throws SecurityException
 */
public List<ActivityManager.AppTask> getAppTasks(){
  ArrayList<AppTask> tasks=new ArrayList<AppTask>();
  List<IAppTask> appTasks;
  try {
    appTasks=ActivityManagerNative.getDefault().getAppTasks(mContext.getPackageName());
  }
 catch (  RemoteException e) {
    return null;
  }
  int numAppTasks=appTasks.size();
  for (int i=0; i < numAppTasks; i++) {
    tasks.add(new AppTask(appTasks.get(i)));
  }
  return tasks;
}
Program: 198129
Project: 198129
Buggy source:
public List<IAppTask> getAppTasks() throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  mRemote.transact(GET_APP_TASKS_TRANSACTION,data,reply,0);
  reply.readException();
  ArrayList<IAppTask> list=null;
  int N=reply.readInt();
  if (N >= 0) {
    list=new ArrayList<IAppTask>();
    while (N > 0) {
      IAppTask task=IAppTask.Stub.asInterface(reply.readStrongBinder());
      list.add(task);
      N--;
    }
  }
  data.recycle();
  reply.recycle();
  return list;
}

Fixed version (ground truth):
public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeString(callingPackage);
  mRemote.transact(GET_APP_TASKS_TRANSACTION,data,reply,0);
  reply.readException();
  ArrayList<IAppTask> list=null;
  int N=reply.readInt();
  if (N >= 0) {
    list=new ArrayList<IAppTask>();
    while (N > 0) {
      IAppTask task=IAppTask.Stub.asInterface(reply.readStrongBinder());
      list.add(task);
      N--;
    }
  }
  data.recycle();
  reply.recycle();
  return list;
}
Program: 198130
Project: 198130
Buggy source:
public List<IAppTask> getAppTasks() throws RemoteException ;

Fixed version (ground truth):
public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException ;
Program: 198132
Project: 198132
Buggy source:
@Override public List<IAppTask> getAppTasks(){
  final PackageManager pm=mContext.getPackageManager();
  int callingUid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
  HashSet<String> packages=new HashSet<String>();
  String[] uidPackages=pm.getPackagesForUid(callingUid);
  for (int i=0; i < uidPackages.length; i++) {
    packages.add(uidPackages[i]);
  }
synchronized (this) {
    ArrayList<IAppTask> list=new ArrayList<IAppTask>();
    try {
      if (localLOGV)       Slog.v(TAG,"String_Node_Str");
      final int N=mRecentTasks.size();
      for (int i=0; i < N; i++) {
        TaskRecord tr=mRecentTasks.get(i);
        if (packages.contains(tr.getBaseIntent().getComponent().getPackageName())) {
          ActivityManager.RecentTaskInfo taskInfo=createRecentTaskInfoFromTaskRecord(tr);
          AppTaskImpl taskImpl=new AppTaskImpl(taskInfo.persistentId,callingUid);
          list.add(taskImpl);
        }
      }
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
    return list;
  }
}

Fixed version (ground truth):
@Override public List<IAppTask> getAppTasks(String callingPackage){
  int callingUid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
synchronized (this) {
    ArrayList<IAppTask> list=new ArrayList<IAppTask>();
    try {
      if (localLOGV)       Slog.v(TAG,"String_Node_Str");
      final int N=mRecentTasks.size();
      for (int i=0; i < N; i++) {
        TaskRecord tr=mRecentTasks.get(i);
        if (tr.effectiveUid != callingUid) {
          continue;
        }
        Intent intent=tr.getBaseIntent();
        if (intent == null || !callingPackage.equals(intent.getComponent().getPackageName())) {
          continue;
        }
        ActivityManager.RecentTaskInfo taskInfo=createRecentTaskInfoFromTaskRecord(tr);
        AppTaskImpl taskImpl=new AppTaskImpl(taskInfo.persistentId,callingUid);
        list.add(taskImpl);
      }
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
    return list;
  }
}
Program: 198133
Project: 198133
Buggy source:
void getTasksLocked(List<RunningTaskInfo> list,int callingUid,boolean allowed){
  for (int taskNdx=mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
    final TaskRecord task=mTaskHistory.get(taskNdx);
    ActivityRecord r=null;
    ActivityRecord top=null;
    int numActivities=0;
    int numRunning=0;
    final ArrayList<ActivityRecord> activities=task.mActivities;
    if (activities.isEmpty()) {
      continue;
    }
    if (!allowed && !task.isHomeTask() && task.creatorUid != callingUid) {
      continue;
    }
    for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
      r=activities.get(activityNdx);
      if (top == null || (top.state == ActivityState.INITIALIZING)) {
        top=r;
        numActivities=numRunning=0;
      }
      numActivities++;
      if (r.app != null && r.app.thread != null) {
        numRunning++;
      }
      if (localLOGV)       Slog.v(TAG,r.intent.getComponent().flattenToShortString() + "String_Node_Str" + r.task);
    }
    RunningTaskInfo ci=new RunningTaskInfo();
    ci.id=task.taskId;
    ci.baseActivity=r.intent.getComponent();
    ci.topActivity=top.intent.getComponent();
    ci.lastActiveTime=task.lastActiveTime;
    if (top.task != null) {
      ci.description=top.task.lastDescription;
    }
    ci.numActivities=numActivities;
    ci.numRunning=numRunning;
    list.add(ci);
  }
}

Fixed version (ground truth):
void getTasksLocked(List<RunningTaskInfo> list,int callingUid,boolean allowed){
  for (int taskNdx=mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
    final TaskRecord task=mTaskHistory.get(taskNdx);
    ActivityRecord r=null;
    ActivityRecord top=null;
    int numActivities=0;
    int numRunning=0;
    final ArrayList<ActivityRecord> activities=task.mActivities;
    if (activities.isEmpty()) {
      continue;
    }
    if (!allowed && !task.isHomeTask() && task.effectiveUid != callingUid) {
      continue;
    }
    for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
      r=activities.get(activityNdx);
      if (top == null || (top.state == ActivityState.INITIALIZING)) {
        top=r;
        numActivities=numRunning=0;
      }
      numActivities++;
      if (r.app != null && r.app.thread != null) {
        numRunning++;
      }
      if (localLOGV)       Slog.v(TAG,r.intent.getComponent().flattenToShortString() + "String_Node_Str" + r.task);
    }
    RunningTaskInfo ci=new RunningTaskInfo();
    ci.id=task.taskId;
    ci.baseActivity=r.intent.getComponent();
    ci.topActivity=top.intent.getComponent();
    ci.lastActiveTime=task.lastActiveTime;
    if (top.task != null) {
      ci.description=top.task.lastDescription;
    }
    ci.numActivities=numActivities;
    ci.numRunning=numRunning;
    list.add(ci);
  }
}
Program: 198139
Project: 198139
Buggy source:
@Override protected void onViewRemoved(View child){
  super.onViewRemoved(child);
  mStackScrollAlgorithm.notifyChildrenChanged(this);
  if (mChangePositionInProgress) {
    return;
  }
  ((ExpandableView)child).setOnHeightChangedListener(null);
  mCurrentStackScrollState.removeViewStateForView(child);
  updateScrollStateForRemovedChild(child);
  boolean animationGenerated=generateRemoveAnimation(child);
  if (animationGenerated && !mSwipedOutViews.contains(child)) {
    getOverlay().add(child);
  }
}

Fixed version (ground truth):
@Override protected void onViewRemoved(View child){
  super.onViewRemoved(child);
  mStackScrollAlgorithm.notifyChildrenChanged(this);
  if (mChangePositionInProgress) {
    return;
  }
  ((ExpandableView)child).setOnHeightChangedListener(null);
  mCurrentStackScrollState.removeViewStateForView(child);
  updateScrollStateForRemovedChild(child);
  boolean animationGenerated=generateRemoveAnimation(child);
  if (animationGenerated && !mSwipedOutViews.contains(child)) {
    getOverlay().add(child);
  }
  child.setClipBounds(null);
}
Program: 198140
Project: 198140
Buggy source:
/** 
 * Get the list of tasks associated with the calling application.
 * @return The list of tasks associated with the application making this call.
 * @throws SecurityException
 */
public List<ActivityManager.AppTask> getAppTasks(){
  ArrayList<AppTask> tasks=new ArrayList<AppTask>();
  List<IAppTask> appTasks;
  try {
    appTasks=ActivityManagerNative.getDefault().getAppTasks();
  }
 catch (  RemoteException e) {
    return null;
  }
  int numAppTasks=appTasks.size();
  for (int i=0; i < numAppTasks; i++) {
    tasks.add(new AppTask(appTasks.get(i)));
  }
  return tasks;
}

Fixed version (ground truth):
/** 
 * Get the list of tasks associated with the calling application.
 * @return The list of tasks associated with the application making this call.
 * @throws SecurityException
 */
public List<ActivityManager.AppTask> getAppTasks(){
  ArrayList<AppTask> tasks=new ArrayList<AppTask>();
  List<IAppTask> appTasks;
  try {
    appTasks=ActivityManagerNative.getDefault().getAppTasks(mContext.getPackageName());
  }
 catch (  RemoteException e) {
    return null;
  }
  int numAppTasks=appTasks.size();
  for (int i=0; i < numAppTasks; i++) {
    tasks.add(new AppTask(appTasks.get(i)));
  }
  return tasks;
}
Program: 198142
Project: 198142
Buggy source:
public List<IAppTask> getAppTasks() throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  mRemote.transact(GET_APP_TASKS_TRANSACTION,data,reply,0);
  reply.readException();
  ArrayList<IAppTask> list=null;
  int N=reply.readInt();
  if (N >= 0) {
    list=new ArrayList<IAppTask>();
    while (N > 0) {
      IAppTask task=IAppTask.Stub.asInterface(reply.readStrongBinder());
      list.add(task);
      N--;
    }
  }
  data.recycle();
  reply.recycle();
  return list;
}

Fixed version (ground truth):
public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeString(callingPackage);
  mRemote.transact(GET_APP_TASKS_TRANSACTION,data,reply,0);
  reply.readException();
  ArrayList<IAppTask> list=null;
  int N=reply.readInt();
  if (N >= 0) {
    list=new ArrayList<IAppTask>();
    while (N > 0) {
      IAppTask task=IAppTask.Stub.asInterface(reply.readStrongBinder());
      list.add(task);
      N--;
    }
  }
  data.recycle();
  reply.recycle();
  return list;
}
Program: 198143
Project: 198143
Buggy source:
public List<IAppTask> getAppTasks() throws RemoteException ;

Fixed version (ground truth):
public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException ;
Program: 198145
Project: 198145
Buggy source:
@Override public List<IAppTask> getAppTasks(){
  final PackageManager pm=mContext.getPackageManager();
  int callingUid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
  HashSet<String> packages=new HashSet<String>();
  String[] uidPackages=pm.getPackagesForUid(callingUid);
  for (int i=0; i < uidPackages.length; i++) {
    packages.add(uidPackages[i]);
  }
synchronized (this) {
    ArrayList<IAppTask> list=new ArrayList<IAppTask>();
    try {
      if (localLOGV)       Slog.v(TAG,"String_Node_Str");
      final int N=mRecentTasks.size();
      for (int i=0; i < N; i++) {
        TaskRecord tr=mRecentTasks.get(i);
        if (packages.contains(tr.getBaseIntent().getComponent().getPackageName())) {
          ActivityManager.RecentTaskInfo taskInfo=createRecentTaskInfoFromTaskRecord(tr);
          AppTaskImpl taskImpl=new AppTaskImpl(taskInfo.persistentId,callingUid);
          list.add(taskImpl);
        }
      }
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
    return list;
  }
}

Fixed version (ground truth):
@Override public List<IAppTask> getAppTasks(String callingPackage){
  int callingUid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
synchronized (this) {
    ArrayList<IAppTask> list=new ArrayList<IAppTask>();
    try {
      if (localLOGV)       Slog.v(TAG,"String_Node_Str");
      final int N=mRecentTasks.size();
      for (int i=0; i < N; i++) {
        TaskRecord tr=mRecentTasks.get(i);
        if (tr.effectiveUid != callingUid) {
          continue;
        }
        Intent intent=tr.getBaseIntent();
        if (intent == null || !callingPackage.equals(intent.getComponent().getPackageName())) {
          continue;
        }
        ActivityManager.RecentTaskInfo taskInfo=createRecentTaskInfoFromTaskRecord(tr);
        AppTaskImpl taskImpl=new AppTaskImpl(taskInfo.persistentId,callingUid);
        list.add(taskImpl);
      }
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
    return list;
  }
}
Program: 198146
Project: 198146
Buggy source:
void getTasksLocked(List<RunningTaskInfo> list,int callingUid,boolean allowed){
  for (int taskNdx=mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
    final TaskRecord task=mTaskHistory.get(taskNdx);
    ActivityRecord r=null;
    ActivityRecord top=null;
    int numActivities=0;
    int numRunning=0;
    final ArrayList<ActivityRecord> activities=task.mActivities;
    if (activities.isEmpty()) {
      continue;
    }
    if (!allowed && !task.isHomeTask() && task.creatorUid != callingUid) {
      continue;
    }
    for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
      r=activities.get(activityNdx);
      if (top == null || (top.state == ActivityState.INITIALIZING)) {
        top=r;
        numActivities=numRunning=0;
      }
      numActivities++;
      if (r.app != null && r.app.thread != null) {
        numRunning++;
      }
      if (localLOGV)       Slog.v(TAG,r.intent.getComponent().flattenToShortString() + "String_Node_Str" + r.task);
    }
    RunningTaskInfo ci=new RunningTaskInfo();
    ci.id=task.taskId;
    ci.baseActivity=r.intent.getComponent();
    ci.topActivity=top.intent.getComponent();
    ci.lastActiveTime=task.lastActiveTime;
    if (top.task != null) {
      ci.description=top.task.lastDescription;
    }
    ci.numActivities=numActivities;
    ci.numRunning=numRunning;
    list.add(ci);
  }
}

Fixed version (ground truth):
void getTasksLocked(List<RunningTaskInfo> list,int callingUid,boolean allowed){
  for (int taskNdx=mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
    final TaskRecord task=mTaskHistory.get(taskNdx);
    ActivityRecord r=null;
    ActivityRecord top=null;
    int numActivities=0;
    int numRunning=0;
    final ArrayList<ActivityRecord> activities=task.mActivities;
    if (activities.isEmpty()) {
      continue;
    }
    if (!allowed && !task.isHomeTask() && task.effectiveUid != callingUid) {
      continue;
    }
    for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
      r=activities.get(activityNdx);
      if (top == null || (top.state == ActivityState.INITIALIZING)) {
        top=r;
        numActivities=numRunning=0;
      }
      numActivities++;
      if (r.app != null && r.app.thread != null) {
        numRunning++;
      }
      if (localLOGV)       Slog.v(TAG,r.intent.getComponent().flattenToShortString() + "String_Node_Str" + r.task);
    }
    RunningTaskInfo ci=new RunningTaskInfo();
    ci.id=task.taskId;
    ci.baseActivity=r.intent.getComponent();
    ci.topActivity=top.intent.getComponent();
    ci.lastActiveTime=task.lastActiveTime;
    if (top.task != null) {
      ci.description=top.task.lastDescription;
    }
    ci.numActivities=numActivities;
    ci.numRunning=numRunning;
    list.add(ci);
  }
}
Program: 198152
Project: 198152
Buggy source:
/** 
 * Get the list of tasks associated with the calling application.
 * @return The list of tasks associated with the application making this call.
 * @throws SecurityException
 */
public List<ActivityManager.AppTask> getAppTasks(){
  ArrayList<AppTask> tasks=new ArrayList<AppTask>();
  List<IAppTask> appTasks;
  try {
    appTasks=ActivityManagerNative.getDefault().getAppTasks();
  }
 catch (  RemoteException e) {
    return null;
  }
  int numAppTasks=appTasks.size();
  for (int i=0; i < numAppTasks; i++) {
    tasks.add(new AppTask(appTasks.get(i)));
  }
  return tasks;
}

Fixed version (ground truth):
/** 
 * Get the list of tasks associated with the calling application.
 * @return The list of tasks associated with the application making this call.
 * @throws SecurityException
 */
public List<ActivityManager.AppTask> getAppTasks(){
  ArrayList<AppTask> tasks=new ArrayList<AppTask>();
  List<IAppTask> appTasks;
  try {
    appTasks=ActivityManagerNative.getDefault().getAppTasks(mContext.getPackageName());
  }
 catch (  RemoteException e) {
    return null;
  }
  int numAppTasks=appTasks.size();
  for (int i=0; i < numAppTasks; i++) {
    tasks.add(new AppTask(appTasks.get(i)));
  }
  return tasks;
}
Program: 198154
Project: 198154
Buggy source:
public List<IAppTask> getAppTasks() throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  mRemote.transact(GET_APP_TASKS_TRANSACTION,data,reply,0);
  reply.readException();
  ArrayList<IAppTask> list=null;
  int N=reply.readInt();
  if (N >= 0) {
    list=new ArrayList<IAppTask>();
    while (N > 0) {
      IAppTask task=IAppTask.Stub.asInterface(reply.readStrongBinder());
      list.add(task);
      N--;
    }
  }
  data.recycle();
  reply.recycle();
  return list;
}

Fixed version (ground truth):
public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeString(callingPackage);
  mRemote.transact(GET_APP_TASKS_TRANSACTION,data,reply,0);
  reply.readException();
  ArrayList<IAppTask> list=null;
  int N=reply.readInt();
  if (N >= 0) {
    list=new ArrayList<IAppTask>();
    while (N > 0) {
      IAppTask task=IAppTask.Stub.asInterface(reply.readStrongBinder());
      list.add(task);
      N--;
    }
  }
  data.recycle();
  reply.recycle();
  return list;
}
Program: 198155
Project: 198155
Buggy source:
public List<IAppTask> getAppTasks() throws RemoteException ;

Fixed version (ground truth):
public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException ;
Program: 198157
Project: 198157
Buggy source:
@Override public List<IAppTask> getAppTasks(){
  final PackageManager pm=mContext.getPackageManager();
  int callingUid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
  HashSet<String> packages=new HashSet<String>();
  String[] uidPackages=pm.getPackagesForUid(callingUid);
  for (int i=0; i < uidPackages.length; i++) {
    packages.add(uidPackages[i]);
  }
synchronized (this) {
    ArrayList<IAppTask> list=new ArrayList<IAppTask>();
    try {
      if (localLOGV)       Slog.v(TAG,"String_Node_Str");
      final int N=mRecentTasks.size();
      for (int i=0; i < N; i++) {
        TaskRecord tr=mRecentTasks.get(i);
        if (packages.contains(tr.getBaseIntent().getComponent().getPackageName())) {
          ActivityManager.RecentTaskInfo taskInfo=createRecentTaskInfoFromTaskRecord(tr);
          AppTaskImpl taskImpl=new AppTaskImpl(taskInfo.persistentId,callingUid);
          list.add(taskImpl);
        }
      }
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
    return list;
  }
}

Fixed version (ground truth):
@Override public List<IAppTask> getAppTasks(String callingPackage){
  int callingUid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
synchronized (this) {
    ArrayList<IAppTask> list=new ArrayList<IAppTask>();
    try {
      if (localLOGV)       Slog.v(TAG,"String_Node_Str");
      final int N=mRecentTasks.size();
      for (int i=0; i < N; i++) {
        TaskRecord tr=mRecentTasks.get(i);
        if (tr.effectiveUid != callingUid) {
          continue;
        }
        Intent intent=tr.getBaseIntent();
        if (intent == null || !callingPackage.equals(intent.getComponent().getPackageName())) {
          continue;
        }
        ActivityManager.RecentTaskInfo taskInfo=createRecentTaskInfoFromTaskRecord(tr);
        AppTaskImpl taskImpl=new AppTaskImpl(taskInfo.persistentId,callingUid);
        list.add(taskImpl);
      }
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
    return list;
  }
}
Program: 198158
Project: 198158
Buggy source:
void getTasksLocked(List<RunningTaskInfo> list,int callingUid,boolean allowed){
  for (int taskNdx=mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
    final TaskRecord task=mTaskHistory.get(taskNdx);
    ActivityRecord r=null;
    ActivityRecord top=null;
    int numActivities=0;
    int numRunning=0;
    final ArrayList<ActivityRecord> activities=task.mActivities;
    if (activities.isEmpty()) {
      continue;
    }
    if (!allowed && !task.isHomeTask() && task.creatorUid != callingUid) {
      continue;
    }
    for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
      r=activities.get(activityNdx);
      if (top == null || (top.state == ActivityState.INITIALIZING)) {
        top=r;
        numActivities=numRunning=0;
      }
      numActivities++;
      if (r.app != null && r.app.thread != null) {
        numRunning++;
      }
      if (localLOGV)       Slog.v(TAG,r.intent.getComponent().flattenToShortString() + "String_Node_Str" + r.task);
    }
    RunningTaskInfo ci=new RunningTaskInfo();
    ci.id=task.taskId;
    ci.baseActivity=r.intent.getComponent();
    ci.topActivity=top.intent.getComponent();
    ci.lastActiveTime=task.lastActiveTime;
    if (top.task != null) {
      ci.description=top.task.lastDescription;
    }
    ci.numActivities=numActivities;
    ci.numRunning=numRunning;
    list.add(ci);
  }
}

Fixed version (ground truth):
void getTasksLocked(List<RunningTaskInfo> list,int callingUid,boolean allowed){
  for (int taskNdx=mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
    final TaskRecord task=mTaskHistory.get(taskNdx);
    ActivityRecord r=null;
    ActivityRecord top=null;
    int numActivities=0;
    int numRunning=0;
    final ArrayList<ActivityRecord> activities=task.mActivities;
    if (activities.isEmpty()) {
      continue;
    }
    if (!allowed && !task.isHomeTask() && task.effectiveUid != callingUid) {
      continue;
    }
    for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
      r=activities.get(activityNdx);
      if (top == null || (top.state == ActivityState.INITIALIZING)) {
        top=r;
        numActivities=numRunning=0;
      }
      numActivities++;
      if (r.app != null && r.app.thread != null) {
        numRunning++;
      }
      if (localLOGV)       Slog.v(TAG,r.intent.getComponent().flattenToShortString() + "String_Node_Str" + r.task);
    }
    RunningTaskInfo ci=new RunningTaskInfo();
    ci.id=task.taskId;
    ci.baseActivity=r.intent.getComponent();
    ci.topActivity=top.intent.getComponent();
    ci.lastActiveTime=task.lastActiveTime;
    if (top.task != null) {
      ci.description=top.task.lastDescription;
    }
    ci.numActivities=numActivities;
    ci.numRunning=numRunning;
    list.add(ci);
  }
}
Program: 198164
Project: 198164
Buggy source:
@Override protected void onViewRemoved(View child){
  super.onViewRemoved(child);
  mStackScrollAlgorithm.notifyChildrenChanged(this);
  if (mChangePositionInProgress) {
    return;
  }
  ((ExpandableView)child).setOnHeightChangedListener(null);
  mCurrentStackScrollState.removeViewStateForView(child);
  updateScrollStateForRemovedChild(child);
  boolean animationGenerated=generateRemoveAnimation(child);
  if (animationGenerated && !mSwipedOutViews.contains(child)) {
    getOverlay().add(child);
  }
}

Fixed version (ground truth):
@Override protected void onViewRemoved(View child){
  super.onViewRemoved(child);
  mStackScrollAlgorithm.notifyChildrenChanged(this);
  if (mChangePositionInProgress) {
    return;
  }
  ((ExpandableView)child).setOnHeightChangedListener(null);
  mCurrentStackScrollState.removeViewStateForView(child);
  updateScrollStateForRemovedChild(child);
  boolean animationGenerated=generateRemoveAnimation(child);
  if (animationGenerated && !mSwipedOutViews.contains(child)) {
    getOverlay().add(child);
  }
  child.setClipBounds(null);
}
Program: 198165
Project: 198165
Buggy source:
@Override protected void onViewRemoved(View child){
  super.onViewRemoved(child);
  mStackScrollAlgorithm.notifyChildrenChanged(this);
  if (mChangePositionInProgress) {
    return;
  }
  ((ExpandableView)child).setOnHeightChangedListener(null);
  mCurrentStackScrollState.removeViewStateForView(child);
  updateScrollStateForRemovedChild(child);
  boolean animationGenerated=generateRemoveAnimation(child);
  if (animationGenerated && !mSwipedOutViews.contains(child)) {
    getOverlay().add(child);
  }
}

Fixed version (ground truth):
@Override protected void onViewRemoved(View child){
  super.onViewRemoved(child);
  mStackScrollAlgorithm.notifyChildrenChanged(this);
  if (mChangePositionInProgress) {
    return;
  }
  ((ExpandableView)child).setOnHeightChangedListener(null);
  mCurrentStackScrollState.removeViewStateForView(child);
  updateScrollStateForRemovedChild(child);
  boolean animationGenerated=generateRemoveAnimation(child);
  if (animationGenerated && !mSwipedOutViews.contains(child)) {
    getOverlay().add(child);
  }
  child.setClipBounds(null);
}
Program: 198166
Project: 198166
Buggy source:
@Override protected void onViewRemoved(View child){
  super.onViewRemoved(child);
  mStackScrollAlgorithm.notifyChildrenChanged(this);
  if (mChangePositionInProgress) {
    return;
  }
  ((ExpandableView)child).setOnHeightChangedListener(null);
  mCurrentStackScrollState.removeViewStateForView(child);
  updateScrollStateForRemovedChild(child);
  boolean animationGenerated=generateRemoveAnimation(child);
  if (animationGenerated && !mSwipedOutViews.contains(child)) {
    getOverlay().add(child);
  }
}

Fixed version (ground truth):
@Override protected void onViewRemoved(View child){
  super.onViewRemoved(child);
  mStackScrollAlgorithm.notifyChildrenChanged(this);
  if (mChangePositionInProgress) {
    return;
  }
  ((ExpandableView)child).setOnHeightChangedListener(null);
  mCurrentStackScrollState.removeViewStateForView(child);
  updateScrollStateForRemovedChild(child);
  boolean animationGenerated=generateRemoveAnimation(child);
  if (animationGenerated && !mSwipedOutViews.contains(child)) {
    getOverlay().add(child);
  }
  child.setClipBounds(null);
}
Program: 198167
Project: 198167
Buggy source:
@Override public void onReset(ExpandableView view){
  mRequestViewResizeAnimationOnLayout=true;
  mStackScrollAlgorithm.onReset(view);
}

Fixed version (ground truth):
@Override public void onReset(ExpandableView view){
  if (mIsExpanded && mAnimationsEnabled) {
    mRequestViewResizeAnimationOnLayout=true;
  }
  mStackScrollAlgorithm.onReset(view);
}
Program: 198168
Project: 198168
Buggy source:
@Override public void onReset(ExpandableView view){
  mRequestViewResizeAnimationOnLayout=true;
  mStackScrollAlgorithm.onReset(view);
}

Fixed version (ground truth):
@Override public void onReset(ExpandableView view){
  if (mIsExpanded && mAnimationsEnabled) {
    mRequestViewResizeAnimationOnLayout=true;
  }
  mStackScrollAlgorithm.onReset(view);
}
Program: 198169
Project: 198169
Buggy source:
@Override public void onReset(ExpandableView view){
  mRequestViewResizeAnimationOnLayout=true;
  mStackScrollAlgorithm.onReset(view);
}

Fixed version (ground truth):
@Override public void onReset(ExpandableView view){
  if (mIsExpanded && mAnimationsEnabled) {
    mRequestViewResizeAnimationOnLayout=true;
  }
  mStackScrollAlgorithm.onReset(view);
}
Program: 198170
Project: 198170
Buggy source:
@Override public void onReset(ExpandableView view){
  mRequestViewResizeAnimationOnLayout=true;
  mStackScrollAlgorithm.onReset(view);
}

Fixed version (ground truth):
@Override public void onReset(ExpandableView view){
  if (mIsExpanded && mAnimationsEnabled) {
    mRequestViewResizeAnimationOnLayout=true;
  }
  mStackScrollAlgorithm.onReset(view);
}
Program: 198171
Project: 198171
Buggy source:
/** 
 * Returns an intent to launch an activity that manages the given keyphrase for the locale.
 * @param action The enrollment related action that this intent is supposed to perform.This can be one of  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_ENROLL},  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_RE_ENROLL}or   {@link AlwaysOnHotwordDetector#MANAGE_ACTION_UN_ENROLL}
 * @param keyphrase The keyphrase that the user needs to be enrolled to.
 * @param locale The locale for which the enrollment needs to be performed.
 * @return An {@link Intent} to manage the keyphrase. This can be null if managing thegiven keyphrase/locale combination isn't possible.
 */
public Intent getManageKeyphraseIntent(int action,String keyphrase,Locale locale){
  if (mEnrollmentPackage == null || mEnrollmentPackage.isEmpty()) {
    Slog.w(TAG,"String_Node_Str");
    return null;
  }
  if (getKeyphraseMetadata(keyphrase,locale) != null) {
    Intent intent=new Intent(ACTION_MANAGE_VOICE_KEYPHRASES).setPackage(mEnrollmentPackage).putExtra(EXTRA_VOICE_KEYPHRASE_HINT_TEXT,keyphrase).putExtra(EXTRA_VOICE_KEYPHRASE_LOCALE,locale).putExtra(EXTRA_VOICE_KEYPHRASE_ACTION,action);
    return intent;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns an intent to launch an activity that manages the given keyphrase for the locale.
 * @param action The enrollment related action that this intent is supposed to perform.This can be one of  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_ENROLL},  {@link AlwaysOnHotwordDetector#MANAGE_ACTION_RE_ENROLL}or   {@link AlwaysOnHotwordDetector#MANAGE_ACTION_UN_ENROLL}
 * @param keyphrase The keyphrase that the user needs to be enrolled to.
 * @param locale The locale for which the enrollment needs to be performed.
 * @return An {@link Intent} to manage the keyphrase. This can be null if managing thegiven keyphrase/locale combination isn't possible.
 */
public Intent getManageKeyphraseIntent(int action,String keyphrase,Locale locale){
  if (mEnrollmentPackage == null || mEnrollmentPackage.isEmpty()) {
    Slog.w(TAG,"String_Node_Str");
    return null;
  }
  if (getKeyphraseMetadata(keyphrase,locale) != null) {
    Intent intent=new Intent(ACTION_MANAGE_VOICE_KEYPHRASES).setPackage(mEnrollmentPackage).putExtra(EXTRA_VOICE_KEYPHRASE_HINT_TEXT,keyphrase).putExtra(EXTRA_VOICE_KEYPHRASE_LOCALE,locale.toLanguageTag()).putExtra(EXTRA_VOICE_KEYPHRASE_ACTION,action);
    return intent;
  }
  return null;
}
Program: 198172
Project: 198172
Buggy source:
@Override public void onReset(ExpandableView view){
  mRequestViewResizeAnimationOnLayout=true;
  mStackScrollAlgorithm.onReset(view);
}

Fixed version (ground truth):
@Override public void onReset(ExpandableView view){
  if (mIsExpanded && mAnimationsEnabled) {
    mRequestViewResizeAnimationOnLayout=true;
  }
  mStackScrollAlgorithm.onReset(view);
}
Program: 198173
Project: 198173
Buggy source:
/** 
 * Get the list of tasks associated with the calling application.
 * @return The list of tasks associated with the application making this call.
 * @throws SecurityException
 */
public List<ActivityManager.AppTask> getAppTasks(){
  ArrayList<AppTask> tasks=new ArrayList<AppTask>();
  List<IAppTask> appTasks;
  try {
    appTasks=ActivityManagerNative.getDefault().getAppTasks();
  }
 catch (  RemoteException e) {
    return null;
  }
  int numAppTasks=appTasks.size();
  for (int i=0; i < numAppTasks; i++) {
    tasks.add(new AppTask(appTasks.get(i)));
  }
  return tasks;
}

Fixed version (ground truth):
/** 
 * Get the list of tasks associated with the calling application.
 * @return The list of tasks associated with the application making this call.
 * @throws SecurityException
 */
public List<ActivityManager.AppTask> getAppTasks(){
  ArrayList<AppTask> tasks=new ArrayList<AppTask>();
  List<IAppTask> appTasks;
  try {
    appTasks=ActivityManagerNative.getDefault().getAppTasks(mContext.getPackageName());
  }
 catch (  RemoteException e) {
    return null;
  }
  int numAppTasks=appTasks.size();
  for (int i=0; i < numAppTasks; i++) {
    tasks.add(new AppTask(appTasks.get(i)));
  }
  return tasks;
}
Program: 198175
Project: 198175
Buggy source:
public List<IAppTask> getAppTasks() throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  mRemote.transact(GET_APP_TASKS_TRANSACTION,data,reply,0);
  reply.readException();
  ArrayList<IAppTask> list=null;
  int N=reply.readInt();
  if (N >= 0) {
    list=new ArrayList<IAppTask>();
    while (N > 0) {
      IAppTask task=IAppTask.Stub.asInterface(reply.readStrongBinder());
      list.add(task);
      N--;
    }
  }
  data.recycle();
  reply.recycle();
  return list;
}

Fixed version (ground truth):
public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException {
  Parcel data=Parcel.obtain();
  Parcel reply=Parcel.obtain();
  data.writeInterfaceToken(IActivityManager.descriptor);
  data.writeString(callingPackage);
  mRemote.transact(GET_APP_TASKS_TRANSACTION,data,reply,0);
  reply.readException();
  ArrayList<IAppTask> list=null;
  int N=reply.readInt();
  if (N >= 0) {
    list=new ArrayList<IAppTask>();
    while (N > 0) {
      IAppTask task=IAppTask.Stub.asInterface(reply.readStrongBinder());
      list.add(task);
      N--;
    }
  }
  data.recycle();
  reply.recycle();
  return list;
}
Program: 198176
Project: 198176
Buggy source:
public List<IAppTask> getAppTasks() throws RemoteException ;

Fixed version (ground truth):
public List<IAppTask> getAppTasks(String callingPackage) throws RemoteException ;
Program: 198178
Project: 198178
Buggy source:
@Override public List<IAppTask> getAppTasks(){
  final PackageManager pm=mContext.getPackageManager();
  int callingUid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
  HashSet<String> packages=new HashSet<String>();
  String[] uidPackages=pm.getPackagesForUid(callingUid);
  for (int i=0; i < uidPackages.length; i++) {
    packages.add(uidPackages[i]);
  }
synchronized (this) {
    ArrayList<IAppTask> list=new ArrayList<IAppTask>();
    try {
      if (localLOGV)       Slog.v(TAG,"String_Node_Str");
      final int N=mRecentTasks.size();
      for (int i=0; i < N; i++) {
        TaskRecord tr=mRecentTasks.get(i);
        if (packages.contains(tr.getBaseIntent().getComponent().getPackageName())) {
          ActivityManager.RecentTaskInfo taskInfo=createRecentTaskInfoFromTaskRecord(tr);
          AppTaskImpl taskImpl=new AppTaskImpl(taskInfo.persistentId,callingUid);
          list.add(taskImpl);
        }
      }
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
    return list;
  }
}

Fixed version (ground truth):
@Override public List<IAppTask> getAppTasks(String callingPackage){
  int callingUid=Binder.getCallingUid();
  long ident=Binder.clearCallingIdentity();
synchronized (this) {
    ArrayList<IAppTask> list=new ArrayList<IAppTask>();
    try {
      if (localLOGV)       Slog.v(TAG,"String_Node_Str");
      final int N=mRecentTasks.size();
      for (int i=0; i < N; i++) {
        TaskRecord tr=mRecentTasks.get(i);
        if (tr.effectiveUid != callingUid) {
          continue;
        }
        Intent intent=tr.getBaseIntent();
        if (intent == null || !callingPackage.equals(intent.getComponent().getPackageName())) {
          continue;
        }
        ActivityManager.RecentTaskInfo taskInfo=createRecentTaskInfoFromTaskRecord(tr);
        AppTaskImpl taskImpl=new AppTaskImpl(taskInfo.persistentId,callingUid);
        list.add(taskImpl);
      }
    }
  finally {
      Binder.restoreCallingIdentity(ident);
    }
    return list;
  }
}
Program: 198179
Project: 198179
Buggy source:
void getTasksLocked(List<RunningTaskInfo> list,int callingUid,boolean allowed){
  for (int taskNdx=mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
    final TaskRecord task=mTaskHistory.get(taskNdx);
    ActivityRecord r=null;
    ActivityRecord top=null;
    int numActivities=0;
    int numRunning=0;
    final ArrayList<ActivityRecord> activities=task.mActivities;
    if (activities.isEmpty()) {
      continue;
    }
    if (!allowed && !task.isHomeTask() && task.creatorUid != callingUid) {
      continue;
    }
    for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
      r=activities.get(activityNdx);
      if (top == null || (top.state == ActivityState.INITIALIZING)) {
        top=r;
        numActivities=numRunning=0;
      }
      numActivities++;
      if (r.app != null && r.app.thread != null) {
        numRunning++;
      }
      if (localLOGV)       Slog.v(TAG,r.intent.getComponent().flattenToShortString() + "String_Node_Str" + r.task);
    }
    RunningTaskInfo ci=new RunningTaskInfo();
    ci.id=task.taskId;
    ci.baseActivity=r.intent.getComponent();
    ci.topActivity=top.intent.getComponent();
    ci.lastActiveTime=task.lastActiveTime;
    if (top.task != null) {
      ci.description=top.task.lastDescription;
    }
    ci.numActivities=numActivities;
    ci.numRunning=numRunning;
    list.add(ci);
  }
}

Fixed version (ground truth):
void getTasksLocked(List<RunningTaskInfo> list,int callingUid,boolean allowed){
  for (int taskNdx=mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
    final TaskRecord task=mTaskHistory.get(taskNdx);
    ActivityRecord r=null;
    ActivityRecord top=null;
    int numActivities=0;
    int numRunning=0;
    final ArrayList<ActivityRecord> activities=task.mActivities;
    if (activities.isEmpty()) {
      continue;
    }
    if (!allowed && !task.isHomeTask() && task.effectiveUid != callingUid) {
      continue;
    }
    for (int activityNdx=activities.size() - 1; activityNdx >= 0; --activityNdx) {
      r=activities.get(activityNdx);
      if (top == null || (top.state == ActivityState.INITIALIZING)) {
        top=r;
        numActivities=numRunning=0;
      }
      numActivities++;
      if (r.app != null && r.app.thread != null) {
        numRunning++;
      }
      if (localLOGV)       Slog.v(TAG,r.intent.getComponent().flattenToShortString() + "String_Node_Str" + r.task);
    }
    RunningTaskInfo ci=new RunningTaskInfo();
    ci.id=task.taskId;
    ci.baseActivity=r.intent.getComponent();
    ci.topActivity=top.intent.getComponent();
    ci.lastActiveTime=task.lastActiveTime;
    if (top.task != null) {
      ci.description=top.task.lastDescription;
    }
    ci.numActivities=numActivities;
    ci.numRunning=numRunning;
    list.add(ci);
  }
}