@Override
  @TargetApi(11)
  public void onDone(SyncNowController.Result result) {
    if (isFinishing()) {
      // Ignore this callback if this Activity is already finishing or is already finished
      return;
    }

    dismissInProgressDialog();

    AlertDialog.Builder alertDialogBuilder = null;
    switch (result) {
      case TIME_ALREADY_CORRECT:
        alertDialogBuilder = new AlertDialog.Builder(this)
            .setTitle(R.string.timesync_sync_now_time_already_correct_dialog_title)
            .setMessage(R.string.timesync_sync_now_time_already_correct_dialog_details);
        break;
      case TIME_CORRECTED:
        alertDialogBuilder = new AlertDialog.Builder(this)
            .setTitle(R.string.timesync_sync_now_time_corrected_dialog_title)
            .setMessage(R.string.timesync_sync_now_time_corrected_dialog_details);
        break;
      case ERROR_CONNECTIVITY_ISSUE:
        alertDialogBuilder = new AlertDialog.Builder(this)
            .setTitle(R.string.timesync_sync_now_connectivity_error_dialog_title)
            .setMessage(R.string.timesync_sync_now_connectivity_error_dialog_details);
        break;
      case CANCELLED_BY_USER:
        finish();
        break;
      default:
        throw new IllegalArgumentException(String.valueOf(result));
    }

    if (alertDialogBuilder == null) { return; }

    alertDialogBuilder.setCancelable(false)
        .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            finish();
          }
        })
        .create()
        .show();
  }
Activity that adjusts the application's internal system time offset (for the purposes of
computing TOTP verification codes) by making a network request to Google and comparing Google's
time to the device's time.
java/com/google/android/apps/authenticator/timesync/SyncNowActivity.java