Program: 2697
Project: 2697
Buggy source:
private void resolveRules(int layoutDirection){
  final boolean isLayoutRtl=(layoutDirection == View.LAYOUT_DIRECTION_RTL);
  System.arraycopy(mInitialRules,LEFT_OF,mRules,LEFT_OF,VERB_COUNT);
  if (mRules[ALIGN_START] != 0) {
    mRules[isLayoutRtl ? ALIGN_RIGHT : ALIGN_LEFT]=mRules[ALIGN_START];
  }
  if (mRules[ALIGN_END] != 0) {
    mRules[isLayoutRtl ? ALIGN_LEFT : ALIGN_RIGHT]=mRules[ALIGN_END];
  }
  if (mRules[START_OF] != 0) {
    mRules[isLayoutRtl ? RIGHT_OF : LEFT_OF]=mRules[START_OF];
  }
  if (mRules[END_OF] != 0) {
    mRules[isLayoutRtl ? LEFT_OF : RIGHT_OF]=mRules[END_OF];
  }
  if (mRules[ALIGN_PARENT_START] != 0) {
    mRules[isLayoutRtl ? ALIGN_PARENT_RIGHT : ALIGN_PARENT_LEFT]=mRules[ALIGN_PARENT_START];
  }
  if (mRules[ALIGN_PARENT_END] != 0) {
    mRules[isLayoutRtl ? ALIGN_PARENT_LEFT : ALIGN_PARENT_RIGHT]=mRules[ALIGN_PARENT_END];
  }
  mRulesChanged=false;
}

Fixed version (ground truth):
private void resolveRules(int layoutDirection){
  final boolean isLayoutRtl=(layoutDirection == View.LAYOUT_DIRECTION_RTL);
  System.arraycopy(mInitialRules,LEFT_OF,mRules,LEFT_OF,VERB_COUNT);
  if (mIsRtlCompatibilityMode) {
    if (mRules[ALIGN_START] != 0) {
      if (mRules[ALIGN_LEFT] == 0) {
        mRules[ALIGN_LEFT]=mRules[ALIGN_START];
      }
      mRules[ALIGN_START]=0;
    }
    if (mRules[ALIGN_END] != 0) {
      if (mRules[ALIGN_RIGHT] == 0) {
        mRules[ALIGN_RIGHT]=mRules[ALIGN_END];
      }
      mRules[ALIGN_END]=0;
    }
    if (mRules[START_OF] != 0) {
      if (mRules[LEFT_OF] == 0) {
        mRules[LEFT_OF]=mRules[START_OF];
      }
      mRules[START_OF]=0;
    }
    if (mRules[END_OF] != 0) {
      if (mRules[RIGHT_OF] == 0) {
        mRules[RIGHT_OF]=mRules[END_OF];
      }
      mRules[END_OF]=0;
    }
    if (mRules[ALIGN_PARENT_START] != 0) {
      if (mRules[ALIGN_PARENT_LEFT] == 0) {
        mRules[ALIGN_PARENT_LEFT]=mRules[ALIGN_PARENT_START];
      }
      mRules[ALIGN_PARENT_START]=0;
    }
    if (mRules[ALIGN_PARENT_RIGHT] == 0) {
      if (mRules[ALIGN_PARENT_RIGHT] == 0) {
        mRules[ALIGN_PARENT_RIGHT]=mRules[ALIGN_PARENT_END];
      }
      mRules[ALIGN_PARENT_END]=0;
    }
  }
 else {
    if ((mRules[ALIGN_START] != 0 || mRules[ALIGN_END] != 0) && (mRules[ALIGN_LEFT] != 0 || mRules[ALIGN_RIGHT] != 0)) {
      mRules[ALIGN_LEFT]=0;
      mRules[ALIGN_RIGHT]=0;
    }
    if (mRules[ALIGN_START] != 0) {
      mRules[isLayoutRtl ? ALIGN_RIGHT : ALIGN_LEFT]=mRules[ALIGN_START];
      mRules[ALIGN_START]=0;
    }
    if (mRules[ALIGN_END] != 0) {
      mRules[isLayoutRtl ? ALIGN_LEFT : ALIGN_RIGHT]=mRules[ALIGN_END];
      mRules[ALIGN_END]=0;
    }
    if ((mRules[START_OF] != 0 || mRules[END_OF] != 0) && (mRules[LEFT_OF] != 0 || mRules[RIGHT_OF] != 0)) {
      mRules[LEFT_OF]=0;
      mRules[RIGHT_OF]=0;
    }
    if (mRules[START_OF] != 0) {
      mRules[isLayoutRtl ? RIGHT_OF : LEFT_OF]=mRules[START_OF];
      mRules[START_OF]=0;
    }
    if (mRules[END_OF] != 0) {
      mRules[isLayoutRtl ? LEFT_OF : RIGHT_OF]=mRules[END_OF];
      mRules[END_OF]=0;
    }
    if ((mRules[ALIGN_PARENT_START] != 0 || mRules[ALIGN_PARENT_END] != 0) && (mRules[ALIGN_PARENT_LEFT] != 0 || mRules[ALIGN_PARENT_RIGHT] != 0)) {
      mRules[ALIGN_PARENT_LEFT]=0;
      mRules[ALIGN_PARENT_RIGHT]=0;
    }
    if (mRules[ALIGN_PARENT_START] != 0) {
      mRules[isLayoutRtl ? ALIGN_PARENT_RIGHT : ALIGN_PARENT_LEFT]=mRules[ALIGN_PARENT_START];
      mRules[ALIGN_PARENT_START]=0;
    }
    if (mRules[ALIGN_PARENT_END] != 0) {
      mRules[isLayoutRtl ? ALIGN_PARENT_LEFT : ALIGN_PARENT_RIGHT]=mRules[ALIGN_PARENT_END];
      mRules[ALIGN_PARENT_END]=0;
    }
  }
  mRulesChanged=false;
}