Fix MMS Config issues in Debug menu

Fix
 - Wrong order of args for update().
 - Wrong and missing configs in keyType map.
And remove MMS config keys from the key list if the keyType map doesn't
include them.

Test: Manual

Change-Id: Ib1876072625187baf15ce6e64f90785ed0ba3df8
Signed-off-by: Taesu Lee <taesu82.lee@samsung.com>
diff --git a/src/android/support/v7/mms/CarrierConfigValuesLoader.java b/src/android/support/v7/mms/CarrierConfigValuesLoader.java
index 150d92d..1cb5226 100644
--- a/src/android/support/v7/mms/CarrierConfigValuesLoader.java
+++ b/src/android/support/v7/mms/CarrierConfigValuesLoader.java
@@ -174,7 +174,7 @@
     /**
      * String value: name for the user agent profile HTTP header
      */
-    public static final String CONFIG_UA_PROF_TAG_NAME = "mUaProfTagName";
+    public static final String CONFIG_UA_PROF_TAG_NAME = "uaProfTagName";
     public static final String CONFIG_UA_PROF_TAG_NAME_DEFAULT = "x-wap-profile";
     /**
      * String value: additional HTTP headers for MMS HTTP requests.
@@ -195,4 +195,14 @@
      */
     public static final String CONFIG_NAI_SUFFIX = "naiSuffix";
     public static final String CONFIG_NAI_SUFFIX_DEFAULT = null;
+    /**
+     * String value: Url for user agent profile
+     */
+    public static final String CONFIG_UA_PROF_URL = "uaProfUrl";
+    public static final String CONFIG_UA_PROF_URL_DEFAULT = null;
+    /**
+     * String value: user agent
+     */
+    public static final String CONFIG_USER_AGENT = "userAgent";
+    public static final String CONFIG_USER_AGENT_DEFAULT = null;
 }
diff --git a/src/com/android/messaging/sms/MmsConfig.java b/src/com/android/messaging/sms/MmsConfig.java
index 5649be4..187e677 100755
--- a/src/com/android/messaging/sms/MmsConfig.java
+++ b/src/com/android/messaging/sms/MmsConfig.java
@@ -90,6 +90,8 @@
         sKeyTypeMap.put(CarrierConfigValuesLoader.CONFIG_HTTP_PARAMS, KEY_TYPE_STRING);
         sKeyTypeMap.put(CarrierConfigValuesLoader.CONFIG_EMAIL_GATEWAY_NUMBER, KEY_TYPE_STRING);
         sKeyTypeMap.put(CarrierConfigValuesLoader.CONFIG_NAI_SUFFIX, KEY_TYPE_STRING);
+        sKeyTypeMap.put(CarrierConfigValuesLoader.CONFIG_UA_PROF_URL, KEY_TYPE_STRING);
+        sKeyTypeMap.put(CarrierConfigValuesLoader.CONFIG_USER_AGENT, KEY_TYPE_STRING);
     }
 
     // A map that stores all MmsConfigs, one per active subscription. For pre-LMSim, this will
diff --git a/src/com/android/messaging/ui/debug/DebugMmsConfigFragment.java b/src/com/android/messaging/ui/debug/DebugMmsConfigFragment.java
index 7c54db5..f7da331 100644
--- a/src/com/android/messaging/ui/debug/DebugMmsConfigFragment.java
+++ b/src/com/android/messaging/ui/debug/DebugMmsConfigFragment.java
@@ -39,6 +39,7 @@
 
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -103,6 +104,13 @@
             mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             mMmsConfig = MmsConfig.get(subId);
             mKeys = new ArrayList<>(mMmsConfig.keySet());
+            Iterator<String> it = mKeys.iterator();
+            while (it.hasNext()) {
+                // Remove a config if the MmsConfig.sKeyTypeMap doesn't have it.
+                if (MmsConfig.getKeyType(it.next()) == null) {
+                    it.remove();
+                }
+            }
             Collections.sort(mKeys);
         }
 
@@ -125,7 +133,7 @@
 
         @Override
         public void onValueChanged(String key, String keyType, String value) {
-            mMmsConfig.update(key, value, keyType);
+            mMmsConfig.update(keyType, key, value);
             notifyDataSetChanged();
         }