Merge "Make TelephonyManager#setImsRegistrationState multi-sim aware"

This commit is contained in:
Daniel Bright
2021-01-21 04:10:27 +00:00
committed by Gerrit Code Review
2 changed files with 27 additions and 5 deletions

View File

@@ -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 * @hide
*/ */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public void setImsRegistrationState(boolean registered) { public void setImsRegistrationState(final boolean registered) {
try { try {
ITelephony telephony = getITelephony(); final ITelephony telephony = getITelephony();
if (telephony != null) if (telephony != null)
telephony.setImsRegistrationState(registered); telephony.setImsRegistrationState(registered);
} catch (RemoteException e) { } catch (final RemoteException e) {
} }
} }

View File

@@ -25,6 +25,7 @@ import android.annotation.RequiresPermission;
import android.net.Uri; import android.net.Uri;
import android.os.Binder; import android.os.Binder;
import android.telephony.AccessNetworkConstants; import android.telephony.AccessNetworkConstants;
import android.telephony.NetworkRegistrationInfo;
import android.telephony.ims.aidl.IImsRegistrationCallback; import android.telephony.ims.aidl.IImsRegistrationCallback;
import android.telephony.ims.feature.ImsFeature; import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase; import android.telephony.ims.stub.ImsRegistrationImplBase;
@@ -85,6 +86,22 @@ public interface RegistrationManager {
AccessNetworkConstants.TRANSPORT_TYPE_WLAN); 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. * Callback class for receiving IMS network Registration callback events.
* @see #registerImsRegistrationCallback(Executor, RegistrationCallback) * @see #registerImsRegistrationCallback(Executor, RegistrationCallback)