diff options
author | Brad Ebinger <breadley@google.com> | 2022-02-15 12:49:06 -0800 |
---|---|---|
committer | Brad Ebinger <breadley@google.com> | 2022-02-16 14:09:55 -0800 |
commit | 460cb45f32b7657129737c0fd133210dbf4364df (patch) | |
tree | 505348be6d2aa73661e83a6ad734090e2e22a4c3 /src/java | |
parent | 0c31ace7e9099710c4353b7d3203013f21c2ee6f (diff) | |
download | ims-460cb45f32b7657129737c0fd133210dbf4364df.tar.gz |
Throw IllegalStateException when IMS is not ready for callback registration
Simulate existing behavior for when IMS is not ready by throwing an
IllegalStateException until IMS callbacks can be registered. This will
ensure there is no way that a callback can be registered and then removed
invisibly once the IMS stack catches up to the state of telephony.
Bug: 219529364
Test: atest FrameworksTelephonyTests; manual
Change-Id: Ic0e1ea2c9ab81dd9c7bb99825be317f8703a5f67
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/com/android/ims/ImsCallbackAdapterManager.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/java/com/android/ims/ImsCallbackAdapterManager.java b/src/java/com/android/ims/ImsCallbackAdapterManager.java index 08ca1c3e..931ce579 100644 --- a/src/java/com/android/ims/ImsCallbackAdapterManager.java +++ b/src/java/com/android/ims/ImsCallbackAdapterManager.java @@ -18,14 +18,10 @@ package com.android.ims; import android.content.Context; import android.os.IInterface; -import android.os.Looper; import android.os.RemoteCallbackList; import android.telephony.SubscriptionManager; import android.util.Log; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; public abstract class ImsCallbackAdapterManager<T extends IInterface> { private static final String TAG = "ImsCallbackAM"; @@ -67,10 +63,15 @@ public abstract class ImsCallbackAdapterManager<T extends IInterface> { } if (mSubId != subId) { // In some cases, telephony has changed sub id and IMS is still catching up to the - // state change. Since some devices do not check for IMS READY state before adding - // callbacks, still allow this condition. + // state change. Ensure that the device does not try to register a callback on an + // inactive subscription, because this can cause a condition where we remove the + // callback invisibly when the new subscription loads. Instead, simulate the existing + // IllegalStateException that happens when the ImsService is not ready/active for + // backwards compatibility. Log.w(TAG + " [" + mSlotId + ", " + mSubId + "]", "add callback: inactive" + " subID detected: " + subId); + throw new IllegalStateException("ImsService is not available for the subscription " + + "specified."); } synchronized (mLock) { addCallback(localCallback); |