Merge "Set CDMA roaming/subscription mode throws ISE if not CDMA" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9ad39e2bf5
@@ -10075,14 +10075,15 @@ public class TelephonyManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the roaming mode for CDMA phone to the given mode {@code mode}. If the phone is not
|
* Sets the roaming mode for CDMA phone to the given mode {@code mode}. If the phone is not
|
||||||
* CDMA capable, this method does nothing.
|
* CDMA capable, this method throws an IllegalStateException.
|
||||||
*
|
*
|
||||||
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
|
* <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
|
||||||
* given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
|
* given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
|
||||||
*
|
*
|
||||||
* @param mode CDMA roaming mode.
|
* @param mode CDMA roaming mode.
|
||||||
* @throws SecurityException if the caller does not have the permission.
|
* @throws SecurityException if the caller does not have the permission.
|
||||||
* @throws IllegalStateException if the Telephony process or radio is not currently available.
|
* @throws IllegalStateException if the Telephony process or radio is not currently available,
|
||||||
|
* the device is not CDMA capable, or the request fails.
|
||||||
*
|
*
|
||||||
* @see #CDMA_ROAMING_MODE_RADIO_DEFAULT
|
* @see #CDMA_ROAMING_MODE_RADIO_DEFAULT
|
||||||
* @see #CDMA_ROAMING_MODE_HOME
|
* @see #CDMA_ROAMING_MODE_HOME
|
||||||
@@ -10098,7 +10099,9 @@ public class TelephonyManager {
|
|||||||
@SystemApi
|
@SystemApi
|
||||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
public void setCdmaRoamingMode(@CdmaRoamingMode int mode) {
|
public void setCdmaRoamingMode(@CdmaRoamingMode int mode) {
|
||||||
if (getPhoneType() != PHONE_TYPE_CDMA) return;
|
if (getPhoneType() != PHONE_TYPE_CDMA) {
|
||||||
|
throw new IllegalStateException("Phone does not support CDMA.");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
@@ -10180,11 +10183,12 @@ public class TelephonyManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the subscription mode for CDMA phone to the given mode {@code mode}. If the phone is not
|
* Sets the subscription mode for CDMA phone to the given mode {@code mode}. If the phone is not
|
||||||
* CDMA capable, this method does nothing.
|
* CDMA capable, this method throws an IllegalStateException.
|
||||||
*
|
*
|
||||||
* @param mode CDMA subscription mode.
|
* @param mode CDMA subscription mode.
|
||||||
* @throws SecurityException if the caller does not have the permission.
|
* @throws SecurityException if the caller does not have the permission.
|
||||||
* @throws IllegalStateException if the Telephony process is not currently available.
|
* @throws IllegalStateException if the Telephony process or radio is not currently available,
|
||||||
|
* the device is not CDMA capable, or the request fails.
|
||||||
*
|
*
|
||||||
* @see #CDMA_SUBSCRIPTION_UNKNOWN
|
* @see #CDMA_SUBSCRIPTION_UNKNOWN
|
||||||
* @see #CDMA_SUBSCRIPTION_RUIM_SIM
|
* @see #CDMA_SUBSCRIPTION_RUIM_SIM
|
||||||
@@ -10199,7 +10203,9 @@ public class TelephonyManager {
|
|||||||
@SystemApi
|
@SystemApi
|
||||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
public void setCdmaSubscriptionMode(@CdmaSubscription int mode) {
|
public void setCdmaSubscriptionMode(@CdmaSubscription int mode) {
|
||||||
if (getPhoneType() != PHONE_TYPE_CDMA) return;
|
if (getPhoneType() != PHONE_TYPE_CDMA) {
|
||||||
|
throw new IllegalStateException("Phone does not support CDMA.");
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
ITelephony telephony = getITelephony();
|
ITelephony telephony = getITelephony();
|
||||||
if (telephony != null) {
|
if (telephony != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user