Program: 191929
Project: 191929
Buggy source:
final void handleResumeActivity(IBinder token,boolean clearHide,boolean isForward,boolean reallyResume,int seq,String reason){
  ActivityClientRecord r=mActivities.get(token);
  if (!checkAndUpdateLifecycleSeq(seq,r,"String_Node_Str")) {
    return;
  }
  unscheduleGcIdler();
  mSomeActivitiesChanged=true;
  r=performResumeActivity(token,clearHide,reason);
  if (r != null) {
    final Activity a=r.activity;
    if (localLOGV)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ a.mStartedActivity+ "String_Node_Str"+ r.hideForNow+ "String_Node_Str"+ a.mFinished);
    final int forwardBit=isForward ? WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION : 0;
    boolean willBeVisible=!a.mStartedActivity;
    if (!willBeVisible) {
      try {
        willBeVisible=ActivityManagerNative.getDefault().willActivityBeVisible(a.getActivityToken());
      }
 catch (      RemoteException e) {
        throw e.rethrowFromSystemServer();
      }
    }
    if (r.window == null && !a.mFinished && willBeVisible) {
      r.window=r.activity.getWindow();
      View decor=r.window.getDecorView();
      decor.setVisibility(View.INVISIBLE);
      ViewManager wm=a.getWindowManager();
      WindowManager.LayoutParams l=r.window.getAttributes();
      a.mDecor=decor;
      l.type=WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
      l.softInputMode|=forwardBit;
      if (r.mPreserveWindow) {
        a.mWindowAdded=true;
        r.mPreserveWindow=false;
      }
      if (a.mVisibleFromClient && !a.mWindowAdded) {
        a.mWindowAdded=true;
        wm.addView(decor,l);
      }
    }
 else     if (!willBeVisible) {
      if (localLOGV)       Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
      r.hideForNow=true;
    }
    cleanUpPendingRemoveWindows(r,false);
    if (!r.activity.mFinished && willBeVisible && r.activity.mDecor != null && !r.hideForNow) {
      if (r.newConfig != null) {
        performConfigurationChangedForActivity(r,r.newConfig,REPORT_TO_ACTIVITY);
        if (DEBUG_CONFIGURATION)         Slog.v(TAG,"String_Node_Str" + r.activityInfo.name + "String_Node_Str"+ r.activity.mCurrentConfig);
        r.newConfig=null;
      }
      if (localLOGV)       Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ isForward);
      WindowManager.LayoutParams l=r.window.getAttributes();
      if ((l.softInputMode & WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != forwardBit) {
        l.softInputMode=(l.softInputMode & (~WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION)) | forwardBit;
        if (r.activity.mVisibleFromClient) {
          ViewManager wm=a.getWindowManager();
          View decor=r.window.getDecorView();
          wm.updateViewLayout(decor,l);
        }
      }
      r.activity.mVisibleFromServer=true;
      mNumVisibleActivities++;
      if (r.activity.mVisibleFromClient) {
        r.activity.makeVisible();
      }
    }
    if (!r.onlyLocalRequest) {
      r.nextIdle=mNewActivities;
      mNewActivities=r;
      if (localLOGV)       Slog.v(TAG,"String_Node_Str" + r);
      Looper.myQueue().addIdleHandler(new Idler());
    }
    r.onlyLocalRequest=false;
    if (reallyResume) {
      try {
        ActivityManagerNative.getDefault().activityResumed(token);
      }
 catch (      RemoteException ex) {
        throw ex.rethrowFromSystemServer();
      }
    }
  }
 else {
    try {
      ActivityManagerNative.getDefault().finishActivity(token,Activity.RESULT_CANCELED,null,Activity.DONT_FINISH_TASK_WITH_ACTIVITY);
    }
 catch (    RemoteException ex) {
      throw ex.rethrowFromSystemServer();
    }
  }
}

Fixed version (ground truth):
final void handleResumeActivity(IBinder token,boolean clearHide,boolean isForward,boolean reallyResume,int seq,String reason){
  ActivityClientRecord r=mActivities.get(token);
  if (!checkAndUpdateLifecycleSeq(seq,r,"String_Node_Str")) {
    return;
  }
  unscheduleGcIdler();
  mSomeActivitiesChanged=true;
  r=performResumeActivity(token,clearHide,reason);
  if (r != null) {
    final Activity a=r.activity;
    if (localLOGV)     Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ a.mStartedActivity+ "String_Node_Str"+ r.hideForNow+ "String_Node_Str"+ a.mFinished);
    final int forwardBit=isForward ? WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION : 0;
    boolean willBeVisible=!a.mStartedActivity;
    if (!willBeVisible) {
      try {
        willBeVisible=ActivityManagerNative.getDefault().willActivityBeVisible(a.getActivityToken());
      }
 catch (      RemoteException e) {
        throw e.rethrowFromSystemServer();
      }
    }
    if (r.window == null && !a.mFinished && willBeVisible) {
      r.window=r.activity.getWindow();
      View decor=r.window.getDecorView();
      decor.setVisibility(View.INVISIBLE);
      ViewManager wm=a.getWindowManager();
      WindowManager.LayoutParams l=r.window.getAttributes();
      a.mDecor=decor;
      l.type=WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
      l.softInputMode|=forwardBit;
      if (r.mPreserveWindow) {
        a.mWindowAdded=true;
        r.mPreserveWindow=false;
        ViewRootImpl impl=decor.getViewRootImpl();
        impl.notifyChildRebuilt();
      }
      if (a.mVisibleFromClient && !a.mWindowAdded) {
        a.mWindowAdded=true;
        wm.addView(decor,l);
      }
    }
 else     if (!willBeVisible) {
      if (localLOGV)       Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str");
      r.hideForNow=true;
    }
    cleanUpPendingRemoveWindows(r,false);
    if (!r.activity.mFinished && willBeVisible && r.activity.mDecor != null && !r.hideForNow) {
      if (r.newConfig != null) {
        performConfigurationChangedForActivity(r,r.newConfig,REPORT_TO_ACTIVITY);
        if (DEBUG_CONFIGURATION)         Slog.v(TAG,"String_Node_Str" + r.activityInfo.name + "String_Node_Str"+ r.activity.mCurrentConfig);
        r.newConfig=null;
      }
      if (localLOGV)       Slog.v(TAG,"String_Node_Str" + r + "String_Node_Str"+ isForward);
      WindowManager.LayoutParams l=r.window.getAttributes();
      if ((l.softInputMode & WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != forwardBit) {
        l.softInputMode=(l.softInputMode & (~WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION)) | forwardBit;
        if (r.activity.mVisibleFromClient) {
          ViewManager wm=a.getWindowManager();
          View decor=r.window.getDecorView();
          wm.updateViewLayout(decor,l);
        }
      }
      r.activity.mVisibleFromServer=true;
      mNumVisibleActivities++;
      if (r.activity.mVisibleFromClient) {
        r.activity.makeVisible();
      }
    }
    if (!r.onlyLocalRequest) {
      r.nextIdle=mNewActivities;
      mNewActivities=r;
      if (localLOGV)       Slog.v(TAG,"String_Node_Str" + r);
      Looper.myQueue().addIdleHandler(new Idler());
    }
    r.onlyLocalRequest=false;
    if (reallyResume) {
      try {
        ActivityManagerNative.getDefault().activityResumed(token);
      }
 catch (      RemoteException ex) {
        throw ex.rethrowFromSystemServer();
      }
    }
  }
 else {
    try {
      ActivityManagerNative.getDefault().finishActivity(token,Activity.RESULT_CANCELED,null,Activity.DONT_FINISH_TASK_WITH_ACTIVITY);
    }
 catch (    RemoteException ex) {
      throw ex.rethrowFromSystemServer();
    }
  }
}