Skip to content

Commit

Permalink
Disable multi-process (causes preferences mismatch), close backends i…
Browse files Browse the repository at this point in the history
…f provider is disabled
  • Loading branch information
mar-v-in committed Jan 26, 2015
1 parent e4485d1 commit 16ea810
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
*.iml
gen
bin
build
gen/
bin/
build/
user.gradle
.gradle/
gradle/
gradlew
local.properties
.idea/
3 changes: 0 additions & 3 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand All @@ -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 -->
Expand All @@ -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 -->
Expand Down
6 changes: 4 additions & 2 deletions src/org/microg/nlp/location/BackendFuser.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
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";
Expand Down Expand Up @@ -150,7 +152,7 @@ public void destroy() {
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}
Expand Down
3 changes: 3 additions & 0 deletions src/org/microg/nlp/location/LocationProviderV1.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public LocationProviderV1(Context context) {

@Override
public void onDisable() {
Log.d(TAG, "onDisable");
helper.disable();
}

@Override
Expand All @@ -54,6 +56,7 @@ public void reload() {

@Override
public void onEnable() {
Log.d(TAG, "onEnable");
}

@Override
Expand Down
14 changes: 5 additions & 9 deletions src/org/microg/nlp/location/LocationProviderV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public LocationProviderV2(Context context) {

@Override
public void onDisable() {
Log.d(TAG, "onDisable");
helper.disable();
}

@Override
Expand All @@ -69,6 +71,7 @@ public void destroy() {

@Override
public void onEnable() {
Log.d(TAG, "onEnable");
}

@Override
Expand All @@ -85,15 +88,8 @@ public long onGetStatusUpdateTime() {
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
Expand Down

0 comments on commit 16ea810

Please sign in to comment.