Merge "Fix the text size."
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8bb7f32..f793d79 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -788,7 +788,7 @@
     <string name="unlock_set_unlock_launch_picker_enable_summary">Choose a method to lock the screen</string>
 
     <!-- Info explaining the backup lock which is used for facelock -->
-    <string name="unlock_backup_info_summary">When conditions for FaceLock aren\'t ideal, how do you want to unlock?</string>
+    <string name="unlock_backup_info_summary">When conditions for Face Unlock aren\'t ideal, how do you want to unlock?</string>
 
     <!-- Title for preference that disables unlock security [CHAR LIMIT=22] -->
     <string name="unlock_set_unlock_off_title">None</string>
@@ -801,7 +801,7 @@
     <string name="unlock_set_unlock_none_summary">No security</string>
 
     <!-- Title for preference that guides the user through a weak biometric lock [CHAR LIMIT=22] -->
-    <string name="unlock_set_unlock_biometric_weak_title">FaceLock</string>
+    <string name="unlock_set_unlock_biometric_weak_title">Face Unlock</string>
     <!-- Summary for preference that disables unlock security [CHAR LIMIT=45]-->
     <string name="unlock_set_unlock_biometric_weak_summary">Low security, experimental</string>
 
@@ -828,7 +828,7 @@
     <!-- Summary for "Configure lockscreen" when security is disabled [CHAR LIMIT=45] -->
     <string name="unlock_set_unlock_mode_none">Slide</string>
     <!-- Summary for "Configure lockscreen" when security biometric weak is enabled [CHAR LIMIT=45] -->
-    <string name="unlock_set_unlock_mode_biometric_weak">FaceLock</string>
+    <string name="unlock_set_unlock_mode_biometric_weak">Face Unlock</string>
     <!-- Summary for "Configure lockscreen" when security pattern is enabled [CHAR LIMIT=45] -->
     <string name="unlock_set_unlock_mode_pattern">Secured with pattern</string>
     <!-- Summary for "Configure lockscreen" when security PIN is enabled [CHAR LIMIT=45] -->
@@ -3604,7 +3604,7 @@
     <!-- Combination of total network bytes sent and received by an application. [CHAR LIMIT=NONE] -->
     <string name="data_usage_received_sent"><xliff:g id="received" example="128KB">%1$s</xliff:g> received, <xliff:g id="sent" example="1.3GB">%2$s</xliff:g> sent</string>
     <!-- Label displaying total network data transferred during a specific time period. [CHAR LIMIT=64] -->
-    <string name="data_usage_total_during_range"><xliff:g id="range" example="Jul 1 - Jul 31">%2$s</xliff:g>: <xliff:g id="total" example="128KB">%1$s</xliff:g> used</string>
+    <string name="data_usage_total_during_range"><xliff:g id="range" example="Jul 1 - Jul 31">%2$s</xliff:g>: about <xliff:g id="total" example="128KB">%1$s</xliff:g> used</string>
 
     <!-- Button at the bottom of the CryptKeeper screen to make an emergency call. -->
     <string name="cryptkeeper_emergency_call">Emergency call</string>
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java
index 337233e..eada8a7 100644
--- a/src/com/android/settings/DeviceInfoSettings.java
+++ b/src/com/android/settings/DeviceInfoSettings.java
@@ -42,6 +42,9 @@
 
     private static final String LOG_TAG = "DeviceInfoSettings";
 
+    private static final String FILENAME_PROC_VERSION = "/proc/version";
+    private static final String FILENAME_MSV = "/sys/board_properties/soc/msv";
+
     private static final String KEY_CONTAINER = "container";
     private static final String KEY_TEAM = "team";
     private static final String KEY_CONTRIBUTORS = "contributors";
@@ -78,7 +81,7 @@
         setStringSummary(KEY_FIRMWARE_VERSION, Build.VERSION.RELEASE);
         findPreference(KEY_FIRMWARE_VERSION).setEnabled(true);
         setValueSummary(KEY_BASEBAND_VERSION, "gsm.version.baseband");
-        setStringSummary(KEY_DEVICE_MODEL, Build.MODEL);
+        setStringSummary(KEY_DEVICE_MODEL, Build.MODEL + getMsvSuffix());
         setStringSummary(KEY_BUILD_NUMBER, Build.DISPLAY);
         findPreference(KEY_KERNEL_VERSION).setSummary(getFormattedKernelVersion());
 
@@ -168,16 +171,26 @@
         }
     }
 
+    /**
+     * Reads a line from the specified file.
+     * @param filename the file to read from
+     * @return the first line, if any.
+     * @throws IOException if the file couldn't be read
+     */
+    private String readLine(String filename) throws IOException {
+        BufferedReader reader = new BufferedReader(new FileReader(filename), 256);
+        try {
+            return reader.readLine();
+        } finally {
+            reader.close();
+        }
+    }
+
     private String getFormattedKernelVersion() {
         String procVersionStr;
 
         try {
-            BufferedReader reader = new BufferedReader(new FileReader("/proc/version"), 256);
-            try {
-                procVersionStr = reader.readLine();
-            } finally {
-                reader.close();
-            }
+            procVersionStr = readLine(FILENAME_PROC_VERSION);
 
             final String PROC_VERSION_REGEX =
                 "\\w+\\s+" + /* ignore: Linux */
@@ -213,4 +226,24 @@
         }
     }
 
+    /**
+     * Returns " (ENGINEERING)" if the msv file has a zero value, else returns "".
+     * @return a string to append to the model number description.
+     */
+    private String getMsvSuffix() {
+        // Production devices should have a non-zero value. If we can't read it, assume it's a
+        // production device so that we don't accidentally show that it's an ENGINEERING device.
+        try {
+            String msv = readLine(FILENAME_MSV);
+            // Parse as a hex number. If it evaluates to a zero, then it's an engineering build.
+            if (Long.parseLong(msv, 16) == 0) {
+                return " (ENGINEERING)";
+            }
+        } catch (IOException ioe) {
+            // Fail quietly, as the file may not exist on some devices.
+        } catch (NumberFormatException nfe) {
+            // Fail quietly, returning empty string should be sufficient
+        }
+        return "";
+    }
 }
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 90336e2..ac6cb64 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -16,6 +16,7 @@
 
 package com.android.settings;
 
+import android.app.ActivityManager;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
@@ -278,7 +279,7 @@
      * Returns true if Monkey is running.
      */
     public static boolean isMonkeyRunning() {
-        return SystemProperties.getBoolean("ro.monkey", false);
+        return ActivityManager.isUserAMonkey();
     }
 
     /**
diff --git a/src/com/android/settings/deviceinfo/UsbSettings.java b/src/com/android/settings/deviceinfo/UsbSettings.java
index 44ecff4..af279e8 100644
--- a/src/com/android/settings/deviceinfo/UsbSettings.java
+++ b/src/com/android/settings/deviceinfo/UsbSettings.java
@@ -34,6 +34,7 @@
 
 import com.android.settings.R;
 import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
 
 /**
  * USB storage settings.
@@ -110,6 +111,11 @@
     @Override
     public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
 
+        // Don't allow any changes to take effect as the USB host will be disconnected, killing
+        // the monkeys
+        if (Utils.isMonkeyRunning()) {
+            return true;
+        }
         // temporary hack - using check boxes as radio buttons
         // don't allow unchecking them
         if (preference instanceof CheckBoxPreference) {
diff --git a/src/com/android/settings/inputmethod/InputMethodPreference.java b/src/com/android/settings/inputmethod/InputMethodPreference.java
index 4b926e2..f222b88 100644
--- a/src/com/android/settings/inputmethod/InputMethodPreference.java
+++ b/src/com/android/settings/inputmethod/InputMethodPreference.java
@@ -104,16 +104,18 @@
         mSummaryText = (TextView)view.findViewById(android.R.id.summary);
         final boolean hasSubtypes = mImi.getSubtypeCount() > 1;
         final String imiId = mImi.getId();
-        mInputMethodPref.setOnLongClickListener(new OnLongClickListener() {
-            @Override
-            public boolean onLongClick(View arg0) {
-                final Bundle bundle = new Bundle();
-                bundle.putString(Settings.EXTRA_INPUT_METHOD_ID, imiId);
-                startFragment(mFragment, InputMethodAndSubtypeEnabler.class.getName(),
-                        0, bundle);
-                return true;
-            }
-        });
+        if (hasSubtypes) {
+            mInputMethodPref.setOnLongClickListener(new OnLongClickListener() {
+                @Override
+                public boolean onLongClick(View arg0) {
+                    final Bundle bundle = new Bundle();
+                    bundle.putString(Settings.EXTRA_INPUT_METHOD_ID, imiId);
+                    startFragment(mFragment, InputMethodAndSubtypeEnabler.class.getName(),
+                            0, bundle);
+                    return true;
+                }
+            });
+        }
 
         if (mSettingsIntent != null) {
             mInputMethodSettingsButton.setOnClickListener(