Disable Call Forwarding option "When Unreachable" if configured
Read carrier config KEY_CALL_FORWARDING_WHEN_UNREACHABLE_SUPPORTED_BOOL.
Call Forwarding option "When Unreachable" in Call settings will be
disabled and greyed out if false.
This prevents unnecessary signaling for carriers where this option is
not supported by the network and prevents error dialog from being
displayed to the user.
Bug: 118861990
Test: atest TeleServiceTests
Change-Id: I9b03d7543572f8ba5482c7e6242d2ebd4617e5c5
diff --git a/src/com/android/phone/GsmUmtsCallForwardOptions.java b/src/com/android/phone/GsmUmtsCallForwardOptions.java
index b8ea8fd..10bd8d7 100644
--- a/src/com/android/phone/GsmUmtsCallForwardOptions.java
+++ b/src/com/android/phone/GsmUmtsCallForwardOptions.java
@@ -18,6 +18,7 @@
import java.util.ArrayList;
public class GsmUmtsCallForwardOptions extends TimeConsumingPreferenceActivity {
+ private static final boolean DBG = (PhoneGlobals.DBG_LEVEL >= 2);
private static final String LOG_TAG = "GsmUmtsCallForwardOptions";
private static final String NUM_PROJECTION[] = {
@@ -62,6 +63,7 @@
mPhone = mSubscriptionInfoHelper.getPhone();
PersistableBundle b = null;
+ boolean supportCFNRc = true;
if (mSubscriptionInfoHelper.hasSubId()) {
b = PhoneGlobals.getInstance().getCarrierConfigForSubId(
mSubscriptionInfoHelper.getSubId());
@@ -73,6 +75,8 @@
CarrierConfigManager.KEY_CALL_FORWARDING_MAP_NON_NUMBER_TO_VOICEMAIL_BOOL);
mCallForwardByUssd = b.getBoolean(
CarrierConfigManager.KEY_USE_CALL_FORWARDING_USSD_BOOL);
+ supportCFNRc = b.getBoolean(
+ CarrierConfigManager.KEY_CALL_FORWARDING_WHEN_UNREACHABLE_SUPPORTED_BOOL);
}
PreferenceScreen prefSet = getPreferenceScreen();
@@ -89,7 +93,16 @@
mPreferences.add(mButtonCFU);
mPreferences.add(mButtonCFB);
mPreferences.add(mButtonCFNRy);
- mPreferences.add(mButtonCFNRc);
+
+ if (supportCFNRc) {
+ mPreferences.add(mButtonCFNRc);
+ } else {
+ // When CFNRc is not supported, mButtonCFNRc is grayed out from the menu.
+ // Default state for the preferences in this PreferenceScreen is disabled.
+ // Only preferences listed in the ArrayList mPreferences will be enabled.
+ // By not adding mButtonCFNRc to mPreferences it will be kept disabled.
+ if (DBG) Log.d(LOG_TAG, "onCreate: CFNRc is not supported, grey out the item.");
+ }
if (mCallForwardByUssd) {
//the call forwarding ussd command's behavior is similar to the call forwarding when