#16062: Make add appropriate account labels
diff --git a/res/values/strings.xml b/res/values/strings.xml
index cbd1215..4956ab0 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -43,17 +43,62 @@
         <string name="account_preferences">Account Preferences</string>
         <string name="audio_preferences">Audio Preferences</string>
 
-        <string name="account_alias_label">Alias</string>
         <string name="account_hostname_label">Hostname</string>
         <string name="account_username_label">Username</string>
-        <string name="account_proxy_label">Proxy</string>
-        <string name="account_regsitration_label">Registration Expire</string>
-        <string name="account_network_interface_label">Network Interface</string>
+        <string name="account_routeset_label">Route Set</string>
+        <string name="account_password_label">Password</string>
+        <string name="account_realm_label">Realm</string>
+        <string name="account_useragent_label">User Agent</string>
+        <string name="account_autoanswer_label">Auto Answer</string>
+
+        <string name="account_type_label">Account Type</string>
+        <string name="account_alias_label">Alias</string>
+        <string name="account_mailbox_label">Mailbox</string>
+        <string name="account_enabled_label">Account Enabled</string>
+        <string name="account_registration_exp_label">Registration Expire</string>
+        <string name="account_registration_status_label">Registration Status</string>
+        <string name="account_registration_code_label">Registration Code</string>
+        <string name="account_registration_state_label">Registration State</string>
+        <string name="account_credential_count_label">Credential Count</string>
+        <string name="account_config_dtmf_type_label">DTMF Type</string>
+        <string name="account_ringtone_path_label">Ringtone</string>
+        <string name="account_ringtone_enabled_label">Ringtone Enabled</string>
+        <string name="account_keep_alive_label">Keep Alive</string>
+
+        <string name="account_local_interface_label">Local Interface</string>
+        <string name="account_account_interface_label">Account Interface</string>
+        <string name="account_published_same_as_local_label">Published Port Same As Local</string>
+        <string name="account_local_port_label">Local Port</string>
+        <string name="account_published_port_label">Published Port</string>
+        <string name="account_published_address_label">Published Address</string>
+        <string name="account_displayname_label">Displayname Label</string>
         <string name="account_stun_server_label">Stun Server</string>
-        <string name="account_security_label">Security</string>
-        <string name="account_tls_label">TLS</string>
-        <string name="account_srtp_label">SRTP</string>
- 
+        <string name="account_stun_enable_label">Stun Enabled</string>
+
+        <string name="account_srtp_enabled_label">SRTP Enabled</string>
+        <string name="account_srtp_exchange_label">SRTP Key Exchange</string>
+        <string name="account_encryption_algo_label">Encryption Algo</string>
+        <string name="account_srtp_fallback_label">SRTP Fallback</string>
+        <string name="account_hello_hash_enable_label">Hello Hash Enabled</string>
+        <string name="account_display_sas_label">Display SAS</string>
+        <string name="account_not_supported_warning_label">Not Supported Warning</string>
+        <string name="account_display_sas_once_label">Display SAS Once</string>
+
+        <string name="account_listener_port_label">TLS Listener Port</string>
+        <string name="account_tls_enabled_label">TLS Enabled</string>
+        <string name="account_tls_certificate_list_label">TLS Certificate List File</string>
+        <string name="account_tls_certificate_file_label">TLS Certificate File</string>
+        <string name="account_tls_private_key_file_label">TLS Private Key File</string>
+        <string name="account_tls_password_label">TLS Private Key Password</string>
+        <string name="account_tls_method_label">TLS Method</string>
+        <string name="account_tls_ciphers_label">TLS Ciphers</string>
+        <string name="account_tls_server_name_label">TLS Server Name</string>
+        <string name="account_tls_verify_label">TLS Verify Server</string>
+        <string name="account_tls_verify_client_label">TLS Verify Client</string>
+        <string name="account_tls_require_client_certificat_label">TLS Require Client Certificate</string>
+        <string name="account_tls_negotiation_timeout_sec">TLS Negotiation Timeout (sec)</string>
+        <string name="account_tls_negotiation_timeout_msec">TLS Negotiation Timeout (msec)</string>
+
         <string name="account_alias_field">Alias</string>
         <string name="title_account_alias_field">Alias</string>
         <string name="dialogtitle_account_alias_field">Enter the alias for this account</string>
@@ -100,4 +145,7 @@
         <string name="title_audio_ringtone_field">Ringtone</string>
         <string name="dialogtitle_audio_ringtone_field">Ringtone</string>
 
+        <string name="default_account_category">Default Account</string> 
+        <string name="account_list_category">Account List</string>
+
 </resources>
diff --git a/src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java b/src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java
index eaa700c..a1c09a5 100644
--- a/src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java
+++ b/src/com/savoirfairelinux/sflphone/client/AccountManagementFragment.java
@@ -58,11 +58,13 @@
     static final String CURRENT_VALUE = "Current value:: ";
     static final String DEFAULT_ACCOUNT_ID = "IP2IP";
     private ISipService service;
-    HashMap<String, String> mAccountDetails = null;
-    ArrayList<String> mAccountList = null;
+    // HashMap<String, String> mAccountDetails = null;
+    // ArrayList<String> mAccountList = null;
+    HashMap<String,HashMap<String,String>> mAccountList = new HashMap<String,HashMap<String,String>>();
     ArrayList<PreferenceEntry> basicDetailKeys = new ArrayList<PreferenceEntry>();
     ArrayList<PreferenceEntry> advancedDetailKeys = new ArrayList<PreferenceEntry>();
     Activity context = getActivity();
+    
 
     public AccountManagementFragment(ISipService s)
     {
@@ -184,6 +186,23 @@
         setPreferenceScreen(getAccountListPreferenceScreen());
     }
 
+    @Override
+    public void onStop()
+    {
+        super.onStop();
+        Log.i(TAG, "onStop");
+
+    }
+
+    @Override
+    public void onDestroy()
+    {
+        super.onDestroy();
+        Log.i(TAG, "onDestroy");
+
+        
+    }
+
     boolean onTextEditPreferenceChange(Preference preference, Object newValue)
     {
         Log.i(TAG, "Account Preference Changed " + preference.getTitle());
@@ -238,8 +257,8 @@
     {
         Activity currentContext = getActivity();
 
-        mAccountList = getAccountList();
-        Log.i(TAG, "GetAccountList: " + mAccountList);
+        ArrayList<String> accountList = getAccountList();
+        // Log.i(TAG, "GetAccountList: " + mAccountList);
 
         PreferenceScreen root = getPreferenceManager().createPreferenceScreen(currentContext);
 
@@ -255,7 +274,7 @@
         accountListCat.setTitle(R.string.default_account_category);
         root.addPreference(accountListCat);
 
-        for(String s : mAccountList)
+        for(String s : accountList)
             root.addPreference(getAccountPreferenceScreen(s));
 
         return root;
@@ -265,125 +284,39 @@
     {
         Activity currentContext = getActivity();
 
-        mAccountDetails = getAccountDetails(accountID);
-        Log.i(TAG, "GetAccountDetails: " + mAccountDetails.size());
+        HashMap<String,String> map = getAccountDetails(accountID);
+        mAccountList.put(accountID, map);
 
         PreferenceScreen root = getPreferenceManager().createPreferenceScreen(currentContext);
-
-        root.setTitle(mAccountDetails.get(ServiceConstants.CONFIG_ACCOUNT_ALIAS));
+        root.setTitle(map.get(ServiceConstants.CONFIG_ACCOUNT_ALIAS));
 
         // Inline preference
         PreferenceCategory accountPrefCat = new PreferenceCategory(currentContext);
         accountPrefCat.setTitle(R.string.account_preferences);
         root.addPreference(accountPrefCat);
 
-        // 
         for(PreferenceEntry entry : basicDetailKeys)
         {
             EditTextPreference accountAliasPref = new EditTextPreference(currentContext);
             accountAliasPref.setDialogTitle(entry.mLabelId);
             accountAliasPref.setPersistent(false);
             accountAliasPref.setTitle(entry.mLabelId);
-            accountAliasPref.setSummary(CURRENT_VALUE + mAccountDetails.get(entry.mKey));
+            accountAliasPref.setSummary(CURRENT_VALUE + map.get(entry.mKey));
             accountAliasPref.setOnPreferenceChangeListener(changeTextEditListener);
             accountPrefCat.addPreference(accountAliasPref);
         }
 
-        // 
         for(PreferenceEntry entry : advancedDetailKeys)
         {
             EditTextPreference accountAliasPref = new EditTextPreference(currentContext);
             accountAliasPref.setDialogTitle(entry.mLabelId);
             accountAliasPref.setPersistent(false);
             accountAliasPref.setTitle(entry.mLabelId);
-            accountAliasPref.setSummary(CURRENT_VALUE + mAccountDetails.get(entry.mKey));
+            accountAliasPref.setSummary(CURRENT_VALUE + map.get(entry.mKey));
             accountAliasPref.setOnPreferenceChangeListener(changeTextEditListener);
             accountPrefCat.addPreference(accountAliasPref);
         }
 
-        /*
-        // Alias
-        EditTextPreference accountAliasPref = new EditTextPreference(currentContext);
-        accountAliasPref.setDialogTitle(R.string.dialogtitle_account_alias_field);
-        accountAliasPref.setPersistent(false);
-        accountAliasPref.setTitle(R.string.title_account_alias_field);
-        accountAliasPref.setSummary(CURRENT_VALUE + mAccountDetails.get(ServiceConstants.CONFIG_ACCOUNT_ALIAS));
-        accountAliasPref.setOnPreferenceChangeListener(changeTextEditListener);
-        accountPrefCat.addPreference(accountAliasPref);
-
-        // Hostname
-        EditTextPreference accountHostnamePref = new EditTextPreference(currentContext);
-        accountHostnamePref.setDialogTitle(R.string.dialogtitle_account_hostname_field);
-        accountHostnamePref.setPersistent(false);
-        accountHostnamePref.setTitle(R.string.title_account_hostname_field);
-        accountHostnamePref.setSummary(CURRENT_VALUE + mAccountDetails.get(ServiceConstants.CONFIG_ACCOUNT_HOSTNAME));
-        accountHostnamePref.setOnPreferenceChangeListener(changeTextEditListener);
-        accountPrefCat.addPreference(accountHostnamePref);
-
-        // Username
-        EditTextPreference accountUsernamePref = new EditTextPreference(currentContext);
-        accountUsernamePref.setDialogTitle(R.string.dialogtitle_account_username_field);
-        accountUsernamePref.setPersistent(false);
-        accountUsernamePref.setTitle(R.string.title_account_username_field);
-        accountUsernamePref.setSummary(CURRENT_VALUE + mAccountDetails.get(ServiceConstants.CONFIG_ACCOUNT_USERNAME));
-        accountUsernamePref.setOnPreferenceChangeListener(changeTextEditListener);
-        accountPrefCat.addPreference(accountUsernamePref);
-
-        // Proxy
-        EditTextPreference accountProxyPref = new EditTextPreference(currentContext); 
-        accountProxyPref.setDialogTitle(R.string.dialogtitle_account_proxy_field);
-        accountProxyPref.setPersistent(false);
-        accountProxyPref.setTitle(R.string.title_account_proxy_field);
-        accountProxyPref.setSummary(CURRENT_VALUE + mAccountDetails.get(ServiceConstants.CONFIG_ACCOUNT_ROUTESET));
-        accountProxyPref.setOnPreferenceChangeListener(changeTextEditListener);
-        accountPrefCat.addPreference(accountProxyPref);
-
-        // Registration Timeout
-        EditTextPreference accountRegistrationPref = new EditTextPreference(currentContext); 
-        accountRegistrationPref.setDialogTitle(R.string.dialogtitle_account_registration_field);
-        accountRegistrationPref.setPersistent(false);
-        accountRegistrationPref.setTitle(R.string.title_account_registration_field);
-        accountRegistrationPref.setSummary(CURRENT_VALUE + mAccountDetails.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_EXPIRE));
-        accountRegistrationPref.setOnPreferenceChangeListener(changeTextEditListener);
-        accountPrefCat.addPreference(accountRegistrationPref);
-
-        // Netowrk interface
-        EditTextPreference accountNetworkPref = new EditTextPreference(currentContext); 
-        accountNetworkPref.setDialogTitle(R.string.dialogtitle_account_network_field);
-        accountNetworkPref.setPersistent(false);
-        accountNetworkPref.setTitle(R.string.title_account_network_field);
-        accountNetworkPref.setSummary(CURRENT_VALUE + mAccountDetails.get(ServiceConstants.CONFIG_LOCAL_INTERFACE));
-        accountNetworkPref.setOnPreferenceChangeListener(changeTextEditListener);
-        accountPrefCat.addPreference(accountNetworkPref);
-
-        // Account stun server
-        EditTextPreference accountSecurityPref = new EditTextPreference(currentContext); 
-        accountSecurityPref.setDialogTitle(R.string.dialogtitle_account_security_field);
-        accountSecurityPref.setPersistent(false);
-        accountSecurityPref.setTitle(R.string.title_account_security_field);
-        accountSecurityPref.setSummary(CURRENT_VALUE + mAccountDetails.get(ServiceConstants.CONFIG_STUN_SERVER));
-        accountSecurityPref.setOnPreferenceChangeListener(changeTextEditListener);
-        accountPrefCat.addPreference(accountSecurityPref);
-
-        // Account tls feature
-        EditTextPreference accountTlsPref = new EditTextPreference(currentContext); 
-        accountTlsPref.setDialogTitle(R.string.dialogtitle_account_tls_field);
-        accountTlsPref.setPersistent(false);
-        accountTlsPref.setTitle(R.string.title_account_tls_field);
-        accountTlsPref.setSummary(CURRENT_VALUE + mAccountDetails.get(ServiceConstants.CONFIG_TLS_ENABLE));
-        accountTlsPref.setOnPreferenceChangeListener(changeTextEditListener);
-        accountPrefCat.addPreference(accountTlsPref);
-
-        // Account srtp feature
-        EditTextPreference accountSrtpPref = new EditTextPreference(currentContext); 
-        accountSrtpPref.setDialogTitle(R.string.dialogtitle_account_srtp_field);
-        accountSrtpPref.setPersistent(false);
-        accountSrtpPref.setTitle(R.string.title_account_srtp_field);
-        accountSrtpPref.setSummary(CURRENT_VALUE + mAccountDetails.get(ServiceConstants.CONFIG_SRTP_ENABLE));
-        accountSrtpPref.setOnPreferenceChangeListener(changeTextEditListener);
-        accountPrefCat.addPreference(accountSrtpPref);
-        */
-
         return root;
     }
 
diff --git a/src/com/savoirfairelinux/sflphone/service/ISipService.aidl b/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
index 01134ed..8f0eec1 100644
--- a/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
+++ b/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
@@ -7,5 +7,6 @@
     void hangUp(in String callID);
     List getAccountList();
     Map getAccountDetails(in String accountID);
+    void setAccountDetails(in String accountId, in Map accountDetails);
     void setAudioPlugin(in String callID);
 }
diff --git a/src/com/savoirfairelinux/sflphone/service/SipService.java b/src/com/savoirfairelinux/sflphone/service/SipService.java
index 0a49e4e..c121846 100644
--- a/src/com/savoirfairelinux/sflphone/service/SipService.java
+++ b/src/com/savoirfairelinux/sflphone/service/SipService.java
@@ -40,6 +40,7 @@
 import com.savoirfairelinux.sflphone.client.SFLphoneApplication;
 import com.savoirfairelinux.sflphone.service.ISipService;
 
+import java.util.Map;
 import java.util.HashMap;
 import java.util.ArrayList;
 
@@ -143,7 +144,6 @@
             nativemap.put(ServiceConstants.CONFIG_TLS_ENABLE, swigmap.get(ServiceConstants.CONFIG_TLS_ENABLE));
             nativemap.put(ServiceConstants.CONFIG_SRTP_ENABLE, swigmap.get(ServiceConstants.CONFIG_SRTP_ENABLE));
 
-            /*
             nativemap.put(ServiceConstants.CONFIG_ACCOUNT_TYPE, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_TYPE));
             nativemap.put(ServiceConstants.CONFIG_ACCOUNT_ALIAS, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_ALIAS));
             nativemap.put(ServiceConstants.CONFIG_ACCOUNT_MAILBOX, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_MAILBOX));
@@ -152,6 +152,8 @@
             nativemap.put(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATUS, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATUS));
             nativemap.put(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_CODE, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_CODE));
             nativemap.put(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_DESC, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_DESC));
+
+            /*
             nativemap.put(ServiceConstants.CONFIG_CREDENTIAL_NUMBER, swigmap.get(ServiceConstants.CONFIG_CREDENTIAL_NUMBER));
             nativemap.put(ServiceConstants.CONFIG_ACCOUNT_DTMF_TYPE, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_DTMF_TYPE));
             nativemap.put(ServiceConstants.CONFIG_RINGTONE_PATH, swigmap.get(ServiceConstants.CONFIG_RINGTONE_PATH));
@@ -159,6 +161,9 @@
             nativemap.put(ServiceConstants.CONFIG_KEEP_ALIVE_ENABLED, swigmap.get(ServiceConstants.CONFIG_KEEP_ALIVE_ENABLED));
             nativemap.put(ServiceConstants.CONFIG_ACCOUNT_PASSWORD, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_PASSWORD));
             nativemap.put(ServiceConstants.CONFIG_ACCOUNT_REALM, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_REALM));
+            */
+
+            /*
             nativemap.put(ServiceConstants.CONFIG_ACCOUNT_DEFAULT_REALM, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_DEFAULT_REALM));
             nativemap.put(ServiceConstants.CONFIG_ACCOUNT_USERAGENT, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_USERAGENT));
             nativemap.put(ServiceConstants.CONFIG_ACCOUNT_AUTOANSWER, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_AUTOANSWER));
@@ -191,6 +196,35 @@
 
             return nativemap;
         }
+
+        @Override
+        public void setAccountDetails(String accountId, Map map) {
+            HashMap<String,String> nativemap = (HashMap<String,String>) map;
+
+            StringMap swigmap = new StringMap();
+
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_ALIAS, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_ALIAS));
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_HOSTNAME, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_HOSTNAME));
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_USERNAME, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_USERNAME));
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_ROUTESET, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_ROUTESET));
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_EXPIRE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_EXPIRE));
+            swigmap.set(ServiceConstants.CONFIG_LOCAL_INTERFACE, nativemap.get(ServiceConstants.CONFIG_LOCAL_INTERFACE));
+            swigmap.set(ServiceConstants.CONFIG_STUN_SERVER, nativemap.get(ServiceConstants.CONFIG_STUN_SERVER));
+            swigmap.set(ServiceConstants.CONFIG_TLS_ENABLE, nativemap.get(ServiceConstants.CONFIG_TLS_ENABLE));
+            swigmap.set(ServiceConstants.CONFIG_SRTP_ENABLE, nativemap.get(ServiceConstants.CONFIG_SRTP_ENABLE));
+
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_TYPE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_TYPE));
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_ALIAS, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_ALIAS));
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_MAILBOX, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_MAILBOX));
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_ENABLE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_ENABLE));
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_EXPIRE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_EXPIRE));
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATUS, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATUS));
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_CODE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_CODE));
+            swigmap.set(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_DESC, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_DESC));
+
+            configurationManagerJNI.setAccountDetails(accountId, swigmap);
+        }
+
     };
 
     /**