summaryrefslogtreecommitdiff
path: root/telephony/java
diff options
context:
space:
mode:
authorBrad Ebinger <breadley@google.com>2021-02-05 00:27:08 +0000
committerBrad Ebinger <breadley@google.com>2021-02-05 00:42:39 +0000
commitcd910c2131cec47f8e9f513f39a642a0dbedc238 (patch)
treeeaf53d8269d5e0907aefe30a287125ea8f940b32 /telephony/java
parente980914d426d6d1edcefda0025f445b58884ff17 (diff)
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
Diffstat (limited to 'telephony/java')
-rw-r--r--telephony/java/android/telephony/ims/stub/ImsEcbmImplBase.java8
-rw-r--r--telephony/java/android/telephony/ims/stub/ImsMultiEndpointImplBase.java4
-rw-r--r--telephony/java/android/telephony/ims/stub/ImsUtImplBase.java7
3 files changed, 17 insertions, 2 deletions
diff --git a/telephony/java/android/telephony/ims/stub/ImsEcbmImplBase.java b/telephony/java/android/telephony/ims/stub/ImsEcbmImplBase.java
index 2e35d27614d1..5f8e93d02a00 100644
--- a/telephony/java/android/telephony/ims/stub/ImsEcbmImplBase.java
+++ b/telephony/java/android/telephony/ims/stub/ImsEcbmImplBase.java
@@ -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) {
diff --git a/telephony/java/android/telephony/ims/stub/ImsMultiEndpointImplBase.java b/telephony/java/android/telephony/ims/stub/ImsMultiEndpointImplBase.java
index 555a47eb8200..8e961acc7b36 100644
--- a/telephony/java/android/telephony/ims/stub/ImsMultiEndpointImplBase.java
+++ b/telephony/java/android/telephony/ims/stub/ImsMultiEndpointImplBase.java
@@ -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;
diff --git a/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java b/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java
index eef4fcaceeaf..83b89aa8e814 100644
--- a/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java
+++ b/telephony/java/android/telephony/ims/stub/ImsUtImplBase.java
@@ -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;