diff options
author | Freeman Ng <tenorslowworm@google.com> | 2010-10-13 19:09:08 -0700 |
---|---|---|
committer | Freeman Ng <tenorslowworm@google.com> | 2010-10-13 19:09:08 -0700 |
commit | 56a52c5aec61eb390b9d98dcaf3042e094e588a2 (patch) | |
tree | ceace00361d1baff9d9ea5dad97d5eac544b50ce | |
parent | 5c9bd5f127de30189fc73ae21487baf650454870 (diff) | |
parent | 59561e0ada643ba88a1386f46d498b5a35339c1e (diff) | |
download | packages_apps_Settings-56a52c5aec61eb390b9d98dcaf3042e094e588a2.zip packages_apps_Settings-56a52c5aec61eb390b9d98dcaf3042e094e588a2.tar.gz packages_apps_Settings-56a52c5aec61eb390b9d98dcaf3042e094e588a2.tar.bz2 |
resolved conflicts for merge of 59561e0a to master
Change-Id: I9d031ce8f9627bb5e8b28f867e2890c354856df9
-rw-r--r-- | src/com/android/settings/DeviceInfoSettings.java | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/com/android/settings/DeviceInfoSettings.java b/src/com/android/settings/DeviceInfoSettings.java index 0d6549a..2bd8610 100644 --- a/src/com/android/settings/DeviceInfoSettings.java +++ b/src/com/android/settings/DeviceInfoSettings.java @@ -17,7 +17,10 @@ package com.android.settings; import android.app.Activity; +import android.content.ComponentName; import android.content.Intent; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.os.Build; import android.os.Bundle; import android.os.SystemClock; @@ -25,11 +28,13 @@ import android.os.SystemProperties; import android.preference.Preference; import android.preference.PreferenceGroup; import android.preference.PreferenceScreen; +import android.provider.Settings; import android.util.Log; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -44,15 +49,26 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment { private static final String KEY_COPYRIGHT = "copyright"; private static final String KEY_SYSTEM_UPDATE_SETTINGS = "system_update_settings"; private static final String PROPERTY_URL_SAFETYLEGAL = "ro.url.safetylegal"; - + long[] mHits = new long[3]; - + @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); - + addPreferencesFromResource(R.xml.device_info_settings); - + + // If we don't have an IME tutorial, remove that option + String currentIme = Settings.Secure.getString(getContentResolver(), + Settings.Secure.DEFAULT_INPUT_METHOD); + ComponentName component = ComponentName.unflattenFromString(currentIme); + Intent imeIntent = new Intent(component.getPackageName() + ".tutorial"); + PackageManager pm = getPackageManager(); + List<ResolveInfo> tutorials = pm.queryIntentActivities(imeIntent, 0); + if(tutorials == null || tutorials.isEmpty()) { + getPreferenceScreen().removePreference(findPreference("system_tutorial")); + } + setStringSummary("firmware_version", Build.VERSION.RELEASE); findPreference("firmware_version").setEnabled(true); setValueSummary("baseband_version", "gsm.version.baseband"); @@ -79,7 +95,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment { Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY); Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_TEAM, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY); - + // These are contained by the root preference screen parentPreference = getPreferenceScreen(); Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, @@ -88,7 +104,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment { Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_CONTRIBUTORS, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY); } - + @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { if (preference.getKey().equals("firmware_version")) { @@ -129,11 +145,11 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment { getResources().getString(R.string.device_info_default)); } } - + private void setValueSummary(String preference, String property) { try { findPreference(preference).setSummary( - SystemProperties.get(property, + SystemProperties.get(property, getResources().getString(R.string.device_info_default))); } catch (RuntimeException e) { @@ -176,7 +192,7 @@ public class DeviceInfoSettings extends SettingsPreferenceFragment { m.group(2)).append(" ").append(m.group(3)).append("\n") .append(m.group(4))).toString(); } - } catch (IOException e) { + } catch (IOException e) { Log.e(TAG, "IO Exception when getting kernel version for Device Info screen", e); |