Merge "SystemAPI for ACTION_SMS_EMERGENCY_CB_RECEIVED intent"
diff --git a/Android.bp b/Android.bp
index a9e4cd2..a81158d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -22,7 +22,6 @@
         "telephony-common",
         "voip-common",
         "ims-common",
-        "org.apache.http.legacy",
         "libprotobuf-java-lite",
     ],
 
@@ -32,7 +31,6 @@
         "androidx.recyclerview_recyclerview",
         "androidx.legacy_legacy-preference-v14",
         "guava",
-        "volley",
         "android-support-annotations",
         "com.android.phone.common-lib",
     ],
@@ -78,4 +76,4 @@
     proto: {
         type: "lite",
     },
-}
\ No newline at end of file
+}
diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml
index 78a320d..e63e572 100644
--- a/res/values-da/strings.xml
+++ b/res/values-da/strings.xml
@@ -20,7 +20,7 @@
     <string name="phoneAppLabel" product="default" msgid="130465039375347763">"Opkaldstjenester"</string>
     <string name="emergencyDialerIconLabel" msgid="8668005772339436680">"Nødopkald"</string>
     <string name="phoneIconLabel" msgid="3015941229249651419">"Opkald"</string>
-    <string name="fdnListLabel" msgid="4119121875004244097">"Liste over numre til begrænset opkald"</string>
+    <string name="fdnListLabel" msgid="4119121875004244097">"Numre til begrænset opkald"</string>
     <string name="unknown" msgid="8279698889921830815">"Ukendt"</string>
     <string name="private_num" msgid="4487990167889159992">"Privat nummer"</string>
     <string name="payphone" msgid="7936735771836716941">"Mønttelefon"</string>
@@ -405,12 +405,12 @@
     <string name="carrier_settings_title" msgid="6292869148169850220">"Indst. for mobilselskab"</string>
     <string name="fdn" msgid="2545904344666098749">"Numre til begrænset opkald"</string>
     <string name="fdn_with_label" msgid="6412087553365709494">"Begrænset opkald (<xliff:g id="SUBSCRIPTIONLABEL">%s</xliff:g>)"</string>
-    <string name="manage_fdn_list" msgid="3341716430375195441">"Liste over numre til begrænset opkald"</string>
+    <string name="manage_fdn_list" msgid="3341716430375195441">"Numre til begrænset opkald"</string>
     <string name="fdn_list_with_label" msgid="1409655283510382556">"Numre til begrænset opkald (<xliff:g id="SUBSCRIPTIONLABEL">%s</xliff:g>)"</string>
     <string name="fdn_activation" msgid="2178637004710435895">"Aktivering af begrænset opkald"</string>
     <string name="fdn_enabled" msgid="7017355494808056447">"Numre til begrænset opkald er aktiveret"</string>
     <string name="fdn_disabled" msgid="6696468878037736600">"Numre til begrænset opkald er deaktiveret"</string>
-    <string name="enable_fdn" msgid="4830555730418033723">"Aktivér begrænsede opkald"</string>
+    <string name="enable_fdn" msgid="4830555730418033723">"Aktivér begrænset opkald"</string>
     <string name="disable_fdn" msgid="3918794950264647541">"Deaktiver begrænset opkald"</string>
     <string name="change_pin2" msgid="3110844547237754871">"Skift PIN2-kode"</string>
     <string name="enable_fdn_ok" msgid="5080925177369329827">"Deaktiver begrænset opkald"</string>
@@ -443,7 +443,7 @@
     <string name="deleting_fdn_contact" msgid="6872320570844460428">"Sletter nummer til begrænset opkald..."</string>
     <string name="fdn_contact_deleted" msgid="1680714996763848838">"Nummeret til begrænset opkald blev slettet."</string>
     <string name="pin2_invalid" msgid="2313954262684494442">"Nummeret til begrænset opkald blev ikke opdateret, fordi du har indtastet en forkert pinkode."</string>
-    <string name="fdn_invalid_number" msgid="9067189814657840439">"FDN blev ikke opdateret, fordi antallet overstiger <xliff:g id="FDN_NUMBER_LIMIT_LENGTH">%d</xliff:g> cifre."</string>
+    <string name="fdn_invalid_number" msgid="9067189814657840439">"Nummeret til begrænset opkald blev ikke opdateret, fordi nummeret er mere end <xliff:g id="FDN_NUMBER_LIMIT_LENGTH">%d</xliff:g> cifre."</string>
     <string name="pin2_or_fdn_invalid" msgid="7542639487955868181">"Nummeret til begrænset opkald blev ikke opdateret. PIN2-koden var forkert, eller telefonnummeret blev afvist."</string>
     <string name="fdn_failed" msgid="216592346853420250">"Handlingen mislykkedes."</string>
     <string name="simContacts_emptyLoading" msgid="4989040293858675483">"Læser fra SIM-kort ..."</string>
diff --git a/res/values-ky/strings.xml b/res/values-ky/strings.xml
index fcadd69..b9718b5 100644
--- a/res/values-ky/strings.xml
+++ b/res/values-ky/strings.xml
@@ -16,8 +16,7 @@
 
 <resources xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-    <!-- no translation found for phoneAppLabel (1916019789885839910) -->
-    <skip />
+    <string name="phoneAppLabel" product="tablet" msgid="1916019789885839910">"Мобилдик Интернет"</string>
     <string name="phoneAppLabel" product="default" msgid="130465039375347763">"Телефон кызматтары"</string>
     <string name="emergencyDialerIconLabel" msgid="8668005772339436680">"Өзгөчө кырдаалдагы тергич"</string>
     <string name="phoneIconLabel" msgid="3015941229249651419">"Телефон"</string>
@@ -290,8 +289,7 @@
     <string name="throttle_data_rate_reduced_subtext" msgid="8369839346277847725">"<xliff:g id="USED_0">%1$s</xliff:g> жогорку чегинен ашып кетти\nДайындардын ылдамдыгы <xliff:g id="USED_1">%2$d</xliff:g> кб/сек. болуп азайтылды"</string>
     <string name="throttle_time_frame_subtext" msgid="6462089615392402127">"Циклдин <xliff:g id="USED_0">%1$d</xliff:g>٪ аяктады\nКийинки период <xliff:g id="USED_1">%2$d</xliff:g> күндөн кийин башталат (<xliff:g id="USED_2">%3$s</xliff:g>)"</string>
     <string name="throttle_rate_subtext" msgid="7221971817325779535">"Эгер дайындарды колдонуу чегинен ашып кетсе, дайындардын ылдамдыгы <xliff:g id="USED">%1$d</xliff:g> кб/сек. болуп азайтылат"</string>
-    <!-- no translation found for throttle_help_subtext (2817114897095534807) -->
-    <skip />
+    <string name="throttle_help_subtext" msgid="2817114897095534807">"Операторуңуздун мобилдик тармак дайындарын пайдалануу саясаты тууралуу көбүрөөк маалымат"</string>
     <string name="cell_broadcast_sms" msgid="4053449797289031063">"Уюлдук жөнөтүү SMS\'и"</string>
     <string name="enable_disable_cell_bc_sms" msgid="4759958924031721350">"Уюлдук жөнөтүү SMS\'и"</string>
     <string name="cell_bc_sms_enable" msgid="2019708772024632073">"Уюлдук жөнөтүү SMS\'и иштетилген"</string>
@@ -505,8 +503,7 @@
     <string name="incall_error_power_off_wfc" msgid="9125661184694727052">"Чалуу үчүн учак режимин өчүрүңүз же зымсыз тармакка туташыңыз."</string>
     <string name="incall_error_ecm_emergency_only" msgid="5622379058883722080">"Кадимки шартта чалуу үчүн шашылыш кайра чалуу режиминен чыгыңыз."</string>
     <string name="incall_error_emergency_only" msgid="8786127461027964653">"Тармакта катталган эмес."</string>
-    <!-- no translation found for incall_error_out_of_service (1927265196942672791) -->
-    <skip />
+    <string name="incall_error_out_of_service" msgid="1927265196942672791">"Мобилдик тармак жок."</string>
     <string name="incall_error_out_of_service_wfc" msgid="4497663185857190885">"Мобилдик тармак жеткиликтүү эмес. Чалуу үчүн зымсыз тармакка туташыңыз."</string>
     <string name="incall_error_no_phone_number_supplied" msgid="8680831089508851894">"Чалуу үчүн, жарактуу номер киргизиңиз."</string>
     <string name="incall_error_call_failed" msgid="393508653582682539">"Чалынбай калды."</string>
diff --git a/res/values-zu/strings.xml b/res/values-zu/strings.xml
index bce5670..9a0f44d 100644
--- a/res/values-zu/strings.xml
+++ b/res/values-zu/strings.xml
@@ -260,10 +260,8 @@
     <string name="roaming_warning" msgid="7855681468067171971">"Ingahle uthole izindleko ezincane."</string>
     <string name="roaming_check_price_warning" msgid="8212484083990570215">"Hlola ngomhlinzeki wakho wenethiwekhi ukuze uthole intengo."</string>
     <string name="roaming_alert_title" msgid="5689615818220960940">"Vumela ukuhamba kwedatha?"</string>
-    <!-- no translation found for limited_sim_function_notification_title (612715399099846281) -->
-    <skip />
-    <!-- no translation found for limited_sim_function_with_phone_num_notification_message (5928988883403677610) -->
-    <skip />
+    <string name="limited_sim_function_notification_title" msgid="612715399099846281">"Ukusebenza okukhawulelwe kwe-SIM"</string>
+    <string name="limited_sim_function_with_phone_num_notification_message" msgid="5928988883403677610">"Amakholi e-<xliff:g id="CARRIER_NAME">%1$s</xliff:g> namasevisi edatha angavinjelwa kusetshenziswa u-<xliff:g id="PHONE_NUMBER">%2$s</xliff:g>."</string>
     <string name="limited_sim_function_notification_message" msgid="5338638075496721160">"Amakholi e-<xliff:g id="CARRIER_NAME">%1$s</xliff:g> namasevisi edatha angavinjelwa ngenkathi kusetshenziswa enye i-SIM."</string>
     <string name="data_usage_title" msgid="8438592133893837464">"Ukusetshenziswa kwedatha yohlelo lokusebenza"</string>
     <string name="data_usage_template" msgid="6287906680674061783">"<xliff:g id="ID_1">%1$s</xliff:g> kusetshenziswe idatha yeselula engu-<xliff:g id="ID_2">%2$s</xliff:g>"</string>
diff --git a/sip/res/values-ta/strings.xml b/sip/res/values-ta/strings.xml
index 3164536..0cb2b75 100644
--- a/sip/res/values-ta/strings.xml
+++ b/sip/res/values-ta/strings.xml
@@ -47,7 +47,7 @@
     <string name="registration_status_failed_try_later" msgid="7855389184910312091">"கணக்குப் பதிவு தோல்வி: (<xliff:g id="REGISTRATION_ERROR_MESSAGE">%s</xliff:g>); பிறகு முயலவும்"</string>
     <string name="registration_status_invalid_credentials" msgid="8896714049938660777">"கணக்குப் பதிவு தோல்வி: பயனர்பெயர் அல்லது கடவுச்சொல் தவறானது."</string>
     <string name="registration_status_server_unreachable" msgid="3832339558868965604">"கணக்குப் பதிவு தோல்வி: சேவையகப் பெயரைச் சரிபார்க்கவும்."</string>
-    <string name="third_party_account_summary" msgid="5918779106950859167">"தற்போது <xliff:g id="ACCOUNT_OWNER">%s</xliff:g> பயன்பாட்டினால் கணக்குப் பயன்படுத்தப்படுகிறது."</string>
+    <string name="third_party_account_summary" msgid="5918779106950859167">"தற்போது <xliff:g id="ACCOUNT_OWNER">%s</xliff:g> ஆப்ஸால் கணக்குப் பயன்படுத்தப்படுகிறது."</string>
     <string name="sip_edit_title" msgid="7438891546610820307">"SIP கணக்கு விவரங்கள்"</string>
     <string name="sip_edit_new_title" msgid="8394790068979636381">"SIP கணக்கு விவரங்கள்"</string>
     <string name="domain_address_title" msgid="8238078615181248579">"சேவையகம்"</string>
diff --git a/src/com/android/phone/ImsRcsController.java b/src/com/android/phone/ImsRcsController.java
new file mode 100644
index 0000000..d1ff56f
--- /dev/null
+++ b/src/com/android/phone/ImsRcsController.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.phone;
+
+import android.content.Context;
+import android.net.Uri;
+import android.os.ServiceManager;
+import android.telephony.ims.aidl.IImsCapabilityCallback;
+import android.telephony.ims.aidl.IImsRcsController;
+import android.telephony.ims.aidl.IRcsUceControllerCallback;
+import android.telephony.ims.feature.RcsFeature;
+import android.util.Log;
+
+import java.util.List;
+
+/**
+ * Implementation of the IImsRcsController interface.
+ */
+public class ImsRcsController extends IImsRcsController.Stub {
+    private static final String TAG = "ImsRcsController";
+
+    /** The singleton instance. */
+    private static ImsRcsController sInstance;
+
+    private PhoneGlobals mApp;
+
+    /**
+     * Initialize the singleton ImsRcsController instance.
+     * This is only done once, at startup, from PhoneApp.onCreate().
+     */
+    static ImsRcsController init(PhoneGlobals app) {
+        synchronized (ImsRcsController.class) {
+            if (sInstance == null) {
+                sInstance = new ImsRcsController(app);
+            } else {
+                Log.wtf(TAG, "init() called multiple times!  sInstance = " + sInstance);
+            }
+            return sInstance;
+        }
+    }
+
+    /** Private constructor; @see init() */
+    private ImsRcsController(PhoneGlobals app) {
+        Log.i(TAG, "ImsRcsController");
+        mApp = app;
+        ServiceManager.addService(Context.TELEPHONY_IMS_SERVICE, this);
+    }
+
+    @Override
+    public void registerRcsAvailabilityCallback(IImsCapabilityCallback c) {
+        enforceReadPrivilegedPermission("registerRcsAvailabilityCallback");
+    }
+
+    @Override
+    public void unregisterRcsAvailabilityCallback(IImsCapabilityCallback c) {
+        enforceReadPrivilegedPermission("unregisterRcsAvailabilityCallback");
+    }
+
+    @Override
+    public boolean isCapable(int subId,
+            @RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability) {
+        enforceReadPrivilegedPermission("isCapable");
+        return false;
+    }
+
+    @Override
+    public boolean isAvailable(int subId,
+            @RcsFeature.RcsImsCapabilities.RcsImsCapabilityFlag int capability) {
+        enforceReadPrivilegedPermission("isAvailable");
+        return false;
+    }
+
+    @Override
+    public void requestCapabilities(int subId, List<Uri> contactNumbers,
+            IRcsUceControllerCallback c) {
+        enforceReadPrivilegedPermission("requestCapabilities");
+    }
+
+    @Override
+    public int getUcePublishState(int subId) {
+        enforceReadPrivilegedPermission("getUcePublishState");
+        return -1;
+    }
+
+    @Override
+    public boolean isUceSettingEnabled(int subId) {
+        enforceReadPrivilegedPermission("isUceSettingEnabled");
+        return false;
+    }
+
+    @Override
+    public void setUceSettingEnabled(int subId, boolean isEnabled) {
+        enforceModifyPermission();
+    }
+
+    /**
+     * Make sure either called from same process as self (phone) or IPC caller has read privilege.
+     *
+     * @throws SecurityException if the caller does not have the required permission
+     */
+    private void enforceReadPrivilegedPermission(String message) {
+        mApp.enforceCallingOrSelfPermission(
+                android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, message);
+    }
+
+    /**
+     * Make sure the caller has the MODIFY_PHONE_STATE permission.
+     *
+     * @throws SecurityException if the caller does not have the required permission
+     */
+    private void enforceModifyPermission() {
+        mApp.enforceCallingOrSelfPermission(android.Manifest.permission.MODIFY_PHONE_STATE, null);
+    }
+}
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index 6b44c4f..90f408b 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -147,6 +147,7 @@
     CallerInfoCache callerInfoCache;
     NotificationMgr notificationMgr;
     public PhoneInterfaceManager phoneMgr;
+    public ImsRcsController imsRcsController;
     CarrierConfigLoader configLoader;
 
     private Phone phoneInEcm;
@@ -353,6 +354,8 @@
 
             phoneMgr = PhoneInterfaceManager.init(this);
 
+            imsRcsController = ImsRcsController.init(this);
+
             configLoader = CarrierConfigLoader.init(this);
 
             // Create the CallNotifier singleton, which handles
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 238e853..cc6925d 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -4911,7 +4911,7 @@
      * @hide
      */
     @Override
-    public boolean getTetherApnRequiredForSubscriber(int subId) {
+    public boolean isTetherApnRequiredForSubscriber(int subId) {
         enforceModifyPermission();
         final long identity = Binder.clearCallingIdentity();
         final Phone phone = getPhone(subId);
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index 6c3f0bf..3625733 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -43,10 +43,7 @@
 import android.widget.Toast;
 
 import com.android.internal.telephony.Call;
-import com.android.internal.telephony.CallManager;
 import com.android.internal.telephony.CallStateException;
-import android.telephony.CallerInfo;
-import android.telephony.CallerInfoAsyncQuery;
 import com.android.internal.telephony.Connection;
 import com.android.internal.telephony.IccCard;
 import com.android.internal.telephony.MmiCode;
@@ -54,10 +51,8 @@
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.PhoneFactory;
 import com.android.internal.telephony.TelephonyCapabilities;
-import com.android.phone.CallGatewayManager.RawGatewayInfo;
 import com.android.phone.settings.SuppServicesUiUtil;
 
-import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -131,79 +126,35 @@
     }
 
     /**
-     * @see placeCall below
-     */
-    public static int placeCall(Context context, Phone phone, String number, Uri contactRef,
-            boolean isEmergencyCall) {
-        return placeCall(context, phone, number, contactRef, isEmergencyCall,
-                CallGatewayManager.EMPTY_INFO, null);
-    }
-
-    /**
      * Dial the number using the phone passed in.
      *
-     * If the connection is establised, this method issues a sync call
-     * that may block to query the caller info.
-     * TODO: Change the logic to use the async query.
-     *
      * @param context To perform the CallerInfo query.
      * @param phone the Phone object.
      * @param number to be dialed as requested by the user. This is
      * NOT the phone number to connect to. It is used only to build the
      * call card and to update the call log. See above for restrictions.
-     * @param contactRef that triggered the call. Typically a 'tel:'
-     * uri but can also be a 'content://contacts' one.
-     * @param isEmergencyCall indicates that whether or not this is an
-     * emergency call
-     * @param gatewayUri Is the address used to setup the connection, null
-     * if not using a gateway
-     * @param callGateway Class for setting gateway data on a successful call.
      *
      * @return either CALL_STATUS_DIALED or CALL_STATUS_FAILED
      */
-    public static int placeCall(Context context, Phone phone, String number, Uri contactRef,
-            boolean isEmergencyCall, RawGatewayInfo gatewayInfo, CallGatewayManager callGateway) {
-        final Uri gatewayUri = gatewayInfo.gatewayUri;
+    public static int placeOtaspCall(Context context, Phone phone, String number) {
+        final Uri gatewayUri = null;
 
         if (VDBG) {
             log("placeCall()... number: '" + number + "'"
-                    + ", GW:'" + gatewayUri + "'"
-                    + ", contactRef:" + contactRef
-                    + ", isEmergencyCall: " + isEmergencyCall);
+                    + ", GW:'" + gatewayUri + "'");
         } else {
             log("placeCall()... number: " + toLogSafePhoneNumber(number)
-                    + ", GW: " + (gatewayUri != null ? "non-null" : "null")
-                    + ", emergency? " + isEmergencyCall);
+                    + ", GW: " + (gatewayUri != null ? "non-null" : "null"));
         }
         final PhoneGlobals app = PhoneGlobals.getInstance();
 
         boolean useGateway = false;
-        if (null != gatewayUri &&
-            !isEmergencyCall &&
-            PhoneUtils.isRoutableViaGateway(number)) {  // Filter out MMI, OTA and other codes.
-            useGateway = true;
-        }
+        Uri contactRef = null;
 
         int status = CALL_STATUS_DIALED;
         Connection connection;
         String numberToDial;
-        if (useGateway) {
-            // TODO: 'tel' should be a constant defined in framework base
-            // somewhere (it is in webkit.)
-            if (null == gatewayUri || !PhoneAccount.SCHEME_TEL.equals(gatewayUri.getScheme())) {
-                Log.e(LOG_TAG, "Unsupported URL:" + gatewayUri);
-                return CALL_STATUS_FAILED;
-            }
-
-            // We can use getSchemeSpecificPart because we don't allow #
-            // in the gateway numbers (treated a fragment delim.) However
-            // if we allow more complex gateway numbers sequence (with
-            // passwords or whatnot) that use #, this may break.
-            // TODO: Need to support MMI codes.
-            numberToDial = gatewayUri.getSchemeSpecificPart();
-        } else {
-            numberToDial = number;
-        }
+        numberToDial = number;
 
         try {
             connection = app.mCM.dial(phone, numberToDial, VideoProfile.STATE_AUDIO_ONLY);
@@ -228,33 +179,6 @@
             if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
                 updateCdmaCallStateOnNewOutgoingCall(app, connection);
             }
-
-            if (gatewayUri == null) {
-                // phone.dial() succeeded: we're now in a normal phone call.
-                // attach the URI to the CallerInfo Object if it is there,
-                // otherwise just attach the Uri Reference.
-                // if the uri does not have a "content" scheme, then we treat
-                // it as if it does NOT have a unique reference.
-                String content = context.getContentResolver().SCHEME_CONTENT;
-                if ((contactRef != null) && (contactRef.getScheme().equals(content))) {
-                    Object userDataObject = connection.getUserData();
-                    if (userDataObject == null) {
-                        connection.setUserData(contactRef);
-                    } else {
-                        // TODO: This branch is dead code, we have
-                        // just created the connection which has
-                        // no user data (null) by default.
-                        if (userDataObject instanceof CallerInfo) {
-                        ((CallerInfo) userDataObject).contactRefUri = contactRef;
-                        } else {
-                        ((CallerInfoToken) userDataObject).currentInfo.contactRefUri =
-                            contactRef;
-                        }
-                    }
-                }
-            }
-
-            startGetCallerInfo(context, connection, null, null, gatewayInfo);
         }
 
         return status;
@@ -662,533 +586,12 @@
         return canceled;
     }
 
-    /**
-     * Returns the caller-id info corresponding to the specified Connection.
-     * (This is just a simple wrapper around CallerInfo.getCallerInfo(): we
-     * extract a phone number from the specified Connection, and feed that
-     * number into CallerInfo.getCallerInfo().)
-     *
-     * The returned CallerInfo may be null in certain error cases, like if the
-     * specified Connection was null, or if we weren't able to get a valid
-     * phone number from the Connection.
-     *
-     * Finally, if the getCallerInfo() call did succeed, we save the resulting
-     * CallerInfo object in the "userData" field of the Connection.
-     *
-     * NOTE: This API should be avoided, with preference given to the
-     * asynchronous startGetCallerInfo API.
-     */
-    static CallerInfo getCallerInfo(Context context, Connection c) {
-        CallerInfo info = null;
-
-        if (c != null) {
-            //See if there is a URI attached.  If there is, this means
-            //that there is no CallerInfo queried yet, so we'll need to
-            //replace the URI with a full CallerInfo object.
-            Object userDataObject = c.getUserData();
-            if (userDataObject instanceof Uri) {
-                info = CallerInfo.getCallerInfo(context, (Uri) userDataObject);
-                if (info != null) {
-                    c.setUserData(info);
-                }
-            } else {
-                if (userDataObject instanceof CallerInfoToken) {
-                    //temporary result, while query is running
-                    info = ((CallerInfoToken) userDataObject).currentInfo;
-                } else {
-                    //final query result
-                    info = (CallerInfo) userDataObject;
-                }
-                if (info == null) {
-                    // No URI, or Existing CallerInfo, so we'll have to make do with
-                    // querying a new CallerInfo using the connection's phone number.
-                    String number = c.getAddress();
-
-                    if (DBG) log("getCallerInfo: number = " + toLogSafePhoneNumber(number));
-
-                    if (!TextUtils.isEmpty(number)) {
-                        info = CallerInfo.getCallerInfo(context, number);
-                        if (info != null) {
-                            c.setUserData(info);
-                        }
-                    }
-                }
-            }
-        }
-        return info;
-    }
-
-    /**
-     * Class returned by the startGetCallerInfo call to package a temporary
-     * CallerInfo Object, to be superceded by the CallerInfo Object passed
-     * into the listener when the query with token mAsyncQueryToken is complete.
-     */
-    public static class CallerInfoToken {
-        /**indicates that there will no longer be updates to this request.*/
-        public boolean isFinal;
-
-        public CallerInfo currentInfo;
-        public CallerInfoAsyncQuery asyncQuery;
-    }
-
-    /**
-     * place a temporary callerinfo object in the hands of the caller and notify
-     * caller when the actual query is done.
-     */
-    static CallerInfoToken startGetCallerInfo(Context context, Connection c,
-            CallerInfoAsyncQuery.OnQueryCompleteListener listener, Object cookie,
-            RawGatewayInfo info) {
-        CallerInfoToken cit;
-
-        if (c == null) {
-            //TODO: perhaps throw an exception here.
-            cit = new CallerInfoToken();
-            cit.asyncQuery = null;
-            return cit;
-        }
-
-        Object userDataObject = c.getUserData();
-
-        // There are now 3 states for the Connection's userData object:
-        //
-        //   (1) Uri - query has not been executed yet
-        //
-        //   (2) CallerInfoToken - query is executing, but has not completed.
-        //
-        //   (3) CallerInfo - query has executed.
-        //
-        // In each case we have slightly different behaviour:
-        //   1. If the query has not been executed yet (Uri or null), we start
-        //      query execution asynchronously, and note it by attaching a
-        //      CallerInfoToken as the userData.
-        //   2. If the query is executing (CallerInfoToken), we've essentially
-        //      reached a state where we've received multiple requests for the
-        //      same callerInfo.  That means that once the query is complete,
-        //      we'll need to execute the additional listener requested.
-        //   3. If the query has already been executed (CallerInfo), we just
-        //      return the CallerInfo object as expected.
-        //   4. Regarding isFinal - there are cases where the CallerInfo object
-        //      will not be attached, like when the number is empty (caller id
-        //      blocking).  This flag is used to indicate that the
-        //      CallerInfoToken object is going to be permanent since no
-        //      query results will be returned.  In the case where a query
-        //      has been completed, this flag is used to indicate to the caller
-        //      that the data will not be updated since it is valid.
-        //
-        //      Note: For the case where a number is NOT retrievable, we leave
-        //      the CallerInfo as null in the CallerInfoToken.  This is
-        //      something of a departure from the original code, since the old
-        //      code manufactured a CallerInfo object regardless of the query
-        //      outcome.  From now on, we will append an empty CallerInfo
-        //      object, to mirror previous behaviour, and to avoid Null Pointer
-        //      Exceptions.
-
-        if (userDataObject instanceof Uri) {
-            // State (1): query has not been executed yet
-
-            //create a dummy callerinfo, populate with what we know from URI.
-            cit = new CallerInfoToken();
-            cit.currentInfo = new CallerInfo();
-            cit.asyncQuery = CallerInfoAsyncQuery.startQuery(QUERY_TOKEN, context,
-                    (Uri) userDataObject, sCallerInfoQueryListener, c);
-            cit.asyncQuery.addQueryListener(QUERY_TOKEN, listener, cookie);
-            cit.isFinal = false;
-
-            c.setUserData(cit);
-
-            if (DBG) log("startGetCallerInfo: query based on Uri: " + userDataObject);
-
-        } else if (userDataObject == null) {
-            // No URI, or Existing CallerInfo, so we'll have to make do with
-            // querying a new CallerInfo using the connection's phone number.
-            String number = c.getAddress();
-
-            if (info != null && info != CallGatewayManager.EMPTY_INFO) {
-                // Gateway number, the connection number is actually the gateway number.
-                // need to lookup via dialed number.
-                number = info.trueNumber;
-            }
-
-            if (DBG) {
-                log("PhoneUtils.startGetCallerInfo: new query for phone number...");
-                log("- number (address): " + toLogSafePhoneNumber(number));
-                log("- c: " + c);
-                log("- phone: " + c.getCall().getPhone());
-                int phoneType = c.getCall().getPhone().getPhoneType();
-                log("- phoneType: " + phoneType);
-                switch (phoneType) {
-                    case PhoneConstants.PHONE_TYPE_NONE: log("  ==> PHONE_TYPE_NONE"); break;
-                    case PhoneConstants.PHONE_TYPE_GSM: log("  ==> PHONE_TYPE_GSM"); break;
-                    case PhoneConstants.PHONE_TYPE_IMS: log("  ==> PHONE_TYPE_IMS"); break;
-                    case PhoneConstants.PHONE_TYPE_CDMA: log("  ==> PHONE_TYPE_CDMA"); break;
-                    case PhoneConstants.PHONE_TYPE_SIP: log("  ==> PHONE_TYPE_SIP"); break;
-                    case PhoneConstants.PHONE_TYPE_THIRD_PARTY:
-                        log("  ==> PHONE_TYPE_THIRD_PARTY");
-                        break;
-                    default: log("  ==> Unknown phone type"); break;
-                }
-            }
-
-            cit = new CallerInfoToken();
-            cit.currentInfo = new CallerInfo();
-
-            // Store CNAP information retrieved from the Connection (we want to do this
-            // here regardless of whether the number is empty or not).
-            cit.currentInfo.cnapName =  c.getCnapName();
-            cit.currentInfo.setName(cit.currentInfo.cnapName); // This can still get overwritten
-                                                             // by ContactInfo later
-            cit.currentInfo.numberPresentation = c.getNumberPresentation();
-            cit.currentInfo.namePresentation = c.getCnapNamePresentation();
-
-            if (VDBG) {
-                log("startGetCallerInfo: number = " + number);
-                log("startGetCallerInfo: CNAP Info from FW(1): name="
-                    + cit.currentInfo.cnapName
-                    + ", Name/Number Pres=" + cit.currentInfo.numberPresentation);
-            }
-
-            // handling case where number is null (caller id hidden) as well.
-            if (!TextUtils.isEmpty(number)) {
-                // Check for special CNAP cases and modify the CallerInfo accordingly
-                // to be sure we keep the right information to display/log later
-                number = modifyForSpecialCnapCases(context, cit.currentInfo, number,
-                        cit.currentInfo.numberPresentation);
-
-                cit.currentInfo.setPhoneNumber(number);
-                // For scenarios where we may receive a valid number from the network but a
-                // restricted/unavailable presentation, we do not want to perform a contact query
-                // (see note on isFinal above). So we set isFinal to true here as well.
-                if (cit.currentInfo.numberPresentation != PhoneConstants.PRESENTATION_ALLOWED) {
-                    cit.isFinal = true;
-                } else {
-                    if (DBG) log("==> Actually starting CallerInfoAsyncQuery.startQuery()...");
-                    cit.asyncQuery = CallerInfoAsyncQuery.startQuery(QUERY_TOKEN, context,
-                            number, sCallerInfoQueryListener, c);
-                    cit.asyncQuery.addQueryListener(QUERY_TOKEN, listener, cookie);
-                    cit.isFinal = false;
-                }
-            } else {
-                // This is the case where we are querying on a number that
-                // is null or empty, like a caller whose caller id is
-                // blocked or empty (CLIR).  The previous behaviour was to
-                // throw a null CallerInfo object back to the user, but
-                // this departure is somewhat cleaner.
-                if (DBG) log("startGetCallerInfo: No query to start, send trivial reply.");
-                cit.isFinal = true; // please see note on isFinal, above.
-            }
-
-            c.setUserData(cit);
-
-            if (DBG) {
-                log("startGetCallerInfo: query based on number: " + toLogSafePhoneNumber(number));
-            }
-
-        } else if (userDataObject instanceof CallerInfoToken) {
-            // State (2): query is executing, but has not completed.
-
-            // just tack on this listener to the queue.
-            cit = (CallerInfoToken) userDataObject;
-
-            // handling case where number is null (caller id hidden) as well.
-            if (cit.asyncQuery != null) {
-                cit.asyncQuery.addQueryListener(QUERY_TOKEN, listener, cookie);
-
-                if (DBG) log("startGetCallerInfo: query already running, adding listener: " +
-                        listener.getClass().toString());
-            } else {
-                // handling case where number/name gets updated later on by the network
-                String updatedNumber = c.getAddress();
-
-                if (info != null) {
-                    // Gateway number, the connection number is actually the gateway number.
-                    // need to lookup via dialed number.
-                    updatedNumber = info.trueNumber;
-                }
-
-                if (DBG) {
-                    log("startGetCallerInfo: updatedNumber initially = "
-                            + toLogSafePhoneNumber(updatedNumber));
-                }
-                if (!TextUtils.isEmpty(updatedNumber)) {
-                    // Store CNAP information retrieved from the Connection
-                    cit.currentInfo.cnapName =  c.getCnapName();
-                    // This can still get overwritten by ContactInfo
-                    cit.currentInfo.setName(cit.currentInfo.cnapName);
-                    cit.currentInfo.numberPresentation = c.getNumberPresentation();
-                    cit.currentInfo.namePresentation = c.getCnapNamePresentation();
-
-                    updatedNumber = modifyForSpecialCnapCases(context, cit.currentInfo,
-                            updatedNumber, cit.currentInfo.numberPresentation);
-
-                    cit.currentInfo.setPhoneNumber(updatedNumber);
-                    if (DBG) {
-                        log("startGetCallerInfo: updatedNumber="
-                                + toLogSafePhoneNumber(updatedNumber));
-                    }
-                    if (VDBG) {
-                        log("startGetCallerInfo: CNAP Info from FW(2): name="
-                                + cit.currentInfo.cnapName
-                                + ", Name/Number Pres=" + cit.currentInfo.numberPresentation);
-                    } else if (DBG) {
-                        log("startGetCallerInfo: CNAP Info from FW(2)");
-                    }
-                    // For scenarios where we may receive a valid number from the network but a
-                    // restricted/unavailable presentation, we do not want to perform a contact query
-                    // (see note on isFinal above). So we set isFinal to true here as well.
-                    if (cit.currentInfo.numberPresentation != PhoneConstants.PRESENTATION_ALLOWED) {
-                        cit.isFinal = true;
-                    } else {
-                        cit.asyncQuery = CallerInfoAsyncQuery.startQuery(QUERY_TOKEN, context,
-                                updatedNumber, sCallerInfoQueryListener, c);
-                        cit.asyncQuery.addQueryListener(QUERY_TOKEN, listener, cookie);
-                        cit.isFinal = false;
-                    }
-                } else {
-                    if (DBG) log("startGetCallerInfo: No query to attach to, send trivial reply.");
-                    if (cit.currentInfo == null) {
-                        cit.currentInfo = new CallerInfo();
-                    }
-                    // Store CNAP information retrieved from the Connection
-                    cit.currentInfo.cnapName = c.getCnapName();  // This can still get
-                                                                 // overwritten by ContactInfo
-                    cit.currentInfo.setName(cit.currentInfo.cnapName);
-                    cit.currentInfo.numberPresentation = c.getNumberPresentation();
-                    cit.currentInfo.namePresentation = c.getCnapNamePresentation();
-
-                    if (VDBG) {
-                        log("startGetCallerInfo: CNAP Info from FW(3): name="
-                                + cit.currentInfo.cnapName
-                                + ", Name/Number Pres=" + cit.currentInfo.numberPresentation);
-                    } else if (DBG) {
-                        log("startGetCallerInfo: CNAP Info from FW(3)");
-                    }
-                    cit.isFinal = true; // please see note on isFinal, above.
-                }
-            }
-        } else {
-            // State (3): query is complete.
-
-            // The connection's userDataObject is a full-fledged
-            // CallerInfo instance.  Wrap it in a CallerInfoToken and
-            // return it to the user.
-
-            cit = new CallerInfoToken();
-            cit.currentInfo = (CallerInfo) userDataObject;
-            cit.asyncQuery = null;
-            cit.isFinal = true;
-            // since the query is already done, call the listener.
-            if (DBG) log("startGetCallerInfo: query already done, returning CallerInfo");
-            if (DBG) log("==> cit.currentInfo = " + cit.currentInfo);
-        }
-        return cit;
-    }
-
-    /**
-     * Static CallerInfoAsyncQuery.OnQueryCompleteListener instance that
-     * we use with all our CallerInfoAsyncQuery.startQuery() requests.
-     */
-    private static final int QUERY_TOKEN = -1;
-    static CallerInfoAsyncQuery.OnQueryCompleteListener sCallerInfoQueryListener =
-        new CallerInfoAsyncQuery.OnQueryCompleteListener () {
-            /**
-             * When the query completes, we stash the resulting CallerInfo
-             * object away in the Connection's "userData" (where it will
-             * later be retrieved by the in-call UI.)
-             */
-            public void onQueryComplete(int token, Object cookie, CallerInfo ci) {
-                if (DBG) log("query complete, updating connection.userdata");
-                Connection conn = (Connection) cookie;
-
-                // Added a check if CallerInfo is coming from ContactInfo or from Connection.
-                // If no ContactInfo, then we want to use CNAP information coming from network
-                if (DBG) log("- onQueryComplete: CallerInfo:" + ci);
-                if (ci.contactExists || ci.isEmergencyNumber() || ci.isVoiceMailNumber()) {
-                    // If the number presentation has not been set by
-                    // the ContactInfo, use the one from the
-                    // connection.
-
-                    // TODO: Need a new util method to merge the info
-                    // from the Connection in a CallerInfo object.
-                    // Here 'ci' is a new CallerInfo instance read
-                    // from the DB. It has lost all the connection
-                    // info preset before the query (see PhoneUtils
-                    // line 1334). We should have a method to merge
-                    // back into this new instance the info from the
-                    // connection object not set by the DB. If the
-                    // Connection already has a CallerInfo instance in
-                    // userData, then we could use this instance to
-                    // fill 'ci' in. The same routine could be used in
-                    // PhoneUtils.
-                    if (0 == ci.numberPresentation) {
-                        ci.numberPresentation = conn.getNumberPresentation();
-                    }
-                } else {
-                    // No matching contact was found for this number.
-                    // Return a new CallerInfo based solely on the CNAP
-                    // information from the network.
-
-                    CallerInfo newCi = getCallerInfo(null, conn);
-
-                    // ...but copy over the (few) things we care about
-                    // from the original CallerInfo object:
-                    if (newCi != null) {
-                        newCi.setPhoneNumber(ci.getPhoneNumber()); // To get formatted phone number
-                        newCi.geoDescription = ci.geoDescription; // To get geo description string
-                        ci = newCi;
-                    }
-                }
-
-                if (DBG) log("==> Stashing CallerInfo " + ci + " into the connection...");
-                conn.setUserData(ci);
-            }
-        };
-
-
-    /**
-     * Returns a single "name" for the specified given a CallerInfo object.
-     * If the name is null, return defaultString as the default value, usually
-     * context.getString(R.string.unknown).
-     */
-    static String getCompactNameFromCallerInfo(CallerInfo ci, Context context) {
-        if (DBG) log("getCompactNameFromCallerInfo: info = " + ci);
-
-        String compactName = null;
-        if (ci != null) {
-            if (TextUtils.isEmpty(ci.getName())) {
-                // Perform any modifications for special CNAP cases to
-                // the phone number being displayed, if applicable.
-                compactName = modifyForSpecialCnapCases(context, ci, ci.getPhoneNumber(),
-                                                        ci.numberPresentation);
-            } else {
-                // Don't call modifyForSpecialCnapCases on regular name. See b/2160795.
-                compactName = ci.getName();
-            }
-        }
-
-        if ((compactName == null) || (TextUtils.isEmpty(compactName))) {
-            // If we're still null/empty here, then check if we have a presentation
-            // string that takes precedence that we could return, otherwise display
-            // "unknown" string.
-            if (ci != null && ci.numberPresentation == PhoneConstants.PRESENTATION_RESTRICTED) {
-                compactName = context.getString(R.string.private_num);
-            } else if (ci != null && ci.numberPresentation == PhoneConstants.PRESENTATION_PAYPHONE) {
-                compactName = context.getString(R.string.payphone);
-            } else {
-                compactName = context.getString(R.string.unknown);
-            }
-        }
-        if (VDBG) log("getCompactNameFromCallerInfo: compactName=" + compactName);
-        return compactName;
-    }
-
-    static boolean isInEmergencyCall(CallManager cm) {
-        Call fgCall = cm.getActiveFgCall();
-        // isIdle includes checks for the DISCONNECTING/DISCONNECTED state.
-        if(!fgCall.isIdle()) {
-            for (Connection cn : fgCall.getConnections()) {
-                if (PhoneNumberUtils.isLocalEmergencyNumber(PhoneGlobals.getInstance(),
-                        cn.getAddress())) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
 
     //
     // Misc UI policy helper functions
     //
 
     /**
-     * Based on the input CNAP number string,
-     * @return _RESTRICTED or _UNKNOWN for all the special CNAP strings.
-     * Otherwise, return CNAP_SPECIAL_CASE_NO.
-     */
-    private static int checkCnapSpecialCases(String n) {
-        if (n.equals("PRIVATE") ||
-                n.equals("P") ||
-                n.equals("RES")) {
-            if (DBG) log("checkCnapSpecialCases, PRIVATE string: " + n);
-            return PhoneConstants.PRESENTATION_RESTRICTED;
-        } else if (n.equals("UNAVAILABLE") ||
-                n.equals("UNKNOWN") ||
-                n.equals("UNA") ||
-                n.equals("U")) {
-            if (DBG) log("checkCnapSpecialCases, UNKNOWN string: " + n);
-            return PhoneConstants.PRESENTATION_UNKNOWN;
-        } else {
-            if (DBG) log("checkCnapSpecialCases, normal str. number: " + n);
-            return CNAP_SPECIAL_CASE_NO;
-        }
-    }
-
-    /**
-     * Handles certain "corner cases" for CNAP. When we receive weird phone numbers
-     * from the network to indicate different number presentations, convert them to
-     * expected number and presentation values within the CallerInfo object.
-     * @param number number we use to verify if we are in a corner case
-     * @param presentation presentation value used to verify if we are in a corner case
-     * @return the new String that should be used for the phone number
-     */
-    /* package */ static String modifyForSpecialCnapCases(Context context, CallerInfo ci,
-            String number, int presentation) {
-        // Obviously we return number if ci == null, but still return number if
-        // number == null, because in these cases the correct string will still be
-        // displayed/logged after this function returns based on the presentation value.
-        if (ci == null || number == null) return number;
-
-        if (DBG) {
-            log("modifyForSpecialCnapCases: initially, number="
-                    + toLogSafePhoneNumber(number)
-                    + ", presentation=" + presentation + " ci " + ci);
-        }
-
-        // "ABSENT NUMBER" is a possible value we could get from the network as the
-        // phone number, so if this happens, change it to "Unknown" in the CallerInfo
-        // and fix the presentation to be the same.
-        final String[] absentNumberValues =
-                context.getResources().getStringArray(R.array.absent_num);
-        if (Arrays.asList(absentNumberValues).contains(number)
-                && presentation == PhoneConstants.PRESENTATION_ALLOWED) {
-            number = context.getString(R.string.unknown);
-            ci.numberPresentation = PhoneConstants.PRESENTATION_UNKNOWN;
-        }
-
-        // Check for other special "corner cases" for CNAP and fix them similarly. Corner
-        // cases only apply if we received an allowed presentation from the network, so check
-        // if we think we have an allowed presentation, or if the CallerInfo presentation doesn't
-        // match the presentation passed in for verification (meaning we changed it previously
-        // because it's a corner case and we're being called from a different entry point).
-        if (ci.numberPresentation == PhoneConstants.PRESENTATION_ALLOWED
-                || (ci.numberPresentation != presentation
-                        && presentation == PhoneConstants.PRESENTATION_ALLOWED)) {
-            int cnapSpecialCase = checkCnapSpecialCases(number);
-            if (cnapSpecialCase != CNAP_SPECIAL_CASE_NO) {
-                // For all special strings, change number & numberPresentation.
-                if (cnapSpecialCase == PhoneConstants.PRESENTATION_RESTRICTED) {
-                    number = context.getString(R.string.private_num);
-                } else if (cnapSpecialCase == PhoneConstants.PRESENTATION_UNKNOWN) {
-                    number = context.getString(R.string.unknown);
-                }
-                if (DBG) {
-                    log("SpecialCnap: number=" + toLogSafePhoneNumber(number)
-                            + "; presentation now=" + cnapSpecialCase);
-                }
-                ci.numberPresentation = cnapSpecialCase;
-            }
-        }
-        if (DBG) {
-            log("modifyForSpecialCnapCases: returning number string="
-                    + toLogSafePhoneNumber(number));
-        }
-        return number;
-    }
-
-    //
-    // Support for 3rd party phone service providers.
-    //
-
-    /**
      * Check if a phone number can be route through a 3rd party
      * gateway. The number must be a global phone number in numerical
      * form (1-800-666-SEXY won't work).
diff --git a/src/com/android/phone/otasp/OtaspActivationService.java b/src/com/android/phone/otasp/OtaspActivationService.java
index 7490880..6ed2ea8 100644
--- a/src/com/android/phone/otasp/OtaspActivationService.java
+++ b/src/com/android/phone/otasp/OtaspActivationService.java
@@ -150,11 +150,9 @@
         mPhone.registerForCdmaOtaStatusChange(mHandler, EVENT_CDMA_PROVISION_STATUS_UPDATE, null);
         mPhone.registerForPreciseCallStateChanged(mHandler, EVENT_CALL_STATE_CHANGED, null);
         logd("startNonInteractiveOtasp: placing call to '" + OTASP_NUMBER + "'...");
-        int callStatus = PhoneUtils.placeCall(this,
+        int callStatus = PhoneUtils.placeOtaspCall(this,
                 getPhone(),
-                OTASP_NUMBER,
-                null,   // contactRef
-                false); // isEmergencyCall
+                OTASP_NUMBER);
         if (callStatus == PhoneUtils.CALL_STATUS_DIALED) {
             if (DBG) logd("  ==> success return from placeCall(): callStatus = " + callStatus);
         } else {
diff --git a/src/com/android/services/telephony/ImsConferenceController.java b/src/com/android/services/telephony/ImsConferenceController.java
index 315aaad..b7f7b92 100644
--- a/src/com/android/services/telephony/ImsConferenceController.java
+++ b/src/com/android/services/telephony/ImsConferenceController.java
@@ -147,6 +147,7 @@
         mTelephonyConnections.add(connection);
         connection.addTelephonyConnectionListener(mTelephonyConnectionListener);
         recalculateConference();
+        recalculateConferenceable();
     }
 
     /**
diff --git a/tests/src/com/android/phone/CnapTest.java b/tests/src/com/android/phone/CnapTest.java
deleted file mode 100644
index 534d02a..0000000
--- a/tests/src/com/android/phone/CnapTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Need to be in this package to access package methods.
-package com.android.phone;
-import android.content.Context;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.telephony.CallerInfo;
-
-import static com.android.internal.telephony.PhoneConstants.PRESENTATION_ALLOWED;
-import static com.android.internal.telephony.PhoneConstants.PRESENTATION_UNKNOWN;
-
-// Test suite for the Caller Name Presentation (CNAP) handling.
-// See AndroidManifest.xml how to run these tests.
-public class CnapTest extends AndroidTestCase {
-    private static final String TAG = "CnapTest";
-    private Context mContext;
-    private CallerInfo mCallerInfo;
-    // TODO: This string should be loaded from the phone package and
-    // not hardcoded.
-    private String mUnknown = "Unknown";
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mContext = getContext();
-        mCallerInfo = new CallerInfo();
-    }
-
-    // Checks the cnap 'ABSENT NUMBER' is mapped to the unknown presentation.
-    @SmallTest
-    public void testAbsentNumberIsMappedToUnknown() throws Exception {
-        String num = modifyForSpecialCnapCases("ABSENT NUMBER", PRESENTATION_ALLOWED);
-        assertIsUnknown(num);
-    }
-
-    // HELPERS
-
-    /**
-     * Checks the number and CallerInfo structure indicate the number
-     * is unknown.
-     */
-    private void assertIsUnknown(String number) {
-        assertEquals(mUnknown, number);
-        assertEquals(PRESENTATION_UNKNOWN, mCallerInfo.numberPresentation);
-        // TODO: cnapName and name presentation should be set to
-        // unknown. At least I cannot see why it shouldn't be the case
-        // assertEquals(mUnknown, mCallerInfo.cnapName);
-        // assertEquals(PRESENTATION_UNKNOWN, mCallerInfo.namePresentation);
-    }
-
-    /**
-     * Shorthand for PhoneUtils.modifyForSpecialCnapCases(mContext, mCallerInfo, ...)
-     */
-    private String modifyForSpecialCnapCases(String number, int presentation) {
-        return PhoneUtils.modifyForSpecialCnapCases(
-            mContext, mCallerInfo, number, presentation);
-    }
-}