Program: 191656
Project: 191656
Buggy source:
void setTouchExcludeRegion(Task focusedTask){
  mTouchExcludeRegion.set(mBaseDisplayRect);
  final int delta=mService.dipToPixel(RESIZE_HANDLE_WIDTH_IN_DP,mDisplayMetrics);
  boolean addBackFocusedTask=false;
  mNonResizeableRegion.setEmpty();
  for (int stackNdx=mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
    TaskStack stack=mStacks.get(stackNdx);
    final ArrayList<Task> tasks=stack.getTasks();
    for (int taskNdx=tasks.size() - 1; taskNdx >= 0; --taskNdx) {
      final Task task=tasks.get(taskNdx);
      AppWindowToken token=task.getTopVisibleAppToken();
      if (token == null || !token.isVisible()) {
        continue;
      }
      if (task == focusedTask) {
        addBackFocusedTask=true;
        mTmpRect2.set(mTmpRect);
      }
      final boolean isFreeformed=task.inFreeformWorkspace();
      if (task != focusedTask || isFreeformed) {
        task.getDimBounds(mTmpRect);
        if (isFreeformed) {
          mTmpRect.inset(-delta,-delta);
          mTmpRect.intersect(mContentRect);
        }
        mTouchExcludeRegion.op(mTmpRect,Region.Op.DIFFERENCE);
      }
      if (task.isTwoFingerScrollMode()) {
        stack.getBounds(mTmpRect);
        mNonResizeableRegion.op(mTmpRect,Region.Op.UNION);
        break;
      }
    }
  }
  if (addBackFocusedTask) {
    mTouchExcludeRegion.op(mTmpRect2,Region.Op.UNION);
  }
  final WindowState inputMethod=mService.mInputMethodWindow;
  if (inputMethod != null && inputMethod.isVisibleLw()) {
    inputMethod.getTouchableRegion(mTmpRegion);
    mTouchExcludeRegion.op(mTmpRegion,Region.Op.UNION);
  }
  for (int i=mTapExcludedWindows.size() - 1; i >= 0; i--) {
    WindowState win=mTapExcludedWindows.get(i);
    win.getTouchableRegion(mTmpRegion);
    mTouchExcludeRegion.op(mTmpRegion,Region.Op.UNION);
  }
  if (getDockedStackVisibleForUserLocked() != null) {
    mDividerControllerLocked.getTouchRegion(mTmpRect);
    mTmpRegion.set(mTmpRect);
    mTouchExcludeRegion.op(mTmpRegion,Op.UNION);
  }
  if (mTapDetector != null) {
    mTapDetector.setTouchExcludeRegion(mTouchExcludeRegion,mNonResizeableRegion);
  }
}

Fixed version (ground truth):
void setTouchExcludeRegion(Task focusedTask){
  mTouchExcludeRegion.set(mBaseDisplayRect);
  final int delta=mService.dipToPixel(RESIZE_HANDLE_WIDTH_IN_DP,mDisplayMetrics);
  boolean addBackFocusedTask=false;
  mNonResizeableRegion.setEmpty();
  for (int stackNdx=mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
    TaskStack stack=mStacks.get(stackNdx);
    final ArrayList<Task> tasks=stack.getTasks();
    for (int taskNdx=tasks.size() - 1; taskNdx >= 0; --taskNdx) {
      final Task task=tasks.get(taskNdx);
      AppWindowToken token=task.getTopVisibleAppToken();
      if (token == null || !token.isVisible()) {
        continue;
      }
      task.getDimBounds(mTmpRect);
      if (task == focusedTask) {
        addBackFocusedTask=true;
        mTmpRect2.set(mTmpRect);
      }
      final boolean isFreeformed=task.inFreeformWorkspace();
      if (task != focusedTask || isFreeformed) {
        if (isFreeformed) {
          mTmpRect.inset(-delta,-delta);
          mTmpRect.intersect(mContentRect);
        }
        mTouchExcludeRegion.op(mTmpRect,Region.Op.DIFFERENCE);
      }
      if (task.isTwoFingerScrollMode()) {
        stack.getBounds(mTmpRect);
        mNonResizeableRegion.op(mTmpRect,Region.Op.UNION);
        break;
      }
    }
  }
  if (addBackFocusedTask) {
    mTouchExcludeRegion.op(mTmpRect2,Region.Op.UNION);
  }
  final WindowState inputMethod=mService.mInputMethodWindow;
  if (inputMethod != null && inputMethod.isVisibleLw()) {
    inputMethod.getTouchableRegion(mTmpRegion);
    mTouchExcludeRegion.op(mTmpRegion,Region.Op.UNION);
  }
  for (int i=mTapExcludedWindows.size() - 1; i >= 0; i--) {
    WindowState win=mTapExcludedWindows.get(i);
    win.getTouchableRegion(mTmpRegion);
    mTouchExcludeRegion.op(mTmpRegion,Region.Op.UNION);
  }
  if (getDockedStackVisibleForUserLocked() != null) {
    mDividerControllerLocked.getTouchRegion(mTmpRect);
    mTmpRegion.set(mTmpRect);
    mTouchExcludeRegion.op(mTmpRegion,Op.UNION);
  }
  if (mTapDetector != null) {
    mTapDetector.setTouchExcludeRegion(mTouchExcludeRegion,mNonResizeableRegion);
  }
}