Exchange: when run monkeytest make the exchange force close.

Cherry pick (1/2 commits) from upstream CAF to allow the app to support
runtime permissions.

FPIIM-675

Original commit message:

com.android.email/.activity.setup.EmailPreferenceActivity is exported
in the AndroidManifest file.
but not exported when run monkeytest.
need catch the exception.

Change-Id: I9379653dbffefedee59b3e29163e911f2f9dd304
CRs-Fixed: 1065030
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9fc30e6..7bfcb4d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -204,4 +204,7 @@
     <!-- Message displayed when there is no application to handle the settings option. [CHAR LIMIT=NONE] -->
     <string name="email_settings_not_available">Re-enable the Email application to view settings.</string>
 
+    <!-- Message displayed when there is application no exported and no permission to handle to settings option -->
+    <string name="email_settings_not_permission">Email application not exported, no permission to view settings</string>
+
 </resources>
diff --git a/src/com/android/exchange/SettingsRedirector.java b/src/com/android/exchange/SettingsRedirector.java
index 9cf915a..21e6d94 100644
--- a/src/com/android/exchange/SettingsRedirector.java
+++ b/src/com/android/exchange/SettingsRedirector.java
@@ -48,6 +48,10 @@
             Toast toast = Toast.makeText(this, R.string.email_settings_not_available,
                     Toast.LENGTH_SHORT);
             toast.show();
+        } catch (SecurityException e) {
+            Toast toast = Toast.makeText(this, R.string.email_settings_not_permission,
+                    Toast.LENGTH_SHORT);
+            toast.show();
         }
         finish();
     }