Remove VM switch from Developer Options

- no more needed as Art is the one and only one VM

See bug: #15778483 "Select Runtime" still exists in search results, but not in Settings

Change-Id: I4ccca20165e254f7eec87c1e44aad8de0cab628d
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index c733009..4d09720 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -874,27 +874,6 @@
         <item>-1</item>
     </integer-array>
 
-    <!-- Titles for runtime selection preference. [CHAR LIMIT=35] -->
-    <string-array name="select_runtime_titles">
-        <item>Dalvik</item>
-        <item>ART</item>
-        <item>ART (debug)</item>
-    </string-array>
-
-    <!-- Values for runtime selection preference. -->
-    <string-array name="select_runtime_values" translatable="false" >
-        <item>libdvm.so</item>
-        <item>libart.so</item>
-        <item>libartd.so</item>
-    </string-array>
-
-    <!-- Summaries for runtime selection preference. [CHAR LIMIT=100]-->
-    <string-array name="select_runtime_summaries" >
-        <item>Use Dalvik</item>
-        <item>Use ART</item>
-        <item>Use ART debug build</item>
-    </string-array>
-
     <!-- Titles for logd limit size selection preference. [CHAR LIMIT=14] -->
     <string-array name="select_logd_size_titles">
         <item>64K</item>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7afc8c3..a0df8ee 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3160,13 +3160,6 @@
     <!-- setting Checkbox summary whether to capture all bluetooth HCI packets in a file -->
     <string name="bt_hci_snoop_log_summary">Capture all bluetooth HCI packets in a file</string>
 
-    <!-- Runtime selection title, used for debug purposes only. [CHAR LIMIT=25] -->
-    <string name="select_runtime_title">Select runtime </string>
-    <!-- Runtime selection dialog title, used for debug purposes only. [CHAR LIMIT=25] -->
-    <string name="select_runtime_dialog_title">Select runtime</string>
-    <!-- Message of dialog confirming that user wants to restart their device with a new runtime -->
-    <string name="select_runtime_warning_message">Reboot to change runtime from <xliff:g id="old" example="libdvm.so">%1$s</xliff:g> to <xliff:g id="new" example="libart.so">%2$s</xliff:g>?</string>
-
     <!-- Setting Checkbox title whether to show options for wireless display certification -->
     <string name="wifi_display_certification">Wireless display certification</string>
     <!-- Setting Checkbox title whether to enable WiFi Verbose Logging. [CHAR LIMIT=40] -->
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index f30cd07..ba93c7a 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -38,13 +38,6 @@
         android:summary="@string/keep_screen_on_summary"/>
 
     <ListPreference
-        android:key="select_runtime"
-        android:title="@string/select_runtime_title"
-        android:dialogTitle="@string/select_runtime_dialog_title"
-        android:entries="@array/select_runtime_titles"
-        android:entryValues="@array/select_runtime_values" />
-
-    <ListPreference
         android:key="hdcp_checking"
         android:title="@string/hdcp_checking_title"
         android:dialogTitle="@string/hdcp_checking_dialog_title"
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 52b34c3..00a0b92 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -95,8 +95,6 @@
     private static final String ENABLE_TERMINAL = "enable_terminal";
     private static final String KEEP_SCREEN_ON = "keep_screen_on";
     private static final String BT_HCI_SNOOP_LOG = "bt_hci_snoop_log";
-    private static final String SELECT_RUNTIME_KEY = "select_runtime";
-    private static final String SELECT_RUNTIME_PROPERTY = "persist.sys.dalvik.vm.lib.2";
     private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
     private static final String HDCP_CHECKING_KEY = "hdcp_checking";
     private static final String HDCP_CHECKING_PROPERTY = "persist.sys.hdcp_checking";
@@ -347,12 +345,6 @@
         mAllPrefs.add(mShowAllANRs);
         mResetCbPrefs.add(mShowAllANRs);
 
-        Preference selectRuntime = findPreference(SELECT_RUNTIME_KEY);
-        if (selectRuntime != null) {
-            mAllPrefs.add(selectRuntime);
-            filterRuntimeOptions(selectRuntime);
-        }
-
         Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
         if (hdcpChecking != null) {
             mAllPrefs.add(hdcpChecking);
@@ -510,7 +502,6 @@
                 Settings.Secure.BLUETOOTH_HCI_LOG, 0) != 0);
         updateCheckBox(mAllowMockLocation, Settings.Secure.getInt(cr,
                 Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
-        updateRuntimeValue();
         updateHdcpValues();
         updatePasswordSummary();
         updateDebuggerOptions();
@@ -568,53 +559,6 @@
         pokeSystemProperties();
     }
 
-    void filterRuntimeOptions(Preference selectRuntime) {
-        ListPreference pref = (ListPreference) selectRuntime;
-        ArrayList<String> validValues = new ArrayList<String>();
-        ArrayList<String> validSummaries = new ArrayList<String>();
-        String[] values = getResources().getStringArray(R.array.select_runtime_values);
-        String[] summaries = getResources().getStringArray(R.array.select_runtime_summaries);
-        for (int i = 0; i < values.length; i++) {
-            String value = values[i];
-            String summary = summaries[i];
-            if (new File("/system/lib/" + value).exists()) {
-                validValues.add(value);
-                validSummaries.add(summary);
-            }
-        }
-        int count = validValues.size();
-        if (count <= 1) {
-            // no choices, so remove preference
-            removePreference(selectRuntime);
-        } else {
-            pref.setEntryValues(validValues.toArray(new String[count]));
-            pref.setEntries(validSummaries.toArray(new String[count]));
-        }
-    }
-
-    private String currentRuntimeValue() {
-        return SystemProperties.get(SELECT_RUNTIME_PROPERTY, VMRuntime.getRuntime().vmLibrary());
-    }
-
-    private void updateRuntimeValue() {
-        ListPreference selectRuntime = (ListPreference) findPreference(SELECT_RUNTIME_KEY);
-        if (selectRuntime != null) {
-            String currentValue = currentRuntimeValue();
-            String[] values = getResources().getStringArray(R.array.select_runtime_values);
-            String[] summaries = getResources().getStringArray(R.array.select_runtime_summaries);
-            int index = 0;
-            for (int i = 0; i < values.length; i++) {
-                if (currentValue.equals(values[i])) {
-                    index = i;
-                    break;
-                }
-            }
-            selectRuntime.setValue(values[index]);
-            selectRuntime.setSummary(summaries[index]);
-            selectRuntime.setOnPreferenceChangeListener(this);
-        }
-    }
-
     private void updateHdcpValues() {
         ListPreference hdcpChecking = (ListPreference) findPreference(HDCP_CHECKING_KEY);
         if (hdcpChecking != null) {
@@ -1435,34 +1379,7 @@
 
     @Override
     public boolean onPreferenceChange(Preference preference, Object newValue) {
-        if (SELECT_RUNTIME_KEY.equals(preference.getKey())) {
-            final String oldRuntimeValue = VMRuntime.getRuntime().vmLibrary();
-            final String newRuntimeValue = newValue.toString();
-            if (!newRuntimeValue.equals(oldRuntimeValue)) {
-                final Context context = getActivity();
-                final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
-                builder.setMessage(context.getResources().getString(R.string.select_runtime_warning_message,
-                                                                    oldRuntimeValue, newRuntimeValue));
-                builder.setPositiveButton(android.R.string.ok, new OnClickListener() {
-                    @Override
-                    public void onClick(DialogInterface dialog, int which) {
-                        SystemProperties.set(SELECT_RUNTIME_PROPERTY, newRuntimeValue);
-                        pokeSystemProperties();
-                        PowerManager pm = (PowerManager)
-                                context.getSystemService(Context.POWER_SERVICE);
-                        pm.reboot(null);
-                    }
-                });
-                builder.setNegativeButton(android.R.string.cancel, new OnClickListener() {
-                    @Override
-                    public void onClick(DialogInterface dialog, int which) {
-                        updateRuntimeValue();
-                    }
-                });
-                builder.show();
-            }
-            return true;
-        } else if (HDCP_CHECKING_KEY.equals(preference.getKey())) {
+        if (HDCP_CHECKING_KEY.equals(preference.getKey())) {
             SystemProperties.set(HDCP_CHECKING_PROPERTY, newValue.toString());
             updateHdcpValues();
             pokeSystemProperties();