FP2-1388:[ST_2][Monkey] 'com.android.email' crash once.

[ST_2][Monkey] 'com.android.email' crash once.

Change-Id: Ie53740225a393e852f0b84e14958d02ba34eb185
diff --git a/emailcommon/src/com/android/emailcommon/service/EmailServiceProxy.java b/emailcommon/src/com/android/emailcommon/service/EmailServiceProxy.java
index 36a0d33..1dbc87a 100644
--- a/emailcommon/src/com/android/emailcommon/service/EmailServiceProxy.java
+++ b/emailcommon/src/com/android/emailcommon/service/EmailServiceProxy.java
@@ -30,6 +30,9 @@
 import com.android.mail.utils.LogUtils;
 
 import java.io.IOException;
+import java.net.URLEncoder;
+import java.io.UnsupportedEncodingException;
+
 
 /**
  * The EmailServiceProxy class provides a simple interface for the UI to call into the various
@@ -183,7 +186,11 @@
         setTask(new ProxyTask() {
             @Override
             public void run() throws RemoteException{
-                mReturn = mService.autoDiscover(userName, password);
+                try{
+                    mReturn = mService.autoDiscover(URLEncoder.encode(userName, "UTF-8"), password);
+                }catch (UnsupportedEncodingException e){
+                    mReturn = mService.autoDiscover(userName, password);
+                }
             }
         }, "autoDiscover");
         waitForCompletion();