Fix async issues

This commit is contained in:
mar-v-in 2015-02-02 00:03:48 +01:00
parent ad1d47e1cf
commit f70578f78b
7 changed files with 17 additions and 12 deletions

2
GmsApi

@ -1 +1 @@
Subproject commit 3c19d84eaa9842a2526166a38ad445125dbd2300 Subproject commit 5d2364f3dcc66bdd1ae19c91d76d77d2a4a785b6

View File

@ -9,8 +9,8 @@ import android.content.DialogInterface;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.util.Log; import android.util.Log;
import org.microg.gms.Constants; import org.microg.gms.common.Constants;
import org.microg.gms.PublicApi; import org.microg.gms.common.PublicApi;
/** /**
* Utility class for verifying that the Google Play services APK is available and up-to-date on * Utility class for verifying that the Google Play services APK is available and up-to-date on

View File

@ -1,6 +1,6 @@
package com.google.android.gms.common.api; package com.google.android.gms.common.api;
import org.microg.gms.PublicApi; import org.microg.gms.common.PublicApi;
import org.microg.gms.common.api.ApiBuilder; import org.microg.gms.common.api.ApiBuilder;
/** /**

View File

@ -10,8 +10,8 @@ import android.view.View;
import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.ConnectionResult;
import org.microg.gms.Constants; import org.microg.gms.common.Constants;
import org.microg.gms.PublicApi; import org.microg.gms.common.PublicApi;
import org.microg.gms.common.api.GoogleApiClientImpl; import org.microg.gms.common.api.GoogleApiClientImpl;
import java.util.HashMap; import java.util.HashMap;

View File

@ -7,7 +7,7 @@ import android.os.Looper;
import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult; import com.google.android.gms.common.api.PendingResult;
import org.microg.gms.Constants; import org.microg.gms.common.Constants;
public interface FusedLocationProviderApi { public interface FusedLocationProviderApi {
public static final String KEY_LOCATION_CHANGED = "com.google.android.location.LOCATION"; public static final String KEY_LOCATION_CHANGED = "com.google.android.location.LOCATION";

View File

@ -28,7 +28,7 @@ import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import static org.microg.gms.Constants.GMS_PACKAGE_NAME; import static org.microg.gms.common.Constants.GMS_PACKAGE_NAME;
public class MultiConnectionKeeper { public class MultiConnectionKeeper {
private static final String TAG = "GmsMultiConnectionKeeper"; private static final String TAG = "GmsMultiConnectionKeeper";
@ -48,7 +48,7 @@ public class MultiConnectionKeeper {
return INSTANCE; return INSTANCE;
} }
public boolean bind(String action, ServiceConnection connection) { public synchronized boolean bind(String action, ServiceConnection connection) {
Log.d(TAG, "bind(" + action + ", " + connection + ")"); Log.d(TAG, "bind(" + action + ", " + connection + ")");
Connection con = connections.get(action); Connection con = connections.get(action);
if (con != null) { if (con != null) {
@ -66,7 +66,7 @@ public class MultiConnectionKeeper {
return con.isBound(); return con.isBound();
} }
public void unbind(String action, ServiceConnection connection) { public synchronized void unbind(String action, ServiceConnection connection) {
Log.d(TAG, "unbind(" + action + ", " + connection + ")"); Log.d(TAG, "unbind(" + action + ", " + connection + ")");
Connection con = connections.get(action); Connection con = connections.get(action);
if (con != null) { if (con != null) {
@ -108,6 +108,7 @@ public class MultiConnectionKeeper {
connection.onServiceDisconnected(componentName); connection.onServiceDisconnected(componentName);
} }
connected = false; connected = false;
bound = false;
} }
}; };
@ -135,7 +136,11 @@ public class MultiConnectionKeeper {
public void unbind() { public void unbind() {
Log.d(TAG, "Connection(" + actionString + ") : unbind()"); Log.d(TAG, "Connection(" + actionString + ") : unbind()");
context.unbindService(serviceConnection); try {
context.unbindService(serviceConnection);
} catch (IllegalArgumentException e) { // not bound (whatever reason)
Log.w(TAG, e);
}
bound = false; bound = false;
} }

View File

@ -25,7 +25,7 @@ import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.internal.IGmsServiceBroker; import com.google.android.gms.common.internal.IGmsServiceBroker;
import com.google.android.gms.location.internal.IGoogleLocationManagerService; import com.google.android.gms.location.internal.IGoogleLocationManagerService;
import org.microg.gms.Constants; import org.microg.gms.common.Constants;
import org.microg.gms.common.GmsClient; import org.microg.gms.common.GmsClient;
public abstract class GoogleLocationManagerClient extends GmsClient<IGoogleLocationManagerService> { public abstract class GoogleLocationManagerClient extends GmsClient<IGoogleLocationManagerService> {