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
This commit is contained in:
Fabrice Di Meglio
2014-06-23 17:25:40 -07:00
parent 885f719628
commit fdf54815d2
4 changed files with 1 additions and 119 deletions

View File

@@ -95,8 +95,6 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
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 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
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 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
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 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
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 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
@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();