private static void removeGuestProfile(Context context) {
    boolean success = false;
    try {
      File guestDir = getGuestDir(context);
      if (guestDir.exists()) {
        success = delete(guestDir);
      }
    } catch (Exception ex) {
      Log.e(LOGTAG, "Error removing guest profile", ex);
    }

    if (success) {
      // Clear all shared prefs for the guest profile.
      GeckoSharedPrefs.forProfileName(context, GUEST_PROFILE).edit().clear().commit();
    }
  }
  public static boolean removeProfile(Context context, String profileName) {
    if (profileName == null) {
      Log.w(LOGTAG, "Unable to remove profile: null profile name.");
      return false;
    }

    final GeckoProfile profile = get(context, profileName);
    if (profile == null) {
      return false;
    }
    final boolean success = profile.remove();

    if (success) {
      // Clear all shared prefs for the given profile.
      GeckoSharedPrefs.forProfileName(context, profileName).edit().clear().commit();
    }

    return success;
  }
  @WorkerThread
  private void uploadCorePing(
      @NonNull final String docId,
      final int seq,
      @NonNull final String profileName,
      @NonNull final String profilePath,
      @Nullable final String defaultSearchEngine) {
    final GeckoProfile profile = GeckoProfile.get(this, profileName, profilePath);
    final String clientId;
    try {
      clientId = profile.getClientId();
    } catch (final IOException e) {
      Log.w(LOGTAG, "Unable to get client ID to generate core ping: returning.", e);
      return;
    }

    // Each profile can have different telemetry data so we intentionally grab the shared prefs for
    // the profile.
    final SharedPreferences sharedPrefs = GeckoSharedPrefs.forProfileName(this, profileName);
    // TODO (bug 1241685): Sync this preference with the gecko preference.
    final String serverURLSchemeHostPort =
        sharedPrefs.getString(
            TelemetryConstants.PREF_SERVER_URL, TelemetryConstants.DEFAULT_SERVER_URL);

    final long profileCreationDate = getProfileCreationDate(profile);
    final TelemetryCorePingBuilder builder =
        new TelemetryCorePingBuilder(this, serverURLSchemeHostPort)
            .setClientID(clientId)
            .setDefaultSearchEngine(
                TextUtils.isEmpty(defaultSearchEngine) ? null : defaultSearchEngine)
            .setProfileCreationDate(profileCreationDate < 0 ? null : profileCreationDate)
            .setSequenceNumber(seq);

    final String distributionId =
        sharedPrefs.getString(DistributionStoreCallback.PREF_DISTRIBUTION_ID, null);
    if (distributionId != null) {
      builder.setOptDistributionID(distributionId);
    }

    final TelemetryPing corePing = builder.build();
    final CorePingResultDelegate resultDelegate = new CorePingResultDelegate();
    uploadPing(corePing, resultDelegate);
  }