NetworkQueryService.onBind() should not return LocalBinder
unless the intent has action ACTION_LOCAL_BINDER.
Change-Id: Iaadf4aeaae4fc540824af0d49759f41b8cf693e2
diff --git a/src/com/android/phone/NetworkQueryService.java b/src/com/android/phone/NetworkQueryService.java
index 1a497b4..84fde87 100644
--- a/src/com/android/phone/NetworkQueryService.java
+++ b/src/com/android/phone/NetworkQueryService.java
@@ -53,6 +53,8 @@
// error statuses that will be retured in the callback.
public static final int QUERY_OK = 0;
public static final int QUERY_EXCEPTION = 1;
+
+ static final String ACTION_LOCAL_BINDER = "com.android.phone.intent.action.LOCAL_BINDER";
/** state of the query service */
private int mState;
@@ -184,11 +186,12 @@
*/
@Override
public IBinder onBind(Intent intent) {
- // TODO: Currently, return only the LocalBinder instance. If we
- // end up requiring support for a remote binder, we will need to
- // return mBinder as well, depending upon the intent.
if (DBG) log("binding service implementation");
- return mLocalBinder;
+ if (ACTION_LOCAL_BINDER.equals(intent.getAction())) {
+ return mLocalBinder;
+ }
+
+ return mBinder;
}
/**
diff --git a/src/com/android/phone/NetworkSetting.java b/src/com/android/phone/NetworkSetting.java
index ad2fea3..3d32817 100644
--- a/src/com/android/phone/NetworkSetting.java
+++ b/src/com/android/phone/NetworkSetting.java
@@ -270,8 +270,9 @@
// we want this service to just stay in the background until it is killed, we
// don't bother stopping it from our end.
startService (new Intent(this, NetworkQueryService.class));
- bindService (new Intent(this, NetworkQueryService.class), mNetworkQueryServiceConnection,
- Context.BIND_AUTO_CREATE);
+ bindService (new Intent(this, NetworkQueryService.class).setAction(
+ NetworkQueryService.ACTION_LOCAL_BINDER),
+ mNetworkQueryServiceConnection, Context.BIND_AUTO_CREATE);
}
@Override