From 5fa39ffd174fcfbb41c426ff41bbe131173721f5 Mon Sep 17 00:00:00 2001 From: Sarah Chin Date: Sat, 13 Mar 2021 02:17:19 -0800 Subject: [PATCH] setCdmaSubscription/RoamingMode returns when not CDMA NoOp instead of return ISE when the device is not CDMA capable. Test: atest TelephonyManagerTest Fix: 175665470 Change-Id: I36d69f4bf337ef9c102327bfe87752c56847af87 Merged-In: I36d69f4bf337ef9c102327bfe87752c56847af87 --- telephony/java/android/telephony/TelephonyManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 1860ecb7c2747..a6c52c48b8030 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -9687,7 +9687,8 @@ public class TelephonyManager { } /** - * Sets the roaming mode for CDMA phone to the given mode {@code mode}. + * Sets the roaming mode for CDMA phone to the given mode {@code mode}. If the phone is not + * CDMA capable, this method does nothing. * *

If this object has been created with {@link #createForSubscriptionId}, applies to the * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()} @@ -9710,6 +9711,7 @@ public class TelephonyManager { @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCdmaRoamingMode(@CdmaRoamingMode int mode) { + if (getPhoneType() != PHONE_TYPE_CDMA) return; try { ITelephony telephony = getITelephony(); if (telephony != null) { @@ -9790,7 +9792,8 @@ public class TelephonyManager { } /** - * Sets the subscription mode for CDMA phone to the given mode {@code mode}. + * Sets the subscription mode for CDMA phone to the given mode {@code mode}. If the phone is not + * CDMA capable, this method does nothing. * * @param mode CDMA subscription mode. * @throws SecurityException if the caller does not have the permission. @@ -9809,6 +9812,7 @@ public class TelephonyManager { @SystemApi @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCdmaSubscriptionMode(@CdmaSubscription int mode) { + if (getPhoneType() != PHONE_TYPE_CDMA) return; try { ITelephony telephony = getITelephony(); if (telephony != null) {