Disable multi-process (causes preferences mismatch), close backends if provider is disabled

This commit is contained in:
mar-v-in 2015-01-26 03:27:36 +01:00
parent e4485d14b1
commit 16ea810a84
6 changed files with 21 additions and 18 deletions

11
.gitignore vendored
View File

@ -1,5 +1,10 @@
*.iml
gen
bin
build
gen/
bin/
build/
user.gradle
.gradle/
gradle/
gradlew
local.properties
.idea/

View File

@ -46,7 +46,6 @@
<service
android:name="org.microg.nlp.location.LocationServiceV1"
android:permission="android.permission.ACCESS_COARSE_LOCATION"
android:process=":nlp_loc_service"
android:exported="true">
<intent-filter>
<action android:name="com.google.android.location.NetworkLocationProvider" />
@ -64,7 +63,6 @@
<service
android:name="org.microg.nlp.location.LocationServiceV2"
android:permission="android.permission.ACCESS_COARSE_LOCATION"
android:process=":nlp_loc_service"
android:exported="true">
<intent-filter>
<!-- KitKat changed the action name but nothing else, hence we handle it the same -->
@ -82,7 +80,6 @@
<service
android:name="org.microg.nlp.geocode.GeocodeServiceV1"
android:process=":nlp_geo_service"
android:exported="true">
<intent-filter>
<!-- Jelly Bean changed the action name but nothing else, hence we handle it the same -->

@ -1 +1 @@
Subproject commit 2f713c50a824d7e5e2e01f815c85d67f1c4d077d
Subproject commit 54d49883059adb100a8a3d901d4fbeaf4a0f5353

View File

@ -30,7 +30,9 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import static org.microg.nlp.api.Constants.*;
import static org.microg.nlp.api.Constants.ACTION_LOCATION_BACKEND;
import static org.microg.nlp.api.Constants.LOCATION_EXTRA_BACKEND_PROVIDER;
import static org.microg.nlp.api.Constants.LOCATION_EXTRA_OTHER_BACKENDS;
class BackendFuser {
private static final String TAG = "NlpLocationBackendFuser";
@ -150,7 +152,7 @@ class BackendFuser {
public static class LocationComparator implements Comparator<Location> {
public static final LocationComparator INSTANCE = new LocationComparator();
public static final long SWITCH_ON_FRESHNESS_CLIFF_MS = 30000; // 30 seconds TODO: make it a setting
public static final long SWITCH_ON_FRESHNESS_CLIFF_MS = 30000; // 30 seconds
/**
* @return whether {@param lhs} is better than {@param rhs}

View File

@ -40,6 +40,8 @@ public class LocationProviderV1 extends com.android.location.provider.LocationPr
@Override
public void onDisable() {
Log.d(TAG, "onDisable");
helper.disable();
}
@Override
@ -54,6 +56,7 @@ public class LocationProviderV1 extends com.android.location.provider.LocationPr
@Override
public void onEnable() {
Log.d(TAG, "onEnable");
}
@Override

View File

@ -50,6 +50,8 @@ class LocationProviderV2 extends LocationProviderBase implements LocationProvide
@Override
public void onDisable() {
Log.d(TAG, "onDisable");
helper.disable();
}
@Override
@ -69,6 +71,7 @@ class LocationProviderV2 extends LocationProviderBase implements LocationProvide
@Override
public void onEnable() {
Log.d(TAG, "onEnable");
}
@Override
@ -85,15 +88,8 @@ class LocationProviderV2 extends LocationProviderBase implements LocationProvide
public void onSetRequest(ProviderRequestUnbundled requests, WorkSource source) {
Log.v(TAG, "onSetRequest: " + requests + " by " + source);
long autoTime = Long.MAX_VALUE;
boolean autoUpdate = false;
for (LocationRequestUnbundled request : requests.getLocationRequests()) {
Log.v(TAG, "onSetRequest: request: " + request);
if (autoTime > request.getInterval()) {
autoTime = request.getInterval();
}
autoUpdate = true;
}
long autoTime = requests.getInterval();
boolean autoUpdate = requests.getReportLocation();
if (autoTime < 1500) {
// Limit to 1.5s