Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cfbdcd25 authored by destradaa's avatar destradaa
Browse files

Make sure the FlpHardwareProvider is only advertised to GmsCore if the platform supports it.

b/14117917

Change-Id: Id6c2444893bcf192049e3233d1296eac16fcf826
parent 08d4a0ab
Loading
Loading
Loading
Loading
+27 −23
Original line number Original line Diff line number Diff line
@@ -426,7 +426,8 @@ public class LocationManagerService extends ILocationManager.Stub {
            Slog.e(TAG,  "no geocoder provider found");
            Slog.e(TAG,  "no geocoder provider found");
        }
        }


        // bind to fused provider
        // bind to fused provider if supported
        if (FlpHardwareProvider.isSupported()) {
          FlpHardwareProvider flpHardwareProvider = FlpHardwareProvider.getInstance(mContext);
          FlpHardwareProvider flpHardwareProvider = FlpHardwareProvider.getInstance(mContext);
          FusedProxy fusedProxy = FusedProxy.createAndBind(
          FusedProxy fusedProxy = FusedProxy.createAndBind(
                  mContext,
                  mContext,
@@ -436,7 +437,7 @@ public class LocationManagerService extends ILocationManager.Stub {
                  com.android.internal.R.string.config_fusedLocationProviderPackageName,
                  com.android.internal.R.string.config_fusedLocationProviderPackageName,
                  com.android.internal.R.array.config_locationProviderPackageNames);
                  com.android.internal.R.array.config_locationProviderPackageNames);
          if(fusedProxy == null) {
          if(fusedProxy == null) {
            Slog.e(TAG, "No FusedProvider found.");
              Slog.e(TAG, "Unable to bind FusedProxy.");
          }
          }


          // bind to geofence provider
          // bind to geofence provider
@@ -448,7 +449,10 @@ public class LocationManagerService extends ILocationManager.Stub {
                  gpsProvider.getGpsGeofenceProxy(),
                  gpsProvider.getGpsGeofenceProxy(),
                  flpHardwareProvider.getGeofenceHardware());
                  flpHardwareProvider.getGeofenceHardware());
          if (provider == null) {
          if (provider == null) {
            Slog.e(TAG,  "no geofence provider found");
              Slog.e(TAG,  "Unable to bind FLP Geofence proxy.");
          }
        } else {
          Slog.e(TAG, "FLP HAL not supported.");
        }
        }


        String[] testProviderStrings = resources.getStringArray(
        String[] testProviderStrings = resources.getStringArray(
+3 −3
Original line number Original line Diff line number Diff line
@@ -69,6 +69,7 @@ public class FlpHardwareProvider {
            sSingletonInstance = new FlpHardwareProvider(context);
            sSingletonInstance = new FlpHardwareProvider(context);
        }
        }


        nativeInit();
        return sSingletonInstance;
        return sSingletonInstance;
    }
    }


@@ -96,6 +97,7 @@ public class FlpHardwareProvider {
    }
    }


    public static boolean isSupported() {
    public static boolean isSupported() {
        nativeInit();
        return nativeIsSupported();
        return nativeIsSupported();
    }
    }


@@ -216,9 +218,9 @@ public class FlpHardwareProvider {
    // Core members
    // Core members
    private static native void nativeClassInit();
    private static native void nativeClassInit();
    private static native boolean nativeIsSupported();
    private static native boolean nativeIsSupported();
    private static native void nativeInit();


    // FlpLocationInterface members
    // FlpLocationInterface members
    private native void nativeInit();
    private native int nativeGetBatchSize();
    private native int nativeGetBatchSize();
    private native void nativeStartBatching(int requestId, FusedBatchOptions options);
    private native void nativeStartBatching(int requestId, FusedBatchOptions options);
    private native void nativeUpdateBatchingOptions(int requestId, FusedBatchOptions optionsObject);
    private native void nativeUpdateBatchingOptions(int requestId, FusedBatchOptions optionsObject);
@@ -258,12 +260,10 @@ public class FlpHardwareProvider {
    public static final String GEOFENCING = "Geofencing";
    public static final String GEOFENCING = "Geofencing";


    public IFusedLocationHardware getLocationHardware() {
    public IFusedLocationHardware getLocationHardware() {
        nativeInit();
        return mLocationHardware;
        return mLocationHardware;
    }
    }


    public IFusedGeofenceHardware getGeofenceHardware() {
    public IFusedGeofenceHardware getGeofenceHardware() {
        nativeInit();
        return mGeofenceHardwareService;
        return mGeofenceHardwareService;
    }
    }