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

Commit a4dfc2c5 authored by Zhentao Sun's avatar Zhentao Sun
Browse files

Make sure nativeInit is called on an object.

This bug is introduced by the attempt to fix b/14117917.
Worked around b/14469172. The implementation of nativeInit assumes that
it's called on a object instead of class.

Change-Id: I73241e62aa73ce98358ff37b772d1a26daf9e53c
parent 2feaa183
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -427,7 +427,7 @@ public class LocationManagerService extends ILocationManager.Stub {
        }

        // bind to fused provider if supported
        if (FlpHardwareProvider.isSupported()) {
        if (FlpHardwareProvider.getInstance(mContext).isSupported()) {
          FlpHardwareProvider flpHardwareProvider = FlpHardwareProvider.getInstance(mContext);
          FusedProxy fusedProxy = FusedProxy.createAndBind(
                  mContext,
+3 −4
Original line number Diff line number Diff line
@@ -67,9 +67,9 @@ public class FlpHardwareProvider {
    public static FlpHardwareProvider getInstance(Context context) {
        if (sSingletonInstance == null) {
            sSingletonInstance = new FlpHardwareProvider(context);
            sSingletonInstance.nativeInit();
        }

        nativeInit();
        return sSingletonInstance;
    }

@@ -96,8 +96,7 @@ public class FlpHardwareProvider {
                Looper.myLooper());
    }

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

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

    // FlpLocationInterface members
    private native void nativeInit();
    private native int nativeGetBatchSize();
    private native void nativeStartBatching(int requestId, FusedBatchOptions options);
    private native void nativeUpdateBatchingOptions(int requestId, FusedBatchOptions optionsObject);