aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Ebinger <breadley@google.com>2018-01-18 12:03:33 -0800
committerBrad Ebinger <breadley@google.com>2018-01-18 22:19:24 +0000
commit3418c1369928abbd995a903e2c2f907a5b7b8cb7 (patch)
treead005870483805cc5b22eb17f1c15a5a26c20067
parent0e170c7f6ca88c32d45ad5b4a932b6808956d472 (diff)
downloadims-3418c1369928abbd995a903e2c2f907a5b7b8cb7.tar.gz
Include Context in ImsServiceProxy Compat Layerandroid-wear-8.0.0_r1
Context was not being set correctly in ImsServiceProxyCompat, causing a phone process crash. Bug: 72124004 Test: Boot, make sure phone process doesn't crash Change-Id: Ib8fe268c8b5d6d05fe62bf4c87c574e5c6e55bd8
-rw-r--r--src/java/com/android/ims/ImsManager.java9
-rw-r--r--src/java/com/android/ims/ImsServiceProxy.java6
-rw-r--r--src/java/com/android/ims/ImsServiceProxyCompat.java9
3 files changed, 14 insertions, 10 deletions
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java
index 8f2e7633..6482ba40 100644
--- a/src/java/com/android/ims/ImsManager.java
+++ b/src/java/com/android/ims/ImsManager.java
@@ -42,6 +42,7 @@ import com.android.ims.internal.IImsCallSession;
import com.android.ims.internal.IImsConfig;
import com.android.ims.internal.IImsEcbm;
import com.android.ims.internal.IImsMultiEndpoint;
+import com.android.ims.internal.IImsRegistration;
import com.android.ims.internal.IImsRegistrationCallback;
import com.android.ims.internal.IImsRegistrationListener;
import com.android.ims.internal.IImsUt;
@@ -1520,8 +1521,10 @@ public class ImsManager {
checkAndThrowExceptionIfServiceUnavailable();
// TODO: Remove once new MmTelFeature is merged in
mImsServiceProxy.addRegistrationListener(mImsRegistrationListenerProxy);
- mImsServiceProxy.getRegistration().addRegistrationCallback(
- mRegistrationCallback);
+ IImsRegistration regBinder = mImsServiceProxy.getRegistration();
+ if (regBinder != null) {
+ regBinder.addRegistrationCallback(mRegistrationCallback);
+ }
log("Registration Callback/Listener registered.");
// Only record if there isn't a RemoteException.
mHasRegisteredForProxy = true;
@@ -1964,7 +1967,7 @@ public class ImsManager {
if (!mConfigDynamicBind) {
// Deprecated method of binding
Rlog.i(TAG, "Creating ImsService using ServiceManager");
- mImsServiceProxy = ImsServiceProxyCompat.create(mPhoneId, mDeathRecipient);
+ mImsServiceProxy = ImsServiceProxyCompat.create(mContext, mPhoneId, mDeathRecipient);
} else {
Rlog.i(TAG, "Creating ImsService using ImsResolver");
mImsServiceProxy = ImsServiceProxy.create(mContext, mPhoneId);
diff --git a/src/java/com/android/ims/ImsServiceProxy.java b/src/java/com/android/ims/ImsServiceProxy.java
index 543e31ef..a2df36bd 100644
--- a/src/java/com/android/ims/ImsServiceProxy.java
+++ b/src/java/com/android/ims/ImsServiceProxy.java
@@ -144,15 +144,15 @@ public class ImsServiceProxy {
}
};
- public ImsServiceProxy(int slotId, IBinder binder, int featureType) {
+ public ImsServiceProxy(Context context, int slotId, IBinder binder, int featureType) {
mSlotId = slotId;
mBinder = binder;
mSupportedFeature = featureType;
+ mContext = context;
}
public ImsServiceProxy(Context context, int slotId, int featureType) {
- this(slotId, null, featureType);
- mContext = context;
+ this(context, slotId, null, featureType);
}
public @Nullable IImsRegistration getRegistration() {
diff --git a/src/java/com/android/ims/ImsServiceProxyCompat.java b/src/java/com/android/ims/ImsServiceProxyCompat.java
index 44f72e6a..a6d1865e 100644
--- a/src/java/com/android/ims/ImsServiceProxyCompat.java
+++ b/src/java/com/android/ims/ImsServiceProxyCompat.java
@@ -54,7 +54,8 @@ public class ImsServiceProxyCompat extends ImsServiceProxy {
*/
private static final String IMS_SERVICE = "ims";
- public static ImsServiceProxyCompat create(int slotId, IBinder.DeathRecipient recipient) {
+ public static ImsServiceProxyCompat create(Context context, int slotId,
+ IBinder.DeathRecipient recipient) {
IBinder binder = ServiceManager.checkService(IMS_SERVICE);
if (binder != null) {
@@ -66,11 +67,11 @@ public class ImsServiceProxyCompat extends ImsServiceProxy {
// If the proxy is created with a null binder, subsequent calls that depend on a live
// binder will fail, causing this structure to be torn down and created again.
- return new ImsServiceProxyCompat(slotId, binder);
+ return new ImsServiceProxyCompat(context, slotId, binder);
}
- public ImsServiceProxyCompat(int slotId, IBinder binder) {
- super(slotId, binder, SERVICE_ID);
+ public ImsServiceProxyCompat(Context context, int slotId, IBinder binder) {
+ super(context, slotId, binder, SERVICE_ID);
}
@Override