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

Commit 66978614 authored by Dante Russo's avatar Dante Russo Committed by Steve Kondik
Browse files

Squashed commit of GPS changes from CodeAurora

GpsLocationProvider: ipv6 support

AGPS calls to accept ipv6 addresses

Change-Id: If9187b8fd9e0ba22cd01722d5c04aabccebad38b

GPS Provider changes

Added support to delete aiding data test feature.
Added more data catagories, to now at the total of 21

Change-Id: Icb15d21b8204323021c47eac5249cde128e38246

GPS provider - AGPS Dual APN support

To support either SUPL or any WWAN connection - allow connction
type at open request API; FW's support to dual AGPS connections

Change-Id: Iecb07f31a99353f75c1a0c000bb6e39ef007f6bf

Supporting IPv4v6 and IPv6 bearer types for ATL

Change-Id: Ife8c72d9975ac58b9e4091cb95ad5a9763e01c3f

gps: determine ip protocol type from telephony.db

Instead of determining the ip protocol type from the
type of ip address we have, the ip protocol type is
looked up in telephony.db based on the carrier and apn.

Change-Id: Ib0d76354515fb44f570668d5a4a42cccfa6fe78a
CRs-Fixed: 376537

gps: get apn when supl is already active

When supl is already active, get the apn and bearer and
try to connect, instead of reporting failure.
CRs-fixed: 401408

Change-Id: I2eed11e0a34a55d1b62d37f0a6c97b1f3f2fecae

gps: allow xta data over default mobile connection

If the default mobile data connection is up and
connected, use that connection to download xta data.

Change-Id: Ic5ff5422ac9baf83ac923faeb1f8b4fc9186c184
CRs-fixed: 399721

GpsLocationProvider: Support type wifi in i/F request.

Add support in GpsLocationProvider for wifi type for
i/F request.

Change-Id: I44463e72857c06ae24626b8f3cd482ddac7c278b

Conflicts:

	services/java/com/android/server/location/GpsLocationProvider.java

gps: adding net_raw gid for IPC permission

for AFW to have permission to call loc api

Change-Id: Ifc7451659431fa1c1998f5d75bfa5f2018a5d054

gps: fixed singleshot session that doesn't stop

When a single shot location is requested and a
location is returned, the location request is
not stopped and so it continues even when the
requestor has stopped listening. This can cause
gps tracking to continue in the backgroud and eat
up battery.

This is fixed by stoping the provider if there
are no more update record associated with it
when a location is returned.

Change-Id: Ie437732ff06231a46724843af30e21ca3a1694ab

gps: return dummy apn instead of null

This change was missed during merge, which
can cause exception(crash) if apn is returned
as null.

Change-Id: I15160c8f2f512cc75bbe1b7b7ef4695c201112d8
parent 5dcf7abc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -485,7 +485,7 @@ public class ZygoteInit {
        String args[] = {
            "--setuid=1000",
            "--setgid=1000",
            "--setgroups=1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1018,3001,3002,3003,3006,3007",
            "--setgroups=1001,1002,1003,1004,1005,1006,1007,1008,1009,1010,1018,3001,3002,3003,3004,3006,3007",
            "--capabilities=130104352,130104352",
            "--runtime-init",
            "--nice-name=system_server",
+5 −0
Original line number Diff line number Diff line
@@ -1061,6 +1061,11 @@ public class LocationManagerService extends ILocationManager.Stub implements Run
                if (removeReceiver && receiverRecords.size() == 0) {
                    removeUpdatesLocked(mReceiver);
                }

                // and also stop the provider if it has no more update records
                if (globalRecords.isEmpty()) {
                    applyRequirementsLocked(this.mProvider);
                }
            }
        }

+876 −109

File changed.

Preview size limit exceeded, changes collapsed.

+64 −20
Original line number Diff line number Diff line
/*
 * Copyright (C) 2008 The Android Open Source Project
 * Copyright (c) 2011,2012, The Linux Foundation. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
@@ -107,7 +108,7 @@ static void nmea_callback(GpsUtcTime timestamp, const char* nmea, int length)

static void set_capabilities_callback(uint32_t capabilities)
{
    ALOGD("set_capabilities_callback: %ld\n", capabilities);
    ALOGD("set_capabilities_callback: %ld\n", (long ) capabilities);
    JNIEnv* env = AndroidRuntime::getJNIEnv();
    env->CallVoidMethod(mCallbacksObj, method_setEngineCapabilities, capabilities);
    checkAndClearExceptionFromCallback(env, __FUNCTION__);
@@ -163,20 +164,60 @@ GpsXtraCallbacks sGpsXtraCallbacks = {
static void agps_status_callback(AGpsStatus* agps_status)
{
    JNIEnv* env = AndroidRuntime::getJNIEnv();
    jbyteArray byteArray = NULL;
    jstring ssid_string = NULL;
    jstring password_string = NULL;

    uint32_t ipaddr;
    // ipaddr field was not included in original AGpsStatus
    if (agps_status->size >= sizeof(AGpsStatus))
#ifdef NEW_QC_GPS
        ipaddr = agps_status->ipv4_addr;
    // there is neither ipv4 now ipv6 addresses unless this is true
    if (agps_status->size >
        ((char*)(agps_status->ipv4_addr) - (char*)agps_status)) {
        // if we have a valid ipv4 address
        if (agps_status->ipv4_addr != 0xFFFFFFFF) {
            byteArray = env->NewByteArray(4);
            ALOG_ASSERT(byteArray, "Native could not create new byte[]");
            env->SetByteArrayRegion(byteArray, 0, 4, (const jbyte *)agps_status->ipv4_addr);
        } else if (agps_status->size >= sizeof(AGpsStatus)) {
            // newest version of AGpsStatus struct, which has ipv6
            // address. So we go with that. We won't get here if
            // we have a valid ipv4 address.
            byteArray = env->NewByteArray(16);
            ALOG_ASSERT(byteArray, "Native could not create new byte[]");
            env->SetByteArrayRegion(byteArray, 0, 16, (const jbyte *)agps_status->ipv6_addr );

            if (agps_status->ssid[0] != '\0') {
                ssid_string = env->NewStringUTF(agps_status->ssid);
                if (agps_status->password[0] != '\0') {
                    password_string = env->NewStringUTF(agps_status->password);
                }
            }
        }
    }
#else
        ipaddr = agps_status->ipaddr;
    uint32_t ipaddr;
    // ipaddr field was not included in original AGpsStatus
    if (agps_status->size >= sizeof(AGpsStatus)) {
        if (agps_status->ipaddr != 0xFFFFFFFF) {
            byteArray = env->NewByteArray(4);
            ALOG_ASSERT(byteArray, "Native could not create new byte[]");
            env->SetByteArrayRegion(byteArray, 0, 4, (const jbyte *)agps_status->ipaddr);
        }
    }
#endif
    else
        ipaddr = 0xFFFFFFFF;
    env->CallVoidMethod(mCallbacksObj, method_reportAGpsStatus,
                        agps_status->type, agps_status->status, ipaddr);
    env->CallVoidMethod(mCallbacksObj,
                        method_reportAGpsStatus,
                        agps_status->type,
                        agps_status->status,
                        byteArray,
                        byteArray,
                        ssid_string,
                        password_string);

    checkAndClearExceptionFromCallback(env, __FUNCTION__);
    
    if (byteArray != NULL) {
        env->DeleteLocalRef(byteArray);
    }
}

AGpsCallbacks sAGpsCallbacks = {
@@ -244,7 +285,7 @@ static void android_location_GpsLocationProvider_class_init_native(JNIEnv* env,
    method_reportLocation = env->GetMethodID(clazz, "reportLocation", "(IDDDFFFJ)V");
    method_reportStatus = env->GetMethodID(clazz, "reportStatus", "(I)V");
    method_reportSvStatus = env->GetMethodID(clazz, "reportSvStatus", "()V");
    method_reportAGpsStatus = env->GetMethodID(clazz, "reportAGpsStatus", "(III)V");
    method_reportAGpsStatus = env->GetMethodID(clazz, "reportAGpsStatus", "(II[BLjava/lang/String;Ljava/lang/String;)V");
    method_reportNmea = env->GetMethodID(clazz, "reportNmea", "(J)V");
    method_setEngineCapabilities = env->GetMethodID(clazz, "setEngineCapabilities", "(I)V");
    method_xtraDownloadRequest = env->GetMethodID(clazz, "xtraDownloadRequest", "()V");
@@ -476,7 +517,8 @@ static void android_location_GpsLocationProvider_inject_xtra_data(JNIEnv* env, j
    env->ReleasePrimitiveArrayCritical(data, bytes, JNI_ABORT);
}

static void android_location_GpsLocationProvider_agps_data_conn_open(JNIEnv* env, jobject obj, jstring apn)
static void android_location_GpsLocationProvider_agps_data_conn_open(JNIEnv* env, jobject obj,
        jint agpsType, jstring apn, jint bearerType)
{
    if (!sAGpsInterface) {
        ALOGE("no AGPS interface in agps_data_conn_open");
@@ -488,34 +530,36 @@ static void android_location_GpsLocationProvider_agps_data_conn_open(JNIEnv* env
    }
    const char *apnStr = env->GetStringUTFChars(apn, NULL);
#ifdef NEW_QC_GPS
    sAGpsInterface->data_conn_open(0, apnStr, 0);
    sAGpsInterface->data_conn_open(agpsType, apnStr, bearerType);
#else
    sAGpsInterface->data_conn_open(apnStr);
#endif
    env->ReleaseStringUTFChars(apn, apnStr);
}

static void android_location_GpsLocationProvider_agps_data_conn_closed(JNIEnv* env, jobject obj)
static void android_location_GpsLocationProvider_agps_data_conn_closed(JNIEnv* env, jobject obj,
        jint agpsType)
{
    if (!sAGpsInterface) {
        ALOGE("no AGPS interface in agps_data_conn_open");
        return;
    }
#ifdef NEW_QC_GPS
    sAGpsInterface->data_conn_closed(0);
    sAGpsInterface->data_conn_closed(agpsType);
#else
    sAGpsInterface->data_conn_closed();
#endif
}

static void android_location_GpsLocationProvider_agps_data_conn_failed(JNIEnv* env, jobject obj)
static void android_location_GpsLocationProvider_agps_data_conn_failed(JNIEnv* env, jobject obj,
        jint agpsType)
{
    if (!sAGpsInterface) {
        ALOGE("no AGPS interface in agps_data_conn_open");
        return;
    }
#ifdef NEW_QC_GPS
    sAGpsInterface->data_conn_failed(0);
    sAGpsInterface->data_conn_failed(agpsType);
#else
    sAGpsInterface->data_conn_failed();
#endif
@@ -597,9 +641,9 @@ static JNINativeMethod sMethods[] = {
    {"native_inject_location", "(DDF)V", (void*)android_location_GpsLocationProvider_inject_location},
    {"native_supports_xtra", "()Z", (void*)android_location_GpsLocationProvider_supports_xtra},
    {"native_inject_xtra_data", "([BI)V", (void*)android_location_GpsLocationProvider_inject_xtra_data},
    {"native_agps_data_conn_open", "(Ljava/lang/String;)V", (void*)android_location_GpsLocationProvider_agps_data_conn_open},
    {"native_agps_data_conn_closed", "()V", (void*)android_location_GpsLocationProvider_agps_data_conn_closed},
    {"native_agps_data_conn_failed", "()V", (void*)android_location_GpsLocationProvider_agps_data_conn_failed},
    {"native_agps_data_conn_open", "(ILjava/lang/String;I)V", (void*)android_location_GpsLocationProvider_agps_data_conn_open},
    {"native_agps_data_conn_closed", "(I)V", (void*)android_location_GpsLocationProvider_agps_data_conn_closed},
    {"native_agps_data_conn_failed", "(I)V", (void*)android_location_GpsLocationProvider_agps_data_conn_failed},
    {"native_agps_set_id","(ILjava/lang/String;)V",(void*)android_location_GpsLocationProvider_agps_set_id},
    {"native_agps_set_ref_location_cellid","(IIIII)V",(void*)android_location_GpsLocationProvider_agps_set_reference_location_cellid},
    {"native_set_agps_server", "(ILjava/lang/String;I)V", (void*)android_location_GpsLocationProvider_set_agps_server},