Loading services/core/java/com/android/server/location/GpsLocationProvider.java +50 −32 Original line number Diff line number Diff line Loading @@ -550,6 +550,7 @@ public class GpsLocationProvider implements LocationProviderInterface { } } if (native_is_gnss_configuration_supported()) { try { // Convert properties to string contents and send it to HAL. ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); Loading @@ -559,6 +560,10 @@ public class GpsLocationProvider implements LocationProviderInterface { } catch (IOException ex) { Log.w(TAG, "failed to dump properties contents"); } } else if (DEBUG) { Log.d(TAG, "Skipped configuration update because GNSS configuration in GPS HAL is not" + " supported"); } // SUPL_ES configuration. String suplESProperty = mProperties.getProperty("SUPL_ES"); Loading Loading @@ -732,6 +737,7 @@ public class GpsLocationProvider implements LocationProviderInterface { } if (info != null) { if (native_is_agps_ril_supported()) { boolean dataEnabled = TelephonyManager.getDefault().getDataEnabled(); boolean networkAvailable = info.isAvailable() && dataEnabled; String defaultApn = getSelectedApn(); Loading @@ -742,6 +748,10 @@ public class GpsLocationProvider implements LocationProviderInterface { native_update_network_state(info.isConnected(), info.getType(), info.isRoaming(), networkAvailable, info.getExtraInfo(), defaultApn); } else if (DEBUG) { Log.d(TAG, "Skipped network state update because AGPS-RIL in GPS HAL is not" + " supported"); } } if (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE_SUPL Loading Loading @@ -1752,7 +1762,7 @@ public class GpsLocationProvider implements LocationProviderInterface { // NI Client support //============================================================= private final INetInitiatedListener mNetInitiatedListener = new INetInitiatedListener.Stub() { // Sends a response for an NI reqeust to HAL. // Sends a response for an NI request to HAL. @Override public boolean sendNiResponse(int notificationId, int userResponse) { Loading Loading @@ -1994,7 +2004,9 @@ public class GpsLocationProvider implements LocationProviderInterface { .addOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener); // listen for events IntentFilter intentFilter = new IntentFilter(); IntentFilter intentFilter; if (native_is_agps_ril_supported()) { intentFilter = new IntentFilter(); intentFilter.addAction(Intents.DATA_SMS_RECEIVED_ACTION); intentFilter.addDataScheme("sms"); intentFilter.addDataAuthority("localhost", "7275"); Loading @@ -2008,6 +2020,10 @@ public class GpsLocationProvider implements LocationProviderInterface { Log.w(TAG, "Malformed SUPL init mime type"); } mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, this); } else if (DEBUG) { Log.d(TAG, "Skipped registration for SMS/WAP-PUSH messages because AGPS Ril in GPS" + " HAL is not supported"); } intentFilter = new IntentFilter(); intentFilter.addAction(ALARM_WAKEUP); Loading Loading @@ -2187,6 +2203,8 @@ public class GpsLocationProvider implements LocationProviderInterface { static { class_init_native(); } private static native void class_init_native(); private static native boolean native_is_supported(); private static native boolean native_is_agps_ril_supported(); private static native boolean native_is_gnss_configuration_supported(); private native boolean native_init(); private native void native_cleanup(); Loading services/core/jni/com_android_server_location_GpsLocationProvider.cpp +26 −20 Original line number Diff line number Diff line Loading @@ -509,13 +509,22 @@ static void android_location_GpsLocationProvider_class_init_native(JNIEnv* env, } } static jboolean android_location_GpsLocationProvider_is_supported(JNIEnv* /* env */, jclass /* clazz */) { if (sGpsInterface != NULL) { return JNI_TRUE; } else { return JNI_FALSE; static jboolean android_location_GpsLocationProvider_is_supported( JNIEnv* /* env */, jclass /* clazz */) { return (sGpsInterface != NULL) ? JNI_TRUE : JNI_FALSE; } static jboolean android_location_GpsLocationProvider_is_agps_ril_supported( JNIEnv* /* env */, jclass /* clazz */) { return (sAGpsRilInterface != NULL) ? JNI_TRUE : JNI_FALSE; } static jboolean android_location_gpsLocationProvider_is_gnss_configuration_supported( JNIEnv* /* env */, jclass /* jclazz */) { return (sGnssConfigurationInterface != NULL) ? JNI_TRUE : JNI_FALSE; } static jboolean android_location_GpsLocationProvider_init(JNIEnv* env, jobject obj) Loading Loading @@ -715,14 +724,10 @@ static void android_location_GpsLocationProvider_inject_location(JNIEnv* /* env sGpsInterface->inject_location(latitude, longitude, accuracy); } static jboolean android_location_GpsLocationProvider_supports_xtra(JNIEnv* /* env */, jobject /* obj */) static jboolean android_location_GpsLocationProvider_supports_xtra( JNIEnv* /* env */, jobject /* obj */) { if (sGpsXtraInterface != NULL) { return JNI_TRUE; } else { return JNI_FALSE; } return (sGpsXtraInterface != NULL) ? JNI_TRUE : JNI_FALSE; } static void android_location_GpsLocationProvider_inject_xtra_data(JNIEnv* env, jobject /* obj */, Loading Loading @@ -844,13 +849,10 @@ static void android_location_GpsLocationProvider_update_network_state(JNIEnv* en } } static jboolean android_location_GpsLocationProvider_is_geofence_supported(JNIEnv* /* env */, jobject /* obj */) static jboolean android_location_GpsLocationProvider_is_geofence_supported( JNIEnv* /* env */, jobject /* obj */) { if (sGpsGeofencingInterface != NULL) { return JNI_TRUE; } return JNI_FALSE; return (sGpsGeofencingInterface != NULL) ? JNI_TRUE : JNI_FALSE; } static jboolean android_location_GpsLocationProvider_add_geofence(JNIEnv* /* env */, Loading Loading @@ -1436,6 +1438,10 @@ static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"class_init_native", "()V", (void *)android_location_GpsLocationProvider_class_init_native}, {"native_is_supported", "()Z", (void*)android_location_GpsLocationProvider_is_supported}, {"native_is_agps_ril_supported", "()Z", (void*)android_location_GpsLocationProvider_is_agps_ril_supported}, {"native_is_gnss_configuration_supported", "()Z", (void*)android_location_gpsLocationProvider_is_gnss_configuration_supported}, {"native_init", "()Z", (void*)android_location_GpsLocationProvider_init}, {"native_cleanup", "()V", (void*)android_location_GpsLocationProvider_cleanup}, {"native_set_position_mode", Loading Loading
services/core/java/com/android/server/location/GpsLocationProvider.java +50 −32 Original line number Diff line number Diff line Loading @@ -550,6 +550,7 @@ public class GpsLocationProvider implements LocationProviderInterface { } } if (native_is_gnss_configuration_supported()) { try { // Convert properties to string contents and send it to HAL. ByteArrayOutputStream baos = new ByteArrayOutputStream(4096); Loading @@ -559,6 +560,10 @@ public class GpsLocationProvider implements LocationProviderInterface { } catch (IOException ex) { Log.w(TAG, "failed to dump properties contents"); } } else if (DEBUG) { Log.d(TAG, "Skipped configuration update because GNSS configuration in GPS HAL is not" + " supported"); } // SUPL_ES configuration. String suplESProperty = mProperties.getProperty("SUPL_ES"); Loading Loading @@ -732,6 +737,7 @@ public class GpsLocationProvider implements LocationProviderInterface { } if (info != null) { if (native_is_agps_ril_supported()) { boolean dataEnabled = TelephonyManager.getDefault().getDataEnabled(); boolean networkAvailable = info.isAvailable() && dataEnabled; String defaultApn = getSelectedApn(); Loading @@ -742,6 +748,10 @@ public class GpsLocationProvider implements LocationProviderInterface { native_update_network_state(info.isConnected(), info.getType(), info.isRoaming(), networkAvailable, info.getExtraInfo(), defaultApn); } else if (DEBUG) { Log.d(TAG, "Skipped network state update because AGPS-RIL in GPS HAL is not" + " supported"); } } if (info != null && info.getType() == ConnectivityManager.TYPE_MOBILE_SUPL Loading Loading @@ -1752,7 +1762,7 @@ public class GpsLocationProvider implements LocationProviderInterface { // NI Client support //============================================================= private final INetInitiatedListener mNetInitiatedListener = new INetInitiatedListener.Stub() { // Sends a response for an NI reqeust to HAL. // Sends a response for an NI request to HAL. @Override public boolean sendNiResponse(int notificationId, int userResponse) { Loading Loading @@ -1994,7 +2004,9 @@ public class GpsLocationProvider implements LocationProviderInterface { .addOnSubscriptionsChangedListener(mOnSubscriptionsChangedListener); // listen for events IntentFilter intentFilter = new IntentFilter(); IntentFilter intentFilter; if (native_is_agps_ril_supported()) { intentFilter = new IntentFilter(); intentFilter.addAction(Intents.DATA_SMS_RECEIVED_ACTION); intentFilter.addDataScheme("sms"); intentFilter.addDataAuthority("localhost", "7275"); Loading @@ -2008,6 +2020,10 @@ public class GpsLocationProvider implements LocationProviderInterface { Log.w(TAG, "Malformed SUPL init mime type"); } mContext.registerReceiver(mBroadcastReceiver, intentFilter, null, this); } else if (DEBUG) { Log.d(TAG, "Skipped registration for SMS/WAP-PUSH messages because AGPS Ril in GPS" + " HAL is not supported"); } intentFilter = new IntentFilter(); intentFilter.addAction(ALARM_WAKEUP); Loading Loading @@ -2187,6 +2203,8 @@ public class GpsLocationProvider implements LocationProviderInterface { static { class_init_native(); } private static native void class_init_native(); private static native boolean native_is_supported(); private static native boolean native_is_agps_ril_supported(); private static native boolean native_is_gnss_configuration_supported(); private native boolean native_init(); private native void native_cleanup(); Loading
services/core/jni/com_android_server_location_GpsLocationProvider.cpp +26 −20 Original line number Diff line number Diff line Loading @@ -509,13 +509,22 @@ static void android_location_GpsLocationProvider_class_init_native(JNIEnv* env, } } static jboolean android_location_GpsLocationProvider_is_supported(JNIEnv* /* env */, jclass /* clazz */) { if (sGpsInterface != NULL) { return JNI_TRUE; } else { return JNI_FALSE; static jboolean android_location_GpsLocationProvider_is_supported( JNIEnv* /* env */, jclass /* clazz */) { return (sGpsInterface != NULL) ? JNI_TRUE : JNI_FALSE; } static jboolean android_location_GpsLocationProvider_is_agps_ril_supported( JNIEnv* /* env */, jclass /* clazz */) { return (sAGpsRilInterface != NULL) ? JNI_TRUE : JNI_FALSE; } static jboolean android_location_gpsLocationProvider_is_gnss_configuration_supported( JNIEnv* /* env */, jclass /* jclazz */) { return (sGnssConfigurationInterface != NULL) ? JNI_TRUE : JNI_FALSE; } static jboolean android_location_GpsLocationProvider_init(JNIEnv* env, jobject obj) Loading Loading @@ -715,14 +724,10 @@ static void android_location_GpsLocationProvider_inject_location(JNIEnv* /* env sGpsInterface->inject_location(latitude, longitude, accuracy); } static jboolean android_location_GpsLocationProvider_supports_xtra(JNIEnv* /* env */, jobject /* obj */) static jboolean android_location_GpsLocationProvider_supports_xtra( JNIEnv* /* env */, jobject /* obj */) { if (sGpsXtraInterface != NULL) { return JNI_TRUE; } else { return JNI_FALSE; } return (sGpsXtraInterface != NULL) ? JNI_TRUE : JNI_FALSE; } static void android_location_GpsLocationProvider_inject_xtra_data(JNIEnv* env, jobject /* obj */, Loading Loading @@ -844,13 +849,10 @@ static void android_location_GpsLocationProvider_update_network_state(JNIEnv* en } } static jboolean android_location_GpsLocationProvider_is_geofence_supported(JNIEnv* /* env */, jobject /* obj */) static jboolean android_location_GpsLocationProvider_is_geofence_supported( JNIEnv* /* env */, jobject /* obj */) { if (sGpsGeofencingInterface != NULL) { return JNI_TRUE; } return JNI_FALSE; return (sGpsGeofencingInterface != NULL) ? JNI_TRUE : JNI_FALSE; } static jboolean android_location_GpsLocationProvider_add_geofence(JNIEnv* /* env */, Loading Loading @@ -1436,6 +1438,10 @@ static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ {"class_init_native", "()V", (void *)android_location_GpsLocationProvider_class_init_native}, {"native_is_supported", "()Z", (void*)android_location_GpsLocationProvider_is_supported}, {"native_is_agps_ril_supported", "()Z", (void*)android_location_GpsLocationProvider_is_agps_ril_supported}, {"native_is_gnss_configuration_supported", "()Z", (void*)android_location_gpsLocationProvider_is_gnss_configuration_supported}, {"native_init", "()Z", (void*)android_location_GpsLocationProvider_init}, {"native_cleanup", "()V", (void*)android_location_GpsLocationProvider_cleanup}, {"native_set_position_mode", Loading