OSDN Git Service

Replace usages of ShortNumberUtil with ShortNumberInfo
authorPaul Duffin <paulduffin@google.com>
Tue, 9 Feb 2016 16:40:53 +0000 (16:40 +0000)
committerPaul Duffin <paulduffin@google.com>
Tue, 9 Feb 2016 16:40:53 +0000 (16:40 +0000)
The ShortNumberInfo class appears to support the exact same
methods as the ShortNumberUtil class (at least in terms of the
methods used by this project) but is a singleton and so
instances cannot be created directly but instead must be
retrieved using the static getInstance() method.

The ShortNumberUtil class was deprecated in version 5.8 and
removed in 7.2.3 of libphonenumber. This change is required in
order to allow libphonenumber to be upgraded to 7.2.4.

Bug: 26975810
Change-Id: Ide40c65d12cb44453f84600fc4b5ad1ee1088470

telephony/java/android/telephony/PhoneNumberUtils.java

index b430340..6ca9a15 100644 (file)
@@ -20,7 +20,7 @@ import com.android.i18n.phonenumbers.NumberParseException;
 import com.android.i18n.phonenumbers.PhoneNumberUtil;
 import com.android.i18n.phonenumbers.PhoneNumberUtil.PhoneNumberFormat;
 import com.android.i18n.phonenumbers.Phonenumber.PhoneNumber;
-import com.android.i18n.phonenumbers.ShortNumberUtil;
+import com.android.i18n.phonenumbers.ShortNumberInfo;
 
 import android.content.Context;
 import android.content.Intent;
@@ -1918,11 +1918,11 @@ public class PhoneNumberUtils
 
         // No ecclist system property, so use our own list.
         if (defaultCountryIso != null) {
-            ShortNumberUtil util = new ShortNumberUtil();
+            ShortNumberInfo info = ShortNumberInfo.getInstance();
             if (useExactMatch) {
-                return util.isEmergencyNumber(number, defaultCountryIso);
+                return info.isEmergencyNumber(number, defaultCountryIso);
             } else {
-                return util.connectsToEmergencyNumber(number, defaultCountryIso);
+                return info.connectsToEmergencyNumber(number, defaultCountryIso);
             }
         }