Small fixes

This commit is contained in:
mar-v-in 2015-04-01 00:13:40 +02:00
parent 1374dfa012
commit 0ea075dd11
2 changed files with 13 additions and 6 deletions

View File

@ -16,6 +16,7 @@
package org.microg.gms.common; package org.microg.gms.common;
import android.annotation.SuppressLint;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -28,10 +29,12 @@ import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import static android.os.Build.VERSION.SDK_INT;
import static android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH;
import static org.microg.gms.common.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 = "GmsMultiConKeeper";
private static MultiConnectionKeeper INSTANCE; private static MultiConnectionKeeper INSTANCE;
@ -89,7 +92,7 @@ public class MultiConnectionKeeper {
@Override @Override
public void onServiceConnected(ComponentName componentName, IBinder iBinder) { public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
Log.d(TAG, "Connection(" + actionString + ") : ServiceConnection : " + Log.d(TAG, "Connection(" + actionString + ") : ServiceConnection : " +
"onServiceConnected("+componentName+")"); "onServiceConnected(" + componentName + ")");
binder = iBinder; binder = iBinder;
component = componentName; component = componentName;
for (ServiceConnection connection : connectionForwards) { for (ServiceConnection connection : connectionForwards) {
@ -101,7 +104,7 @@ public class MultiConnectionKeeper {
@Override @Override
public void onServiceDisconnected(ComponentName componentName) { public void onServiceDisconnected(ComponentName componentName) {
Log.d(TAG, "Connection(" + actionString + ") : ServiceConnection : " + Log.d(TAG, "Connection(" + actionString + ") : ServiceConnection : " +
"onServiceDisconnected("+componentName+")"); "onServiceDisconnected(" + componentName + ")");
binder = null; binder = null;
component = componentName; component = componentName;
for (ServiceConnection connection : connectionForwards) { for (ServiceConnection connection : connectionForwards) {
@ -116,11 +119,15 @@ public class MultiConnectionKeeper {
this.actionString = actionString; this.actionString = actionString;
} }
@SuppressLint("InlinedApi")
public void bind() { public void bind() {
Log.d(TAG, "Connection(" + actionString + ") : bind()"); Log.d(TAG, "Connection(" + actionString + ") : bind()");
Intent intent = new Intent(actionString).setPackage(GMS_PACKAGE_NAME); Intent intent = new Intent(actionString).setPackage(GMS_PACKAGE_NAME);
bound = context.bindService(intent, serviceConnection, int flags = Context.BIND_AUTO_CREATE;
Context.BIND_ADJUST_WITH_ACTIVITY | Context.BIND_AUTO_CREATE); if (SDK_INT >= ICE_CREAM_SANDWICH) {
flags |= Context.BIND_ADJUST_WITH_ACTIVITY;
}
bound = context.bindService(intent, serviceConnection, flags);
if (!bound) { if (!bound) {
context.unbindService(serviceConnection); context.unbindService(serviceConnection);
} }

View File

@ -38,7 +38,7 @@ public class PutDataMapRequest {
*/ */
public PutDataRequest asPutDataRequest() { public PutDataRequest asPutDataRequest() {
// TODO // TODO
return new PutDataRequest(); return PutDataRequest.create(null);
} }
/** /**