diff options
author | Daniel Bright <dbright@google.com> | 2021-01-12 14:52:48 -0800 |
---|---|---|
committer | Daniel Bright <dbright@google.com> | 2021-01-20 11:24:01 -0800 |
commit | fd5dead7dee67c6f5dac5503f604c8e8ad6b8a97 (patch) | |
tree | d39495fd8738c4d56664d985ebe8f6e8e54e0a50 /telephony/java/android | |
parent | 2805c9959430d4b43cfc5c195e75b0b7422454af (diff) |
Make TelephonyManager#setImsRegistrationState multi-sim aware
Test: Ims call and unit tests
Bug: 167294783
Change-Id: Idb8f5ce7fe7592e94cb6202e7df133a354746388
Diffstat (limited to 'telephony/java/android')
-rw-r--r-- | telephony/java/android/telephony/TelephonyManager.java | 15 | ||||
-rw-r--r-- | telephony/java/android/telephony/ims/RegistrationManager.java | 17 |
2 files changed, 27 insertions, 5 deletions
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index f39ee095758c..5342456af652 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -7456,18 +7456,23 @@ public class TelephonyManager { } /** - * Set IMS registration state + * Set IMS registration state on all active subscriptions. + * <p/> + * Use {@link android.telephony.ims.stub.ImsRegistrationImplBase#onRegistered} and + * {@link android.telephony.ims.stub.ImsRegistrationImplBase#onDeregistered} to set Ims + * registration state instead. + * + * @param registered whether ims is registered * - * @param Registration state * @hide */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) - public void setImsRegistrationState(boolean registered) { + public void setImsRegistrationState(final boolean registered) { try { - ITelephony telephony = getITelephony(); + final ITelephony telephony = getITelephony(); if (telephony != null) telephony.setImsRegistrationState(registered); - } catch (RemoteException e) { + } catch (final RemoteException e) { } } diff --git a/telephony/java/android/telephony/ims/RegistrationManager.java b/telephony/java/android/telephony/ims/RegistrationManager.java index e085dec10546..2c75368b86bf 100644 --- a/telephony/java/android/telephony/ims/RegistrationManager.java +++ b/telephony/java/android/telephony/ims/RegistrationManager.java @@ -25,6 +25,7 @@ import android.annotation.RequiresPermission; import android.net.Uri; import android.os.Binder; import android.telephony.AccessNetworkConstants; +import android.telephony.NetworkRegistrationInfo; import android.telephony.ims.aidl.IImsRegistrationCallback; import android.telephony.ims.feature.ImsFeature; import android.telephony.ims.stub.ImsRegistrationImplBase; @@ -85,6 +86,22 @@ public interface RegistrationManager { AccessNetworkConstants.TRANSPORT_TYPE_WLAN); }}; + /** @hide */ + @NonNull + static String registrationStateToString( + final @NetworkRegistrationInfo.RegistrationState int value) { + switch (value) { + case REGISTRATION_STATE_NOT_REGISTERED: + return "REGISTRATION_STATE_NOT_REGISTERED"; + case REGISTRATION_STATE_REGISTERING: + return "REGISTRATION_STATE_REGISTERING"; + case REGISTRATION_STATE_REGISTERED: + return "REGISTRATION_STATE_REGISTERED"; + default: + return Integer.toString(value); + } + } + /** * Callback class for receiving IMS network Registration callback events. * @see #registerImsRegistrationCallback(Executor, RegistrationCallback) |