public void swapId(AccountIndex firstIndex, AccountIndex secondIndex)
      throws AccountDbIdUpdateFailureException{
    mDatabase.beginTransaction();
    try {
      int firstId = getId(firstIndex);
      int secondId = getId(secondIndex);

      // Update the id of the second index to avoid the unique key constraint
      ContentValues valuesForTemporalId = new ContentValues();
      valuesForTemporalId.put(ID_COLUMN, INVALID_ID);
      mDatabase
          .updateWithOnConflict(TABLE_NAME, valuesForTemporalId, whereClause(secondIndex), null,
              SQLiteDatabase.CONFLICT_ROLLBACK);

      ContentValues valuesForSecondId = new ContentValues();
      valuesForSecondId.put(ID_COLUMN, secondId);
      mDatabase.updateWithOnConflict(TABLE_NAME, valuesForSecondId, whereClause(firstIndex), null,
          SQLiteDatabase.CONFLICT_ROLLBACK);

      ContentValues valuesForFirstId = new ContentValues();
      valuesForFirstId.put(ID_COLUMN, firstId);
      mDatabase.updateWithOnConflict(TABLE_NAME, valuesForFirstId, whereClause(secondIndex), null,
          SQLiteDatabase.CONFLICT_ROLLBACK);
      mDatabase.setTransactionSuccessful();
    } catch (SQLiteException e) {
      throw new AccountDbIdUpdateFailureException(
          String.format("Updating the Id failed for %s and %s", firstIndex, secondIndex), e);
    } finally {
      mDatabase.endTransaction();
    }
  }
Swaps the value of the {@link #ID_COLUMN} associated with the passed two AccountIndexes.

@param firstIndex the {@link AccountIndex} to be swapped
@param secondIndex the {@link AccountIndex} to be swapped
java/com/google/android/apps/authenticator/otp/AccountDb.java