nus-yam/ex-repair huggingface dataset:
Program: 199322
Project: 199322
Buggy source:
private int getScrollRange(){
  int scrollRange=0;
  ExpandableView firstChild=(ExpandableView)getFirstChildNotGone();
  if (firstChild != null) {
    int contentHeight=getContentHeight();
    int firstChildMaxExpandHeight=getMaxExpandHeight(firstChild);
    scrollRange=Math.max(0,contentHeight - mMaxLayoutHeight + mBottomStackPeekSize);
    if (scrollRange > 0 && getChildCount() > 0) {
      scrollRange=Math.max(scrollRange,firstChildMaxExpandHeight - mCollapsedSize);
    }
  }
  return scrollRange;
}

Fixed version (ground truth):
private int getScrollRange(){
  int scrollRange=0;
  ExpandableView firstChild=(ExpandableView)getFirstChildNotGone();
  if (firstChild != null) {
    int contentHeight=getContentHeight();
    int firstChildMaxExpandHeight=getMaxExpandHeight(firstChild);
    scrollRange=Math.max(0,contentHeight - mMaxLayoutHeight + mBottomStackPeekSize);
    if (scrollRange > 0) {
      View lastChild=getLastChildNotGone();
      if (isViewExpanded(lastChild)) {
        scrollRange+=mCollapsedSize + mPaddingBetweenElements;
      }
      scrollRange=Math.max(scrollRange,firstChildMaxExpandHeight - mCollapsedSize);
    }
  }
  return scrollRange;
}
Program: 199323
Project: 199323
Buggy source:
public int getEmptyBottomMargin(){
  return Math.max(getHeight() - mContentHeight,0);
}

Fixed version (ground truth):
public int getEmptyBottomMargin(){
  int emptyMargin=mMaxLayoutHeight - mContentHeight;
  if (needsHeightAdaption()) {
    emptyMargin=emptyMargin - mCollapsedSize - mBottomStackPeekSize;
  }
  return Math.max(emptyMargin,0);
}
Program: 199325
Project: 199325
Buggy source:
private String calculateApkRoot(final String codePathString){
  final File codePath=new File(codePathString);
  final File codeRoot;
  if (FileUtils.contains(Environment.getRootDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getOemDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getVendorDirectory(),codePath)) {
    codeRoot=Environment.getVendorDirectory();
  }
 else {
    try {
      File f=codePath.getCanonicalFile();
      File parent=f.getParentFile();
      File tmp;
      while ((tmp=parent.getParentFile()) != null) {
        f=parent;
        parent=tmp;
      }
      codeRoot=f;
      Slog.w(TAG,"String_Node_Str" + codePath + "String_Node_Str"+ codeRoot);
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + codePath);
      return Environment.getRootDirectory().getPath();
    }
  }
  return codeRoot.getPath();
}

Fixed version (ground truth):
private String calculateApkRoot(final String codePathString){
  final File codePath=new File(codePathString);
  final File codeRoot;
  if (FileUtils.contains(Environment.getRootDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getOemDirectory(),codePath)) {
    codeRoot=Environment.getOemDirectory();
  }
 else   if (FileUtils.contains(Environment.getVendorDirectory(),codePath)) {
    codeRoot=Environment.getVendorDirectory();
  }
 else {
    try {
      File f=codePath.getCanonicalFile();
      File parent=f.getParentFile();
      File tmp;
      while ((tmp=parent.getParentFile()) != null) {
        f=parent;
        parent=tmp;
      }
      codeRoot=f;
      Slog.w(TAG,"String_Node_Str" + codePath + "String_Node_Str"+ codeRoot);
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + codePath);
      return Environment.getRootDirectory().getPath();
    }
  }
  return codeRoot.getPath();
}
Program: 199326
Project: 199326
Buggy source:
private String calculateApkRoot(final String codePathString){
  final File codePath=new File(codePathString);
  final File codeRoot;
  if (FileUtils.contains(Environment.getRootDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getOemDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getVendorDirectory(),codePath)) {
    codeRoot=Environment.getVendorDirectory();
  }
 else {
    try {
      File f=codePath.getCanonicalFile();
      File parent=f.getParentFile();
      File tmp;
      while ((tmp=parent.getParentFile()) != null) {
        f=parent;
        parent=tmp;
      }
      codeRoot=f;
      Slog.w(TAG,"String_Node_Str" + codePath + "String_Node_Str"+ codeRoot);
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + codePath);
      return Environment.getRootDirectory().getPath();
    }
  }
  return codeRoot.getPath();
}

Fixed version (ground truth):
private String calculateApkRoot(final String codePathString){
  final File codePath=new File(codePathString);
  final File codeRoot;
  if (FileUtils.contains(Environment.getRootDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getOemDirectory(),codePath)) {
    codeRoot=Environment.getOemDirectory();
  }
 else   if (FileUtils.contains(Environment.getVendorDirectory(),codePath)) {
    codeRoot=Environment.getVendorDirectory();
  }
 else {
    try {
      File f=codePath.getCanonicalFile();
      File parent=f.getParentFile();
      File tmp;
      while ((tmp=parent.getParentFile()) != null) {
        f=parent;
        parent=tmp;
      }
      codeRoot=f;
      Slog.w(TAG,"String_Node_Str" + codePath + "String_Node_Str"+ codeRoot);
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + codePath);
      return Environment.getRootDirectory().getPath();
    }
  }
  return codeRoot.getPath();
}
Program: 199327
Project: 199327
Buggy source:
private String calculateApkRoot(final String codePathString){
  final File codePath=new File(codePathString);
  final File codeRoot;
  if (FileUtils.contains(Environment.getRootDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getOemDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getVendorDirectory(),codePath)) {
    codeRoot=Environment.getVendorDirectory();
  }
 else {
    try {
      File f=codePath.getCanonicalFile();
      File parent=f.getParentFile();
      File tmp;
      while ((tmp=parent.getParentFile()) != null) {
        f=parent;
        parent=tmp;
      }
      codeRoot=f;
      Slog.w(TAG,"String_Node_Str" + codePath + "String_Node_Str"+ codeRoot);
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + codePath);
      return Environment.getRootDirectory().getPath();
    }
  }
  return codeRoot.getPath();
}

Fixed version (ground truth):
private String calculateApkRoot(final String codePathString){
  final File codePath=new File(codePathString);
  final File codeRoot;
  if (FileUtils.contains(Environment.getRootDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getOemDirectory(),codePath)) {
    codeRoot=Environment.getOemDirectory();
  }
 else   if (FileUtils.contains(Environment.getVendorDirectory(),codePath)) {
    codeRoot=Environment.getVendorDirectory();
  }
 else {
    try {
      File f=codePath.getCanonicalFile();
      File parent=f.getParentFile();
      File tmp;
      while ((tmp=parent.getParentFile()) != null) {
        f=parent;
        parent=tmp;
      }
      codeRoot=f;
      Slog.w(TAG,"String_Node_Str" + codePath + "String_Node_Str"+ codeRoot);
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + codePath);
      return Environment.getRootDirectory().getPath();
    }
  }
  return codeRoot.getPath();
}
Program: 199328
Project: 199328
Buggy source:
private String calculateApkRoot(final String codePathString){
  final File codePath=new File(codePathString);
  final File codeRoot;
  if (FileUtils.contains(Environment.getRootDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getOemDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getVendorDirectory(),codePath)) {
    codeRoot=Environment.getVendorDirectory();
  }
 else {
    try {
      File f=codePath.getCanonicalFile();
      File parent=f.getParentFile();
      File tmp;
      while ((tmp=parent.getParentFile()) != null) {
        f=parent;
        parent=tmp;
      }
      codeRoot=f;
      Slog.w(TAG,"String_Node_Str" + codePath + "String_Node_Str"+ codeRoot);
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + codePath);
      return Environment.getRootDirectory().getPath();
    }
  }
  return codeRoot.getPath();
}

Fixed version (ground truth):
private String calculateApkRoot(final String codePathString){
  final File codePath=new File(codePathString);
  final File codeRoot;
  if (FileUtils.contains(Environment.getRootDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getOemDirectory(),codePath)) {
    codeRoot=Environment.getOemDirectory();
  }
 else   if (FileUtils.contains(Environment.getVendorDirectory(),codePath)) {
    codeRoot=Environment.getVendorDirectory();
  }
 else {
    try {
      File f=codePath.getCanonicalFile();
      File parent=f.getParentFile();
      File tmp;
      while ((tmp=parent.getParentFile()) != null) {
        f=parent;
        parent=tmp;
      }
      codeRoot=f;
      Slog.w(TAG,"String_Node_Str" + codePath + "String_Node_Str"+ codeRoot);
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + codePath);
      return Environment.getRootDirectory().getPath();
    }
  }
  return codeRoot.getPath();
}
Program: 199329
Project: 199329
Buggy source:
static void preload(){
  preloadClasses();
  preloadResources();
  preloadOpenGL();
}

Fixed version (ground truth):
static void preload(){
  Log.d(TAG,"String_Node_Str");
  preloadClasses();
  preloadResources();
  preloadOpenGL();
  Log.d(TAG,"String_Node_Str");
}
Program: 199330
Project: 199330
Buggy source:
/** 
 * Close and clean up zygote sockets. Called on shutdown and on the child's exit path.
 */
static void closeServerSocket(){
  try {
    if (sServerSocket != null) {
      FileDescriptor fd=sServerSocket.getFileDescriptor();
      sServerSocket.close();
      if (fd != null) {
        Libcore.os.close(fd);
      }
    }
  }
 catch (  IOException ex) {
    Log.e(TAG,"String_Node_Str",ex);
  }
catch (  libcore.io.ErrnoException ex) {
    Log.e(TAG,"String_Node_Str",ex);
  }
  sServerSocket=null;
}

Fixed version (ground truth):
/** 
 * Close and clean up zygote sockets. Called on shutdown and on the child's exit path.
 */
static void closeServerSocket(){
  try {
    if (sServerSocket != null) {
      FileDescriptor fd=sServerSocket.getFileDescriptor();
      sServerSocket.close();
      if (fd != null) {
        Os.close(fd);
      }
    }
  }
 catch (  IOException ex) {
    Log.e(TAG,"String_Node_Str",ex);
  }
catch (  ErrnoException ex) {
    Log.e(TAG,"String_Node_Str",ex);
  }
  sServerSocket=null;
}
Program: 199331
Project: 199331
Buggy source:
static void preload(){
  preloadClasses();
  preloadResources();
  preloadOpenGL();
}

Fixed version (ground truth):
static void preload(){
  Log.d(TAG,"String_Node_Str");
  preloadClasses();
  preloadResources();
  preloadOpenGL();
  Log.d(TAG,"String_Node_Str");
}
Program: 199332
Project: 199332
Buggy source:
/** 
 * Close and clean up zygote sockets. Called on shutdown and on the child's exit path.
 */
static void closeServerSocket(){
  try {
    if (sServerSocket != null) {
      FileDescriptor fd=sServerSocket.getFileDescriptor();
      sServerSocket.close();
      if (fd != null) {
        Libcore.os.close(fd);
      }
    }
  }
 catch (  IOException ex) {
    Log.e(TAG,"String_Node_Str",ex);
  }
catch (  libcore.io.ErrnoException ex) {
    Log.e(TAG,"String_Node_Str",ex);
  }
  sServerSocket=null;
}

Fixed version (ground truth):
/** 
 * Close and clean up zygote sockets. Called on shutdown and on the child's exit path.
 */
static void closeServerSocket(){
  try {
    if (sServerSocket != null) {
      FileDescriptor fd=sServerSocket.getFileDescriptor();
      sServerSocket.close();
      if (fd != null) {
        Os.close(fd);
      }
    }
  }
 catch (  IOException ex) {
    Log.e(TAG,"String_Node_Str",ex);
  }
catch (  ErrnoException ex) {
    Log.e(TAG,"String_Node_Str",ex);
  }
  sServerSocket=null;
}
Program: 199333
Project: 199333
Buggy source:
/** 
 * Sets the outline of the view, which defines the shape of the shadow it casts. <p> If the outline is not set or is null, shadows will be cast from the bounds of the View.
 * @param outline The new outline of the view.Must be  {@link android.graphics.Outline#isValid() valid.}
 */
public void setOutline(@Nullable Outline outline){
  if (outline != null && !outline.isValid()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mPrivateFlags3|=PFLAG3_OUTLINE_DEFINED;
  if (outline == null) {
    mOutline=null;
  }
 else {
    if (mOutline == null) {
      mOutline=new Outline(outline);
    }
  }
  mRenderNode.setOutline(mOutline);
}

Fixed version (ground truth):
/** 
 * Sets the outline of the view, which defines the shape of the shadow it casts. <p> If the outline is not set or is null, shadows will be cast from the bounds of the View.
 * @param outline The new outline of the view.Must be  {@link android.graphics.Outline#isValid() valid.}
 */
public void setOutline(@Nullable Outline outline){
  if (outline != null && !outline.isValid()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mPrivateFlags3|=PFLAG3_OUTLINE_DEFINED;
  if (outline == null) {
    mOutline=null;
  }
 else {
    if (mOutline == null) {
      mOutline=new Outline();
    }
    mOutline.set(outline);
  }
  mRenderNode.setOutline(mOutline);
}
Program: 199334
Project: 199334
Buggy source:
/** 
 * Sets the outline of the view, which defines the shape of the shadow it casts. <p> If the outline is not set or is null, shadows will be cast from the bounds of the View.
 * @param outline The new outline of the view.Must be  {@link android.graphics.Outline#isValid() valid.}
 */
public void setOutline(@Nullable Outline outline){
  if (outline != null && !outline.isValid()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mPrivateFlags3|=PFLAG3_OUTLINE_DEFINED;
  if (outline == null) {
    mOutline=null;
  }
 else {
    if (mOutline == null) {
      mOutline=new Outline(outline);
    }
  }
  mRenderNode.setOutline(mOutline);
}

Fixed version (ground truth):
/** 
 * Sets the outline of the view, which defines the shape of the shadow it casts. <p> If the outline is not set or is null, shadows will be cast from the bounds of the View.
 * @param outline The new outline of the view.Must be  {@link android.graphics.Outline#isValid() valid.}
 */
public void setOutline(@Nullable Outline outline){
  if (outline != null && !outline.isValid()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mPrivateFlags3|=PFLAG3_OUTLINE_DEFINED;
  if (outline == null) {
    mOutline=null;
  }
 else {
    if (mOutline == null) {
      mOutline=new Outline();
    }
    mOutline.set(outline);
  }
  mRenderNode.setOutline(mOutline);
}
Program: 199335
Project: 199335
Buggy source:
/** 
 * Sets the outline of the view, which defines the shape of the shadow it casts. <p> If the outline is not set or is null, shadows will be cast from the bounds of the View.
 * @param outline The new outline of the view.Must be  {@link android.graphics.Outline#isValid() valid.}
 */
public void setOutline(@Nullable Outline outline){
  if (outline != null && !outline.isValid()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mPrivateFlags3|=PFLAG3_OUTLINE_DEFINED;
  if (outline == null) {
    mOutline=null;
  }
 else {
    if (mOutline == null) {
      mOutline=new Outline(outline);
    }
  }
  mRenderNode.setOutline(mOutline);
}

Fixed version (ground truth):
/** 
 * Sets the outline of the view, which defines the shape of the shadow it casts. <p> If the outline is not set or is null, shadows will be cast from the bounds of the View.
 * @param outline The new outline of the view.Must be  {@link android.graphics.Outline#isValid() valid.}
 */
public void setOutline(@Nullable Outline outline){
  if (outline != null && !outline.isValid()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mPrivateFlags3|=PFLAG3_OUTLINE_DEFINED;
  if (outline == null) {
    mOutline=null;
  }
 else {
    if (mOutline == null) {
      mOutline=new Outline();
    }
    mOutline.set(outline);
  }
  mRenderNode.setOutline(mOutline);
}
Program: 199336
Project: 199336
Buggy source:
@Override public boolean onPackageChanged(String packageName,int uid,String[] components){
  final PackageManager pm=mContext.getPackageManager();
  final ArrayList<TaskRecord> recentTasks=new ArrayList<TaskRecord>();
  final ArrayList<TaskRecord> tasksToRemove=new ArrayList<TaskRecord>();
synchronized (ActivityManagerService.this) {
    recentTasks.addAll(mRecentTasks);
  }
  Intent tmpI=new Intent();
  for (int i=recentTasks.size() - 1; i >= 0; i--) {
    TaskRecord tr=recentTasks.get(i);
    ComponentName cn=tr.intent.getComponent();
    if (cn != null && cn.getPackageName().equals(packageName)) {
      try {
        tmpI.setComponent(cn);
        if (pm.queryIntentActivities(tmpI,PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
          tasksToRemove.add(tr);
        }
      }
 catch (      Exception e) {
      }
    }
  }
synchronized (ActivityManagerService.this) {
    for (int i=tasksToRemove.size() - 1; i >= 0; i--) {
      TaskRecord tr=tasksToRemove.get(i);
      removeTaskByIdLocked(tr.taskId,0);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onPackageChanged(String packageName,int uid,String[] components){
  final PackageManager pm=mContext.getPackageManager();
  final ArrayList<Pair<Intent,Integer>> recentTaskIntents=new ArrayList<Pair<Intent,Integer>>();
  final ArrayList<Integer> tasksToRemove=new ArrayList<Integer>();
synchronized (ActivityManagerService.this) {
    for (int i=mRecentTasks.size() - 1; i >= 0; i--) {
      TaskRecord tr=mRecentTasks.get(i);
      recentTaskIntents.add(new Pair<Intent,Integer>(tr.intent,tr.taskId));
    }
  }
  Intent tmpI=new Intent();
  for (int i=recentTaskIntents.size() - 1; i >= 0; i--) {
    Pair<Intent,Integer> p=recentTaskIntents.get(i);
    ComponentName cn=p.first.getComponent();
    if (cn != null && cn.getPackageName().equals(packageName)) {
      try {
        tmpI.setComponent(cn);
        if (pm.queryIntentActivities(tmpI,PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
          tasksToRemove.add(p.second);
        }
      }
 catch (      Exception e) {
      }
    }
  }
synchronized (ActivityManagerService.this) {
    for (int i=tasksToRemove.size() - 1; i >= 0; i--) {
      removeTaskByIdLocked(tasksToRemove.get(i),0);
    }
  }
  return true;
}
Program: 199337
Project: 199337
Buggy source:
private void adjustFocusedActivityLocked(ActivityRecord r){
  if (mStackSupervisor.isFrontStack(this) && mService.mFocusedActivity == r) {
    ActivityRecord next=topRunningActivityLocked(null);
    if (next != r) {
      final TaskRecord task=r.task;
      if (r.frontOfTask && task == topTask() && task.mOnTopOfHome) {
        mStackSupervisor.moveHomeToTop();
      }
    }
    mService.setFocusedActivityLocked(mStackSupervisor.topRunningActivityLocked());
  }
}

Fixed version (ground truth):
private void adjustFocusedActivityLocked(ActivityRecord r){
  if (mStackSupervisor.isFrontStack(this) && mService.mFocusedActivity == r) {
    ActivityRecord next=topRunningActivityLocked(null);
    if (next != r) {
      final TaskRecord task=r.task;
      if (r.frontOfTask && task == topTask() && task.mOnTopOfHome) {
        mStackSupervisor.moveHomeToTop();
      }
    }
    ActivityRecord top=mStackSupervisor.topRunningActivityLocked();
    if (top != null) {
      mService.setFocusedActivityLocked(top);
    }
  }
}
Program: 199338
Project: 199338
Buggy source:
@Override public boolean onPackageChanged(String packageName,int uid,String[] components){
  final PackageManager pm=mContext.getPackageManager();
  final ArrayList<TaskRecord> recentTasks=new ArrayList<TaskRecord>();
  final ArrayList<TaskRecord> tasksToRemove=new ArrayList<TaskRecord>();
synchronized (ActivityManagerService.this) {
    recentTasks.addAll(mRecentTasks);
  }
  Intent tmpI=new Intent();
  for (int i=recentTasks.size() - 1; i >= 0; i--) {
    TaskRecord tr=recentTasks.get(i);
    ComponentName cn=tr.intent.getComponent();
    if (cn != null && cn.getPackageName().equals(packageName)) {
      try {
        tmpI.setComponent(cn);
        if (pm.queryIntentActivities(tmpI,PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
          tasksToRemove.add(tr);
        }
      }
 catch (      Exception e) {
      }
    }
  }
synchronized (ActivityManagerService.this) {
    for (int i=tasksToRemove.size() - 1; i >= 0; i--) {
      TaskRecord tr=tasksToRemove.get(i);
      removeTaskByIdLocked(tr.taskId,0);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onPackageChanged(String packageName,int uid,String[] components){
  final PackageManager pm=mContext.getPackageManager();
  final ArrayList<Pair<Intent,Integer>> recentTaskIntents=new ArrayList<Pair<Intent,Integer>>();
  final ArrayList<Integer> tasksToRemove=new ArrayList<Integer>();
synchronized (ActivityManagerService.this) {
    for (int i=mRecentTasks.size() - 1; i >= 0; i--) {
      TaskRecord tr=mRecentTasks.get(i);
      recentTaskIntents.add(new Pair<Intent,Integer>(tr.intent,tr.taskId));
    }
  }
  Intent tmpI=new Intent();
  for (int i=recentTaskIntents.size() - 1; i >= 0; i--) {
    Pair<Intent,Integer> p=recentTaskIntents.get(i);
    ComponentName cn=p.first.getComponent();
    if (cn != null && cn.getPackageName().equals(packageName)) {
      try {
        tmpI.setComponent(cn);
        if (pm.queryIntentActivities(tmpI,PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
          tasksToRemove.add(p.second);
        }
      }
 catch (      Exception e) {
      }
    }
  }
synchronized (ActivityManagerService.this) {
    for (int i=tasksToRemove.size() - 1; i >= 0; i--) {
      removeTaskByIdLocked(tasksToRemove.get(i),0);
    }
  }
  return true;
}
Program: 199339
Project: 199339
Buggy source:
private void adjustFocusedActivityLocked(ActivityRecord r){
  if (mStackSupervisor.isFrontStack(this) && mService.mFocusedActivity == r) {
    ActivityRecord next=topRunningActivityLocked(null);
    if (next != r) {
      final TaskRecord task=r.task;
      if (r.frontOfTask && task == topTask() && task.mOnTopOfHome) {
        mStackSupervisor.moveHomeToTop();
      }
    }
    mService.setFocusedActivityLocked(mStackSupervisor.topRunningActivityLocked());
  }
}

Fixed version (ground truth):
private void adjustFocusedActivityLocked(ActivityRecord r){
  if (mStackSupervisor.isFrontStack(this) && mService.mFocusedActivity == r) {
    ActivityRecord next=topRunningActivityLocked(null);
    if (next != r) {
      final TaskRecord task=r.task;
      if (r.frontOfTask && task == topTask() && task.mOnTopOfHome) {
        mStackSupervisor.moveHomeToTop();
      }
    }
    ActivityRecord top=mStackSupervisor.topRunningActivityLocked();
    if (top != null) {
      mService.setFocusedActivityLocked(top);
    }
  }
}
Program: 199340
Project: 199340
Buggy source:
@Override public boolean onPackageChanged(String packageName,int uid,String[] components){
  final PackageManager pm=mContext.getPackageManager();
  final ArrayList<TaskRecord> recentTasks=new ArrayList<TaskRecord>();
  final ArrayList<TaskRecord> tasksToRemove=new ArrayList<TaskRecord>();
synchronized (ActivityManagerService.this) {
    recentTasks.addAll(mRecentTasks);
  }
  Intent tmpI=new Intent();
  for (int i=recentTasks.size() - 1; i >= 0; i--) {
    TaskRecord tr=recentTasks.get(i);
    ComponentName cn=tr.intent.getComponent();
    if (cn != null && cn.getPackageName().equals(packageName)) {
      try {
        tmpI.setComponent(cn);
        if (pm.queryIntentActivities(tmpI,PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
          tasksToRemove.add(tr);
        }
      }
 catch (      Exception e) {
      }
    }
  }
synchronized (ActivityManagerService.this) {
    for (int i=tasksToRemove.size() - 1; i >= 0; i--) {
      TaskRecord tr=tasksToRemove.get(i);
      removeTaskByIdLocked(tr.taskId,0);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onPackageChanged(String packageName,int uid,String[] components){
  final PackageManager pm=mContext.getPackageManager();
  final ArrayList<Pair<Intent,Integer>> recentTaskIntents=new ArrayList<Pair<Intent,Integer>>();
  final ArrayList<Integer> tasksToRemove=new ArrayList<Integer>();
synchronized (ActivityManagerService.this) {
    for (int i=mRecentTasks.size() - 1; i >= 0; i--) {
      TaskRecord tr=mRecentTasks.get(i);
      recentTaskIntents.add(new Pair<Intent,Integer>(tr.intent,tr.taskId));
    }
  }
  Intent tmpI=new Intent();
  for (int i=recentTaskIntents.size() - 1; i >= 0; i--) {
    Pair<Intent,Integer> p=recentTaskIntents.get(i);
    ComponentName cn=p.first.getComponent();
    if (cn != null && cn.getPackageName().equals(packageName)) {
      try {
        tmpI.setComponent(cn);
        if (pm.queryIntentActivities(tmpI,PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
          tasksToRemove.add(p.second);
        }
      }
 catch (      Exception e) {
      }
    }
  }
synchronized (ActivityManagerService.this) {
    for (int i=tasksToRemove.size() - 1; i >= 0; i--) {
      removeTaskByIdLocked(tasksToRemove.get(i),0);
    }
  }
  return true;
}
Program: 199341
Project: 199341
Buggy source:
private void adjustFocusedActivityLocked(ActivityRecord r){
  if (mStackSupervisor.isFrontStack(this) && mService.mFocusedActivity == r) {
    ActivityRecord next=topRunningActivityLocked(null);
    if (next != r) {
      final TaskRecord task=r.task;
      if (r.frontOfTask && task == topTask() && task.mOnTopOfHome) {
        mStackSupervisor.moveHomeToTop();
      }
    }
    mService.setFocusedActivityLocked(mStackSupervisor.topRunningActivityLocked());
  }
}

Fixed version (ground truth):
private void adjustFocusedActivityLocked(ActivityRecord r){
  if (mStackSupervisor.isFrontStack(this) && mService.mFocusedActivity == r) {
    ActivityRecord next=topRunningActivityLocked(null);
    if (next != r) {
      final TaskRecord task=r.task;
      if (r.frontOfTask && task == topTask() && task.mOnTopOfHome) {
        mStackSupervisor.moveHomeToTop();
      }
    }
    ActivityRecord top=mStackSupervisor.topRunningActivityLocked();
    if (top != null) {
      mService.setFocusedActivityLocked(top);
    }
  }
}
Program: 199343
Project: 199343
Buggy source:
@Override public boolean onPackageChanged(String packageName,int uid,String[] components){
  final PackageManager pm=mContext.getPackageManager();
  final ArrayList<TaskRecord> recentTasks=new ArrayList<TaskRecord>();
  final ArrayList<TaskRecord> tasksToRemove=new ArrayList<TaskRecord>();
synchronized (ActivityManagerService.this) {
    recentTasks.addAll(mRecentTasks);
  }
  Intent tmpI=new Intent();
  for (int i=recentTasks.size() - 1; i >= 0; i--) {
    TaskRecord tr=recentTasks.get(i);
    ComponentName cn=tr.intent.getComponent();
    if (cn != null && cn.getPackageName().equals(packageName)) {
      try {
        tmpI.setComponent(cn);
        if (pm.queryIntentActivities(tmpI,PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
          tasksToRemove.add(tr);
        }
      }
 catch (      Exception e) {
      }
    }
  }
synchronized (ActivityManagerService.this) {
    for (int i=tasksToRemove.size() - 1; i >= 0; i--) {
      TaskRecord tr=tasksToRemove.get(i);
      removeTaskByIdLocked(tr.taskId,0);
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onPackageChanged(String packageName,int uid,String[] components){
  final PackageManager pm=mContext.getPackageManager();
  final ArrayList<Pair<Intent,Integer>> recentTaskIntents=new ArrayList<Pair<Intent,Integer>>();
  final ArrayList<Integer> tasksToRemove=new ArrayList<Integer>();
synchronized (ActivityManagerService.this) {
    for (int i=mRecentTasks.size() - 1; i >= 0; i--) {
      TaskRecord tr=mRecentTasks.get(i);
      recentTaskIntents.add(new Pair<Intent,Integer>(tr.intent,tr.taskId));
    }
  }
  Intent tmpI=new Intent();
  for (int i=recentTaskIntents.size() - 1; i >= 0; i--) {
    Pair<Intent,Integer> p=recentTaskIntents.get(i);
    ComponentName cn=p.first.getComponent();
    if (cn != null && cn.getPackageName().equals(packageName)) {
      try {
        tmpI.setComponent(cn);
        if (pm.queryIntentActivities(tmpI,PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
          tasksToRemove.add(p.second);
        }
      }
 catch (      Exception e) {
      }
    }
  }
synchronized (ActivityManagerService.this) {
    for (int i=tasksToRemove.size() - 1; i >= 0; i--) {
      removeTaskByIdLocked(tasksToRemove.get(i),0);
    }
  }
  return true;
}
Program: 199344
Project: 199344
Buggy source:
private void adjustFocusedActivityLocked(ActivityRecord r){
  if (mStackSupervisor.isFrontStack(this) && mService.mFocusedActivity == r) {
    ActivityRecord next=topRunningActivityLocked(null);
    if (next != r) {
      final TaskRecord task=r.task;
      if (r.frontOfTask && task == topTask() && task.mOnTopOfHome) {
        mStackSupervisor.moveHomeToTop();
      }
    }
    mService.setFocusedActivityLocked(mStackSupervisor.topRunningActivityLocked());
  }
}

Fixed version (ground truth):
private void adjustFocusedActivityLocked(ActivityRecord r){
  if (mStackSupervisor.isFrontStack(this) && mService.mFocusedActivity == r) {
    ActivityRecord next=topRunningActivityLocked(null);
    if (next != r) {
      final TaskRecord task=r.task;
      if (r.frontOfTask && task == topTask() && task.mOnTopOfHome) {
        mStackSupervisor.moveHomeToTop();
      }
    }
    ActivityRecord top=mStackSupervisor.topRunningActivityLocked();
    if (top != null) {
      mService.setFocusedActivityLocked(top);
    }
  }
}
Program: 199346
Project: 199346
Buggy source:
private String calculateApkRoot(final String codePathString){
  final File codePath=new File(codePathString);
  final File codeRoot;
  if (FileUtils.contains(Environment.getRootDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getOemDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getVendorDirectory(),codePath)) {
    codeRoot=Environment.getVendorDirectory();
  }
 else {
    try {
      File f=codePath.getCanonicalFile();
      File parent=f.getParentFile();
      File tmp;
      while ((tmp=parent.getParentFile()) != null) {
        f=parent;
        parent=tmp;
      }
      codeRoot=f;
      Slog.w(TAG,"String_Node_Str" + codePath + "String_Node_Str"+ codeRoot);
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + codePath);
      return Environment.getRootDirectory().getPath();
    }
  }
  return codeRoot.getPath();
}

Fixed version (ground truth):
private String calculateApkRoot(final String codePathString){
  final File codePath=new File(codePathString);
  final File codeRoot;
  if (FileUtils.contains(Environment.getRootDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getOemDirectory(),codePath)) {
    codeRoot=Environment.getOemDirectory();
  }
 else   if (FileUtils.contains(Environment.getVendorDirectory(),codePath)) {
    codeRoot=Environment.getVendorDirectory();
  }
 else {
    try {
      File f=codePath.getCanonicalFile();
      File parent=f.getParentFile();
      File tmp;
      while ((tmp=parent.getParentFile()) != null) {
        f=parent;
        parent=tmp;
      }
      codeRoot=f;
      Slog.w(TAG,"String_Node_Str" + codePath + "String_Node_Str"+ codeRoot);
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + codePath);
      return Environment.getRootDirectory().getPath();
    }
  }
  return codeRoot.getPath();
}
Program: 199347
Project: 199347
Buggy source:
private String calculateApkRoot(final String codePathString){
  final File codePath=new File(codePathString);
  final File codeRoot;
  if (FileUtils.contains(Environment.getRootDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getOemDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getVendorDirectory(),codePath)) {
    codeRoot=Environment.getVendorDirectory();
  }
 else {
    try {
      File f=codePath.getCanonicalFile();
      File parent=f.getParentFile();
      File tmp;
      while ((tmp=parent.getParentFile()) != null) {
        f=parent;
        parent=tmp;
      }
      codeRoot=f;
      Slog.w(TAG,"String_Node_Str" + codePath + "String_Node_Str"+ codeRoot);
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + codePath);
      return Environment.getRootDirectory().getPath();
    }
  }
  return codeRoot.getPath();
}

Fixed version (ground truth):
private String calculateApkRoot(final String codePathString){
  final File codePath=new File(codePathString);
  final File codeRoot;
  if (FileUtils.contains(Environment.getRootDirectory(),codePath)) {
    codeRoot=Environment.getRootDirectory();
  }
 else   if (FileUtils.contains(Environment.getOemDirectory(),codePath)) {
    codeRoot=Environment.getOemDirectory();
  }
 else   if (FileUtils.contains(Environment.getVendorDirectory(),codePath)) {
    codeRoot=Environment.getVendorDirectory();
  }
 else {
    try {
      File f=codePath.getCanonicalFile();
      File parent=f.getParentFile();
      File tmp;
      while ((tmp=parent.getParentFile()) != null) {
        f=parent;
        parent=tmp;
      }
      codeRoot=f;
      Slog.w(TAG,"String_Node_Str" + codePath + "String_Node_Str"+ codeRoot);
    }
 catch (    IOException e) {
      Slog.w(TAG,"String_Node_Str" + codePath);
      return Environment.getRootDirectory().getPath();
    }
  }
  return codeRoot.getPath();
}
Program: 199353
Project: 199353
Buggy source:
@Override public List<ResolveInfo> getLauncherActivities(String packageName,UserHandle user) throws RemoteException {
  ensureInUserProfiles(user,"String_Node_Str" + user);
  final Intent mainIntent=new Intent(Intent.ACTION_MAIN,null);
  mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
  long ident=Binder.clearCallingIdentity();
  try {
    List<ResolveInfo> apps=mPm.queryIntentActivitiesAsUser(mainIntent,0,user.getIdentifier());
    return apps;
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}

Fixed version (ground truth):
@Override public List<ResolveInfo> getLauncherActivities(String packageName,UserHandle user) throws RemoteException {
  ensureInUserProfiles(user,"String_Node_Str" + user);
  final Intent mainIntent=new Intent(Intent.ACTION_MAIN,null);
  mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
  mainIntent.setPackage(packageName);
  long ident=Binder.clearCallingIdentity();
  try {
    List<ResolveInfo> apps=mPm.queryIntentActivitiesAsUser(mainIntent,0,user.getIdentifier());
    return apps;
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 199354
Project: 199354
Buggy source:
@Override public List<ResolveInfo> getLauncherActivities(String packageName,UserHandle user) throws RemoteException {
  ensureInUserProfiles(user,"String_Node_Str" + user);
  final Intent mainIntent=new Intent(Intent.ACTION_MAIN,null);
  mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
  long ident=Binder.clearCallingIdentity();
  try {
    List<ResolveInfo> apps=mPm.queryIntentActivitiesAsUser(mainIntent,0,user.getIdentifier());
    return apps;
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}

Fixed version (ground truth):
@Override public List<ResolveInfo> getLauncherActivities(String packageName,UserHandle user) throws RemoteException {
  ensureInUserProfiles(user,"String_Node_Str" + user);
  final Intent mainIntent=new Intent(Intent.ACTION_MAIN,null);
  mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
  mainIntent.setPackage(packageName);
  long ident=Binder.clearCallingIdentity();
  try {
    List<ResolveInfo> apps=mPm.queryIntentActivitiesAsUser(mainIntent,0,user.getIdentifier());
    return apps;
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 199355
Project: 199355
Buggy source:
@Override public List<ResolveInfo> getLauncherActivities(String packageName,UserHandle user) throws RemoteException {
  ensureInUserProfiles(user,"String_Node_Str" + user);
  final Intent mainIntent=new Intent(Intent.ACTION_MAIN,null);
  mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
  long ident=Binder.clearCallingIdentity();
  try {
    List<ResolveInfo> apps=mPm.queryIntentActivitiesAsUser(mainIntent,0,user.getIdentifier());
    return apps;
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}

Fixed version (ground truth):
@Override public List<ResolveInfo> getLauncherActivities(String packageName,UserHandle user) throws RemoteException {
  ensureInUserProfiles(user,"String_Node_Str" + user);
  final Intent mainIntent=new Intent(Intent.ACTION_MAIN,null);
  mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
  mainIntent.setPackage(packageName);
  long ident=Binder.clearCallingIdentity();
  try {
    List<ResolveInfo> apps=mPm.queryIntentActivitiesAsUser(mainIntent,0,user.getIdentifier());
    return apps;
  }
  finally {
    Binder.restoreCallingIdentity(ident);
  }
}
Program: 199357
Project: 199357
Buggy source:
private void updateMaxExpandHeight(){
  mSelfInitiatedLayout=true;
  ViewGroup.LayoutParams lp=getLayoutParams();
  int oldHeight=lp.height;
  lp.height=ViewGroup.LayoutParams.WRAP_CONTENT;
  setLayoutParams(lp);
  measure(View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(),View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec(mRowMaxHeight,View.MeasureSpec.AT_MOST));
  lp.height=oldHeight;
  setLayoutParams(lp);
  mMaxExpandHeight=getMeasuredHeight();
  mSelfInitiatedLayout=false;
}

Fixed version (ground truth):
private void updateMaxExpandHeight(){
  mSelfInitiatedLayout=true;
  ViewGroup.LayoutParams lp=getLayoutParams();
  int oldHeight=lp.height;
  lp.height=ViewGroup.LayoutParams.WRAP_CONTENT;
  setLayoutParams(lp);
  measure(View.MeasureSpec.makeMeasureSpec(getWidth(),View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec(mRowMaxHeight,View.MeasureSpec.AT_MOST));
  lp.height=oldHeight;
  setLayoutParams(lp);
  mMaxExpandHeight=getMeasuredHeight();
  mSelfInitiatedLayout=false;
}
Program: 199358
Project: 199358
Buggy source:
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=mFirstChildWhileExpanding.getHeight();
    }
 else {
      mFirstChildMaxHeight=getMaxAllowedChildHeight(mFirstChildWhileExpanding);
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}

Fixed version (ground truth):
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=mFirstChildWhileExpanding.getHeight();
    }
 else {
      if (mFirstChildWhileExpanding.getWidth() == 0) {
        mFirstChildWhileExpanding.addOnLayoutChangeListener(new View.OnLayoutChangeListener(){
          @Override public void onLayoutChange(          View v,          int left,          int top,          int right,          int bottom,          int oldLeft,          int oldTop,          int oldRight,          int oldBottom){
            mFirstChildMaxHeight=getMaxAllowedChildHeight(mFirstChildWhileExpanding);
            mFirstChildWhileExpanding.removeOnLayoutChangeListener(this);
          }
        }
);
      }
 else {
        mFirstChildMaxHeight=getMaxAllowedChildHeight(mFirstChildWhileExpanding);
      }
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}
Program: 199359
Project: 199359
Buggy source:
private void updateMaxExpandHeight(){
  mSelfInitiatedLayout=true;
  ViewGroup.LayoutParams lp=getLayoutParams();
  int oldHeight=lp.height;
  lp.height=ViewGroup.LayoutParams.WRAP_CONTENT;
  setLayoutParams(lp);
  measure(View.MeasureSpec.makeMeasureSpec(getMeasuredWidth(),View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec(mRowMaxHeight,View.MeasureSpec.AT_MOST));
  lp.height=oldHeight;
  setLayoutParams(lp);
  mMaxExpandHeight=getMeasuredHeight();
  mSelfInitiatedLayout=false;
}

Fixed version (ground truth):
private void updateMaxExpandHeight(){
  mSelfInitiatedLayout=true;
  ViewGroup.LayoutParams lp=getLayoutParams();
  int oldHeight=lp.height;
  lp.height=ViewGroup.LayoutParams.WRAP_CONTENT;
  setLayoutParams(lp);
  measure(View.MeasureSpec.makeMeasureSpec(getWidth(),View.MeasureSpec.EXACTLY),View.MeasureSpec.makeMeasureSpec(mRowMaxHeight,View.MeasureSpec.AT_MOST));
  lp.height=oldHeight;
  setLayoutParams(lp);
  mMaxExpandHeight=getMeasuredHeight();
  mSelfInitiatedLayout=false;
}
Program: 199360
Project: 199360
Buggy source:
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=mFirstChildWhileExpanding.getHeight();
    }
 else {
      mFirstChildMaxHeight=getMaxAllowedChildHeight(mFirstChildWhileExpanding);
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}

Fixed version (ground truth):
private void updateFirstChildHeightWhileExpanding(ViewGroup hostView){
  mFirstChildWhileExpanding=findFirstVisibleChild(hostView);
  if (mFirstChildWhileExpanding != null) {
    if (mExpandedOnStart) {
      mFirstChildMaxHeight=mFirstChildWhileExpanding.getHeight();
    }
 else {
      if (mFirstChildWhileExpanding.getWidth() == 0) {
        mFirstChildWhileExpanding.addOnLayoutChangeListener(new View.OnLayoutChangeListener(){
          @Override public void onLayoutChange(          View v,          int left,          int top,          int right,          int bottom,          int oldLeft,          int oldTop,          int oldRight,          int oldBottom){
            mFirstChildMaxHeight=getMaxAllowedChildHeight(mFirstChildWhileExpanding);
            mFirstChildWhileExpanding.removeOnLayoutChangeListener(this);
          }
        }
);
      }
 else {
        mFirstChildMaxHeight=getMaxAllowedChildHeight(mFirstChildWhileExpanding);
      }
    }
  }
 else {
    mFirstChildMaxHeight=0;
  }
}
Program: 199361
Project: 199361
Buggy source:
private int submitCaptureRequest(List<CaptureRequest> requestList,CaptureListener listener,Handler handler,boolean repeating) throws CameraAccessException {
  if (listener != null) {
    handler=checkHandler(handler);
  }
synchronized (mLock) {
    checkIfCameraClosed();
    int requestId;
    if (repeating) {
      stopRepeating();
    }
    LongParcelable lastFrameNumberRef=new LongParcelable();
    try {
      requestId=mRemoteDevice.submitRequestList(requestList,repeating,lastFrameNumberRef);
      if (DEBUG) {
        Log.v(TAG,"String_Node_Str" + lastFrameNumberRef.getNumber());
      }
    }
 catch (    CameraRuntimeException e) {
      throw e.asChecked();
    }
catch (    RemoteException e) {
      return -1;
    }
    if (listener != null) {
      mCaptureListenerMap.put(requestId,new CaptureListenerHolder(listener,requestList,handler,repeating));
    }
    long lastFrameNumber=lastFrameNumberRef.getNumber();
    if (repeating) {
      if (mRepeatingRequestId != REQUEST_ID_NONE) {
        checkEarlyTriggerSequenceComplete(mRepeatingRequestId,lastFrameNumber);
      }
      mRepeatingRequestId=requestId;
    }
 else {
      mFrameNumberRequestPairs.add(new SimpleEntry<Long,Integer>(lastFrameNumber,requestId));
    }
    if (mIdle) {
      mDeviceHandler.post(mCallOnActive);
    }
    mIdle=false;
    return requestId;
  }
}

Fixed version (ground truth):
private int submitCaptureRequest(List<CaptureRequest> requestList,CaptureListener listener,Handler handler,boolean repeating) throws CameraAccessException {
  if (listener != null) {
    handler=checkHandler(handler);
  }
synchronized (mLock) {
    checkIfCameraClosed();
    int requestId;
    if (repeating) {
      stopRepeating();
    }
    LongParcelable lastFrameNumberRef=new LongParcelable();
    try {
      requestId=mRemoteDevice.submitRequestList(requestList,repeating,lastFrameNumberRef);
      if (DEBUG) {
        Log.v(TAG,"String_Node_Str" + lastFrameNumberRef.getNumber());
      }
    }
 catch (    CameraRuntimeException e) {
      throw e.asChecked();
    }
catch (    RemoteException e) {
      return -1;
    }
    if (listener != null) {
      mCaptureListenerMap.put(requestId,new CaptureListenerHolder(listener,requestList,handler,repeating));
    }
 else {
      if (DEBUG) {
        Log.d(TAG,"String_Node_Str" + requestId + "String_Node_Str");
      }
    }
    long lastFrameNumber=lastFrameNumberRef.getNumber();
    if (repeating) {
      if (mRepeatingRequestId != REQUEST_ID_NONE) {
        checkEarlyTriggerSequenceComplete(mRepeatingRequestId,lastFrameNumber);
      }
      mRepeatingRequestId=requestId;
    }
 else {
      mFrameNumberRequestPairs.add(new SimpleEntry<Long,Integer>(lastFrameNumber,requestId));
    }
    if (mIdle) {
      mDeviceHandler.post(mCallOnActive);
    }
    mIdle=false;
    return requestId;
  }
}
Program: 199364
Project: 199364
Buggy source:
private int submitCaptureRequest(List<CaptureRequest> requestList,CaptureListener listener,Handler handler,boolean repeating) throws CameraAccessException {
  if (listener != null) {
    handler=checkHandler(handler);
  }
synchronized (mLock) {
    checkIfCameraClosed();
    int requestId;
    if (repeating) {
      stopRepeating();
    }
    LongParcelable lastFrameNumberRef=new LongParcelable();
    try {
      requestId=mRemoteDevice.submitRequestList(requestList,repeating,lastFrameNumberRef);
      if (DEBUG) {
        Log.v(TAG,"String_Node_Str" + lastFrameNumberRef.getNumber());
      }
    }
 catch (    CameraRuntimeException e) {
      throw e.asChecked();
    }
catch (    RemoteException e) {
      return -1;
    }
    if (listener != null) {
      mCaptureListenerMap.put(requestId,new CaptureListenerHolder(listener,requestList,handler,repeating));
    }
    long lastFrameNumber=lastFrameNumberRef.getNumber();
    if (repeating) {
      if (mRepeatingRequestId != REQUEST_ID_NONE) {
        checkEarlyTriggerSequenceComplete(mRepeatingRequestId,lastFrameNumber);
      }
      mRepeatingRequestId=requestId;
    }
 else {
      mFrameNumberRequestPairs.add(new SimpleEntry<Long,Integer>(lastFrameNumber,requestId));
    }
    if (mIdle) {
      mDeviceHandler.post(mCallOnActive);
    }
    mIdle=false;
    return requestId;
  }
}

Fixed version (ground truth):
private int submitCaptureRequest(List<CaptureRequest> requestList,CaptureListener listener,Handler handler,boolean repeating) throws CameraAccessException {
  if (listener != null) {
    handler=checkHandler(handler);
  }
synchronized (mLock) {
    checkIfCameraClosed();
    int requestId;
    if (repeating) {
      stopRepeating();
    }
    LongParcelable lastFrameNumberRef=new LongParcelable();
    try {
      requestId=mRemoteDevice.submitRequestList(requestList,repeating,lastFrameNumberRef);
      if (DEBUG) {
        Log.v(TAG,"String_Node_Str" + lastFrameNumberRef.getNumber());
      }
    }
 catch (    CameraRuntimeException e) {
      throw e.asChecked();
    }
catch (    RemoteException e) {
      return -1;
    }
    if (listener != null) {
      mCaptureListenerMap.put(requestId,new CaptureListenerHolder(listener,requestList,handler,repeating));
    }
 else {
      if (DEBUG) {
        Log.d(TAG,"String_Node_Str" + requestId + "String_Node_Str");
      }
    }
    long lastFrameNumber=lastFrameNumberRef.getNumber();
    if (repeating) {
      if (mRepeatingRequestId != REQUEST_ID_NONE) {
        checkEarlyTriggerSequenceComplete(mRepeatingRequestId,lastFrameNumber);
      }
      mRepeatingRequestId=requestId;
    }
 else {
      mFrameNumberRequestPairs.add(new SimpleEntry<Long,Integer>(lastFrameNumber,requestId));
    }
    if (mIdle) {
      mDeviceHandler.post(mCallOnActive);
    }
    mIdle=false;
    return requestId;
  }
}