Fix case where empty numbers are shown as Voicemail.
There is a carrier config to remap invalid phone numbers to the word
"voicemail" in the voicemail settings screen. However, when the user has
NOT enabled one of the call forwarding options this will also remap to
"Voicemail". As a consequence when the user tries to initially set the
option on, the edit box is prepopulated with "Voicemail" instead of an
empty field.
Fixes: 273769275
Test: Manual live network testing; use carrier config override to enable
call_forwarding_map_non_number_to_voicemail_bool. Go to the call forward
settings and verify that "Voicemail" is not shown when you tap on an
inactive setting in order to activate it.
Change-Id: Ie1d1852f1a6de30becf83b7eea65c21d5fd435d4
diff --git a/src/com/android/phone/CallForwardEditPreference.java b/src/com/android/phone/CallForwardEditPreference.java
index 96915d4..d1c8303 100644
--- a/src/com/android/phone/CallForwardEditPreference.java
+++ b/src/com/android/phone/CallForwardEditPreference.java
@@ -210,8 +210,9 @@
// 3gpp spec. This can cause us to receive "numbers" that are sequences of letters. In this
// case, we must detect these series of characters and replace them with "Voicemail".
// PhoneNumberUtils#formatNumber returns null if the number is not valid.
- if (mReplaceInvalidCFNumber && (PhoneNumberUtils.formatNumber(callForwardInfo.number,
- getCurrentCountryIso()) == null)) {
+ if (mReplaceInvalidCFNumber && !TextUtils.isEmpty(callForwardInfo.number)
+ && (PhoneNumberUtils.formatNumber(callForwardInfo.number, getCurrentCountryIso())
+ == null)) {
callForwardInfo.number = getContext().getString(R.string.voicemail);
Log.i(LOG_TAG, "handleGetCFResponse: Overridding CF number");
}