@DSComment("Private Method")
  @DSBan(DSCat.PRIVATE_METHOD)
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2013-12-30 12:28:26.964 -0500",
      hash_original_method = "7C7E876780A603240D42A5BB96522037",
      hash_generated_method = "EAAD1702E472810FAA2CF3F810517246")
  private static String getTitle(Context context, Uri uri, boolean followSettingsUri) {
    Cursor cursor = null;
    ContentResolver res = context.getContentResolver();

    String title = null;

    if (uri != null) {
      String authority = uri.getAuthority();

      if (Settings.AUTHORITY.equals(authority)) {
        if (followSettingsUri) {
          Uri actualUri =
              RingtoneManager.getActualDefaultRingtoneUri(
                  context, RingtoneManager.getDefaultType(uri));
          String actualTitle = getTitle(context, actualUri, false);
          title =
              context.getString(
                  com.android.internal.R.string.ringtone_default_with_actual, actualTitle);
        }
      } else {

        if (DrmStore.AUTHORITY.equals(authority)) {
          cursor = res.query(uri, DRM_COLUMNS, null, null, null);
        } else if (MediaStore.AUTHORITY.equals(authority)) {
          cursor = res.query(uri, MEDIA_COLUMNS, null, null, null);
        }

        try {
          if (cursor != null && cursor.getCount() == 1) {
            cursor.moveToFirst();
            return cursor.getString(2);
          } else {
            title = uri.getLastPathSegment();
          }
        } finally {
          if (cursor != null) {
            cursor.close();
          }
        }
      }
    }

    if (title == null) {
      title = context.getString(com.android.internal.R.string.ringtone_unknown);

      if (title == null) {
        title = "";
      }
    }

    return title;
  }
  private static String getTitle(Context context, Uri uri, boolean followSettingsUri) {
    Cursor cursor = null;
    ContentResolver res = context.getContentResolver();

    String title = null;

    if (uri != null) {
      String authority = uri.getAuthority();

      if (Settings.AUTHORITY.equals(authority)) {
        if (followSettingsUri) {
          Uri actualUri;
          if (RingtoneManager.getDefaultType(uri) == RingtoneManager.TYPE_RINGTONE) {
            actualUri =
                RingtoneManager.getActualRingtoneUriBySubId(
                    context, RingtoneManager.getDefaultRingtoneSubIdByUri(uri));
          } else {
            actualUri =
                RingtoneManager.getActualDefaultRingtoneUri(
                    context, RingtoneManager.getDefaultType(uri));
          }
          if (actualUri == null) {
            title = context.getString(com.android.internal.R.string.ringtone_default);
            return title;
          }
          String actualTitle = getTitle(context, actualUri, false);
          title =
              context.getString(
                  com.android.internal.R.string.ringtone_default_with_actual, actualTitle);
        }
      } else {
        try {
          if (MediaStore.AUTHORITY.equals(authority)) {
            cursor = res.query(uri, MEDIA_COLUMNS, null, null, null);
          }
        } catch (SecurityException e) {
          // missing cursor is handled below
        }

        try {
          if (cursor != null && cursor.getCount() == 1) {
            cursor.moveToFirst();
            return cursor.getString(2);
          } else {
            title = uri.getLastPathSegment();
          }
        } finally {
          if (cursor != null) {
            cursor.close();
          }
        }
      }
    }

    if (title == null) {
      title = context.getString(com.android.internal.R.string.ringtone_unknown);

      if (title == null) {
        title = "";
      }
    }

    return title;
  }