<commit_before>package com.baseflow.geolocator.location;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.baseflow.geolocator.errors.ErrorCallback;
import com.baseflow.geolocator.errors.ErrorCodes;
import com.baseflow.geolocator.errors.PermissionUndefinedException;
import com.baseflow.geolocator.permission.LocationPermission;
import com.baseflow.geolocator.permission.PermissionManager;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
;
import io.flutter.plugin.common.PluginRegistry.ActivityResultListener;
import java.util.ArrayList;
import java.util.List;

public class GeolocationManager implements ActivityResultListener {
  @NonNull private final PermissionManager permissionManager;
  private final List<LocationClient> locationClients;

  public GeolocationManager(@NonNull PermissionManager permissionManager) {
    this.permissionManager = permissionManager;
    this.locationClients = new ArrayList<>();
  }

  public void getLastKnownPosition(
      Context context,
      Activity activity,
      boolean forceLocationManager,
      PositionChangedCallback positionChangedCallback,
      ErrorCallback errorCallback) {

    handlePermissions(
        context,
        activity,
        () -> {
          LocationClient locationClient = createLocationClient(context, forceLocationManager, null);
          locationClient.getLastKnownPosition(positionChangedCallback, errorCallback);
        },
        errorCallback);
  }

  public void isLocationServiceEnabled(
      @Nullable Context context, LocationServiceListener listener) {<commit_msg>Fix issue with concurrent access to list<commit_after>package com.baseflow.geolocator.location;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.baseflow.geolocator.errors.ErrorCallback;
import com.baseflow.geolocator.errors.ErrorCodes;
import com.baseflow.geolocator.errors.PermissionUndefinedException;
import com.baseflow.geolocator.permission.LocationPermission;
import com.baseflow.geolocator.permission.PermissionManager;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;

import io.flutter.plugin.common.PluginRegistry.ActivityResultListener;
import java.util.ArrayList;
import java.util.List;

public class GeolocationManager implements ActivityResultListener {
  @NonNull private final PermissionManager permissionManager;
  private final List<LocationClient> locationClients;

  public GeolocationManager(@NonNull PermissionManager permissionManager) {
    this.permissionManager = permissionManager;
    this.locationClients = new CopyOnWriteArrayList<>();
  }

  public void getLastKnownPosition(
      Context context,
      Activity activity,
      boolean forceLocationManager,
      PositionChangedCallback positionChangedCallback,
      ErrorCallback errorCallback) {

    handlePermissions(
        context,
        activity,
        () -> {
          LocationClient locationClient = createLocationClient(context, forceLocationManager, null);
          locationClient.getLastKnownPosition(positionChangedCallback, errorCallback);
        },
        errorCallback);
  }

  public void isLocationServiceEnabled(
      @Nullable Context context, LocationServiceListener listener) {
{'fraction_non_alphanumeric': 0.0725373976855772, 'fraction_numerical': 0.0, 'mean_word_length': 5.1421143847487, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5221708', 'n_tokens_mistral': 882, 'n_tokens_neox': 872, 'n_words': 180}