Loading src/java/com/android/internal/telephony/CallTracker.java +34 −28 Original line number Diff line number Diff line Loading @@ -16,10 +16,13 @@ package com.android.internal.telephony; import android.content.Context; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; import android.os.PersistableBundle; import android.os.SystemProperties; import android.telephony.CarrierConfigManager; import android.text.TextUtils; import java.io.FileDescriptor; Loading Loading @@ -203,8 +206,20 @@ public abstract class CallTracker extends Handler { if (dialNumber == null) { return dialNumber; } String[] convertMaps = phone.getContext().getResources().getStringArray( com.android.internal.R.array.dial_string_replace); String[] convertMaps = null; CarrierConfigManager configManager = (CarrierConfigManager) phone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE); PersistableBundle bundle = configManager.getConfig(); if (bundle != null) { convertMaps = bundle.getStringArray(CarrierConfigManager.KEY_DIAL_STRING_REPLACE_STRING_ARRAY); } if (convertMaps == null) { // By default no replacement is necessary log("convertNumberIfNecessary convertMaps is null"); return dialNumber; } log("convertNumberIfNecessary Roaming" + " convertMaps.length " + convertMaps.length + " dialNumber.length() " + dialNumber.length()); Loading @@ -214,39 +229,30 @@ public abstract class CallTracker extends Handler { } String[] entry; String[] tmpArray; String outNumber = ""; boolean needConvert = false; for(String convertMap : convertMaps) { log("convertNumberIfNecessary: " + convertMap); // entry format is "dialStringToReplace:dialStringReplacement" entry = convertMap.split(":"); if (entry.length > 1) { tmpArray = entry[1].split(","); if (!TextUtils.isEmpty(entry[0]) && dialNumber.equals(entry[0])) { if (tmpArray.length >= 2 && !TextUtils.isEmpty(tmpArray[1])) { if (compareGid1(phone, tmpArray[1])) { needConvert = true; } } else if (outNumber.isEmpty()) { needConvert = true; } if (needConvert) { if(!TextUtils.isEmpty(tmpArray[0]) && tmpArray[0].endsWith("MDN")) { if (entry != null && entry.length > 1) { String dsToReplace = entry[0]; String dsReplacement = entry[1]; if (!TextUtils.isEmpty(dsToReplace) && dialNumber.equals(dsToReplace)) { // Needs to be converted if (!TextUtils.isEmpty(dsReplacement) && dsReplacement.endsWith("MDN")) { String mdn = phone.getLine1Number(); if (!TextUtils.isEmpty(mdn)) { if (mdn.startsWith("+")) { outNumber = mdn; } else { outNumber = tmpArray[0].substring(0, tmpArray[0].length() -3) outNumber = dsReplacement.substring(0, dsReplacement.length() -3) + mdn; } } } else { outNumber = tmpArray[0]; } needConvert = false; outNumber = dsReplacement; } break; } } } Loading tests/telephonytests/src/com/android/internal/telephony/GsmCdmaCallTrackerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.internal.telephony; import android.os.HandlerThread; import android.os.SystemProperties; import android.os.PersistableBundle; import android.telephony.CarrierConfigManager; import android.telephony.DisconnectCause; import android.telephony.PhoneNumberUtils; import android.telephony.ServiceState; Loading Loading @@ -69,8 +71,6 @@ public class GsmCdmaCallTrackerTest extends TelephonyTest { super.setUp(this.getClass().getSimpleName()); mSimulatedCommands.setRadioPower(true, null); mPhone.mCi = this.mSimulatedCommands; mContextFixture.putStringArrayResource(com.android.internal.R.array.dial_string_replace, new String[]{}); new GsmCdmaCTHandlerThread(TAG).start(); Loading Loading
src/java/com/android/internal/telephony/CallTracker.java +34 −28 Original line number Diff line number Diff line Loading @@ -16,10 +16,13 @@ package com.android.internal.telephony; import android.content.Context; import android.os.AsyncResult; import android.os.Handler; import android.os.Message; import android.os.PersistableBundle; import android.os.SystemProperties; import android.telephony.CarrierConfigManager; import android.text.TextUtils; import java.io.FileDescriptor; Loading Loading @@ -203,8 +206,20 @@ public abstract class CallTracker extends Handler { if (dialNumber == null) { return dialNumber; } String[] convertMaps = phone.getContext().getResources().getStringArray( com.android.internal.R.array.dial_string_replace); String[] convertMaps = null; CarrierConfigManager configManager = (CarrierConfigManager) phone.getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE); PersistableBundle bundle = configManager.getConfig(); if (bundle != null) { convertMaps = bundle.getStringArray(CarrierConfigManager.KEY_DIAL_STRING_REPLACE_STRING_ARRAY); } if (convertMaps == null) { // By default no replacement is necessary log("convertNumberIfNecessary convertMaps is null"); return dialNumber; } log("convertNumberIfNecessary Roaming" + " convertMaps.length " + convertMaps.length + " dialNumber.length() " + dialNumber.length()); Loading @@ -214,39 +229,30 @@ public abstract class CallTracker extends Handler { } String[] entry; String[] tmpArray; String outNumber = ""; boolean needConvert = false; for(String convertMap : convertMaps) { log("convertNumberIfNecessary: " + convertMap); // entry format is "dialStringToReplace:dialStringReplacement" entry = convertMap.split(":"); if (entry.length > 1) { tmpArray = entry[1].split(","); if (!TextUtils.isEmpty(entry[0]) && dialNumber.equals(entry[0])) { if (tmpArray.length >= 2 && !TextUtils.isEmpty(tmpArray[1])) { if (compareGid1(phone, tmpArray[1])) { needConvert = true; } } else if (outNumber.isEmpty()) { needConvert = true; } if (needConvert) { if(!TextUtils.isEmpty(tmpArray[0]) && tmpArray[0].endsWith("MDN")) { if (entry != null && entry.length > 1) { String dsToReplace = entry[0]; String dsReplacement = entry[1]; if (!TextUtils.isEmpty(dsToReplace) && dialNumber.equals(dsToReplace)) { // Needs to be converted if (!TextUtils.isEmpty(dsReplacement) && dsReplacement.endsWith("MDN")) { String mdn = phone.getLine1Number(); if (!TextUtils.isEmpty(mdn)) { if (mdn.startsWith("+")) { outNumber = mdn; } else { outNumber = tmpArray[0].substring(0, tmpArray[0].length() -3) outNumber = dsReplacement.substring(0, dsReplacement.length() -3) + mdn; } } } else { outNumber = tmpArray[0]; } needConvert = false; outNumber = dsReplacement; } break; } } } Loading
tests/telephonytests/src/com/android/internal/telephony/GsmCdmaCallTrackerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.internal.telephony; import android.os.HandlerThread; import android.os.SystemProperties; import android.os.PersistableBundle; import android.telephony.CarrierConfigManager; import android.telephony.DisconnectCause; import android.telephony.PhoneNumberUtils; import android.telephony.ServiceState; Loading Loading @@ -69,8 +71,6 @@ public class GsmCdmaCallTrackerTest extends TelephonyTest { super.setUp(this.getClass().getSimpleName()); mSimulatedCommands.setRadioPower(true, null); mPhone.mCi = this.mSimulatedCommands; mContextFixture.putStringArrayResource(com.android.internal.R.array.dial_string_replace, new String[]{}); new GsmCdmaCTHandlerThread(TAG).start(); Loading