Skip to content
Snippets Groups Projects
Commit cd910c21 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Discard dead MmTelFeature Binder Instances

When the phone process crashes and the IMS service is in
a separate process, there is a condition where the ImsService may
still stay unbound, but alive and not torn down. In this case,
when the phone process comes back up and tries to register new
binder callbacks, detect that the old binder callbacks are dead
and discard instead of throwing an exception.

Bug: 179217608
Test: kill phone process
Change-Id: I4fc3b6d15fe19ebaf1fc52dab92a615a761222f8
parent e980914d
No related branches found
No related tags found
No related merge requests found
......@@ -44,8 +44,12 @@ public class ImsEcbmImplBase {
@Override
public void setListener(IImsEcbmListener listener) {
synchronized (mLock) {
if (mImsEcbm != null && listener != null && Objects.equals(
mImsEcbm.asBinder(), listener.asBinder())) {
if (mListener != null && !mListener.asBinder().isBinderAlive()) {
Log.w(TAG, "setListener: discarding dead Binder");
mListener = null;
}
if (mListener != null && listener != null && Objects.equals(
mListener.asBinder(), listener.asBinder())) {
return;
}
if (listener == null) {
......
......@@ -48,6 +48,10 @@ public class ImsMultiEndpointImplBase {
@Override
public void setListener(IImsExternalCallStateListener listener) throws RemoteException {
synchronized (mLock) {
if (mListener != null && !mListener.asBinder().isBinderAlive()) {
Log.w(TAG, "setListener: discarding dead Binder");
mListener = null;
}
if (mListener != null && listener != null && Objects.equals(
mListener.asBinder(), listener.asBinder())) {
return;
......
......@@ -23,6 +23,7 @@ import android.annotation.SystemApi;
import android.os.Bundle;
import android.os.RemoteException;
import android.telephony.ims.ImsUtListener;
import android.util.Log;
import com.android.ims.internal.IImsUt;
import com.android.ims.internal.IImsUtListener;
......@@ -41,6 +42,7 @@ import java.util.Objects;
// will break other implementations of ImsUt maintained by other ImsServices.
@SystemApi
public class ImsUtImplBase {
private static final String TAG = "ImsUtImplBase";
/**
* Bar all incoming calls. (See 3GPP TS 24.611)
* @hide
......@@ -207,6 +209,11 @@ public class ImsUtImplBase {
@Override
public void setListener(IImsUtListener listener) throws RemoteException {
synchronized (mLock) {
if (mUtListener != null
&& !mUtListener.getListenerInterface().asBinder().isBinderAlive()) {
Log.w(TAG, "setListener: discarding dead Binder");
mUtListener = null;
}
if (mUtListener != null && listener != null && Objects.equals(
mUtListener.getListenerInterface().asBinder(), listener.asBinder())) {
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment