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

Commit e5d3889e authored by Yu-Han Yang's avatar Yu-Han Yang Committed by android-build-merger
Browse files

Merge "Move HIDL calls away from the main thread" into pi-dev am: 322929af

am: 4f937db5

Change-Id: I3705bd024787505b854aae9278275af54b8791c7
parents 933779a4 4f937db5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2437,6 +2437,8 @@ public class GnssLocationProvider implements LocationProviderInterface, InjectNt
         * this handler.
         */
        private void handleInitialize() {
            native_init_once();

            /*
             * A cycle of native_init() and native_cleanup() is needed so that callbacks are
             * registered after bootup even when location is disabled.
@@ -2791,6 +2793,8 @@ public class GnssLocationProvider implements LocationProviderInterface, InjectNt

    private static native boolean native_is_gnss_configuration_supported();

    private static native void native_init_once();

    private native boolean native_init();

    private native void native_cleanup();
+12 −9
Original line number Diff line number Diff line
@@ -1125,6 +1125,16 @@ Return<void> GnssBatchingCallback::gnssLocationBatchCb(
}

static void android_location_GnssLocationProvider_class_init_native(JNIEnv* env, jclass clazz) {
    gnssHal_V1_1 = IGnss_V1_1::getService();
    if (gnssHal_V1_1 == nullptr) {
        ALOGD("gnssHal 1.1 was null, trying 1.0");
        gnssHal = IGnss_V1_0::getService();
    } else {
        gnssHal = gnssHal_V1_1;
    }
}

static void android_location_GnssLocationProvider_init_once(JNIEnv* env, jclass clazz) {
    method_reportLocation = env->GetMethodID(clazz, "reportLocation",
            "(ZLandroid/location/Location;)V");
    method_reportStatus = env->GetMethodID(clazz, "reportStatus", "(I)V");
@@ -1175,15 +1185,6 @@ static void android_location_GnssLocationProvider_class_init_native(JNIEnv* env,
        LOG_ALWAYS_FATAL("Unable to get Java VM. Error: %d", jvmStatus);
    }

    // TODO(b/31632518)
    gnssHal_V1_1 = IGnss_V1_1::getService();
    if (gnssHal_V1_1 == nullptr) {
        ALOGD("gnssHal 1.1 was null, trying 1.0");
        gnssHal = IGnss_V1_0::getService();
    } else {
        gnssHal = gnssHal_V1_1;
    }

    if (gnssHal != nullptr) {
      gnssHalDeathRecipient = new GnssDeathRecipient();
      hardware::Return<bool> linked = gnssHal->linkToDeath(
@@ -2068,6 +2069,8 @@ static const JNINativeMethod sMethods[] = {
    {"native_is_gnss_configuration_supported", "()Z",
            reinterpret_cast<void *>(
                    android_location_gpsLocationProvider_is_gnss_configuration_supported)},
    {"native_init_once", "()V", reinterpret_cast<void *>(
            android_location_GnssLocationProvider_init_once)},
    {"native_init", "()Z", reinterpret_cast<void *>(android_location_GnssLocationProvider_init)},
    {"native_cleanup", "()V", reinterpret_cast<void *>(
            android_location_GnssLocationProvider_cleanup)},