Program: 193153
Project: 193153
Buggy source:
void resizeStackLocked(int stackId,Rect bounds,boolean preserveWindows,boolean allowResizeInDockedMode){
  final ActivityStack stack=getStack(stackId);
  if (stack == null) {
    Slog.w(TAG,"String_Node_Str" + stackId + "String_Node_Str");
    return;
  }
  if (!allowResizeInDockedMode && stackId != DOCKED_STACK_ID && getStack(DOCKED_STACK_ID) != null) {
    return;
  }
  Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER,"String_Node_Str" + stackId);
  mWindowManager.deferSurfaceLayout();
  try {
    ActivityRecord r=stack.topRunningActivityLocked();
    mTmpBounds.clear();
    mTmpConfigs.clear();
    ArrayList<TaskRecord> tasks=stack.getAllTasks();
    for (int i=tasks.size() - 1; i >= 0; i--) {
      TaskRecord task=tasks.get(i);
      if (task.mResizeable) {
        if (stack.mStackId == FREEFORM_WORKSPACE_STACK_ID) {
          tempRect2.set(task.mBounds);
          fitWithinBounds(tempRect2,bounds);
          task.updateOverrideConfiguration(tempRect2);
        }
 else {
          task.updateOverrideConfiguration(bounds);
        }
      }
      mTmpConfigs.put(task.taskId,task.mOverrideConfig);
      mTmpBounds.put(task.taskId,task.mBounds);
    }
    stack.mFullscreen=mWindowManager.resizeStack(stackId,bounds,mTmpConfigs,mTmpBounds);
    if (stack.mStackId == DOCKED_STACK_ID) {
      if (stack.mFullscreen) {
        for (int i=FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
          if (StackId.isResizeableByDockedStack(i) && getStack(i) != null) {
            resizeStackLocked(i,null,preserveWindows,true);
          }
        }
        final int count=tasks.size();
        for (int i=0; i < count; i++) {
          moveTaskToStackLocked(tasks.get(i).taskId,FULLSCREEN_WORKSPACE_STACK_ID,ON_TOP,FORCE_FOCUS,"String_Node_Str",false);
        }
        r=null;
      }
 else {
        mWindowManager.getStackDockedModeBounds(HOME_STACK_ID,tempRect);
        for (int i=FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
          if (StackId.isResizeableByDockedStack(i)) {
            ActivityStack otherStack=getStack(i);
            if (otherStack != null) {
              resizeStackLocked(i,tempRect,PRESERVE_WINDOWS,true);
            }
          }
        }
      }
      preserveWindows=true;
    }
    stack.setBounds(bounds);
    if (r != null) {
      final boolean updated=stack.ensureActivityConfigurationLocked(r,0,preserveWindows);
      ensureActivitiesVisibleLocked(r,0,preserveWindows);
      if (!updated) {
        resumeTopActivitiesLocked(stack,null,null);
      }
    }
  }
  finally {
    mWindowManager.continueSurfaceLayout();
    Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
  }
}

Fixed version (ground truth):
void resizeStackLocked(int stackId,Rect bounds,boolean preserveWindows,boolean allowResizeInDockedMode){
  final ActivityStack stack=getStack(stackId);
  if (stack == null) {
    Slog.w(TAG,"String_Node_Str" + stackId + "String_Node_Str");
    return;
  }
  if (!allowResizeInDockedMode && stackId != DOCKED_STACK_ID && getStack(DOCKED_STACK_ID) != null) {
    return;
  }
  Trace.traceBegin(TRACE_TAG_ACTIVITY_MANAGER,"String_Node_Str" + stackId);
  mWindowManager.deferSurfaceLayout();
  try {
    if (bounds != null && mWindowManager.isFullscreenBounds(stackId,bounds)) {
      bounds=null;
    }
    ActivityRecord r=stack.topRunningActivityLocked();
    mTmpBounds.clear();
    mTmpConfigs.clear();
    ArrayList<TaskRecord> tasks=stack.getAllTasks();
    for (int i=tasks.size() - 1; i >= 0; i--) {
      TaskRecord task=tasks.get(i);
      if (task.mResizeable) {
        if (stack.mStackId == FREEFORM_WORKSPACE_STACK_ID) {
          tempRect2.set(task.mBounds);
          fitWithinBounds(tempRect2,bounds);
          task.updateOverrideConfiguration(tempRect2);
        }
 else {
          task.updateOverrideConfiguration(bounds);
        }
      }
      mTmpConfigs.put(task.taskId,task.mOverrideConfig);
      mTmpBounds.put(task.taskId,task.mBounds);
    }
    stack.mFullscreen=mWindowManager.resizeStack(stackId,bounds,mTmpConfigs,mTmpBounds);
    if (stack.mStackId == DOCKED_STACK_ID) {
      if (stack.mFullscreen) {
        for (int i=FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
          if (StackId.isResizeableByDockedStack(i) && getStack(i) != null) {
            resizeStackLocked(i,null,preserveWindows,true);
          }
        }
        final int count=tasks.size();
        for (int i=0; i < count; i++) {
          moveTaskToStackLocked(tasks.get(i).taskId,FULLSCREEN_WORKSPACE_STACK_ID,ON_TOP,FORCE_FOCUS,"String_Node_Str",false);
        }
        r=null;
      }
 else {
        mWindowManager.getStackDockedModeBounds(HOME_STACK_ID,tempRect);
        for (int i=FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) {
          if (StackId.isResizeableByDockedStack(i)) {
            ActivityStack otherStack=getStack(i);
            if (otherStack != null) {
              resizeStackLocked(i,tempRect,PRESERVE_WINDOWS,true);
            }
          }
        }
      }
      preserveWindows=true;
    }
    stack.setBounds(bounds);
    if (r != null) {
      final boolean updated=stack.ensureActivityConfigurationLocked(r,0,preserveWindows);
      ensureActivitiesVisibleLocked(r,0,preserveWindows);
      if (!updated) {
        resumeTopActivitiesLocked(stack,null,null);
      }
    }
  }
  finally {
    mWindowManager.continueSurfaceLayout();
    Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);
  }
}