diff options
author | Ying Wang <wangying@google.com> | 2010-01-06 13:57:51 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-01-06 13:57:51 -0800 |
commit | 8d1d83ce13806a3574f7135b4b15fcd348f9628b (patch) | |
tree | b07b6f14f934c2ae78d8d2a637d5c122cfa00ced | |
parent | cb526ca66a171a3c212fceae294d20fcac17423e (diff) | |
parent | 759f48ba1345a8827f217f8db3c71edfca1458c1 (diff) | |
download | packages_apps_settings-8d1d83ce13806a3574f7135b4b15fcd348f9628b.zip packages_apps_settings-8d1d83ce13806a3574f7135b4b15fcd348f9628b.tar.gz packages_apps_settings-8d1d83ce13806a3574f7135b4b15fcd348f9628b.tar.bz2 |
am 759f48ba: am a718832e: Still use ro.monkey
Merge commit '759f48ba1345a8827f217f8db3c71edfca1458c1'
* commit '759f48ba1345a8827f217f8db3c71edfca1458c1':
Still use ro.monkey
-rw-r--r-- | src/com/android/settings/DevelopmentSettings.java | 4 | ||||
-rw-r--r-- | src/com/android/settings/LanguageSettings.java | 4 | ||||
-rw-r--r-- | src/com/android/settings/MasterClear.java | 4 | ||||
-rw-r--r-- | src/com/android/settings/MediaFormat.java | 4 | ||||
-rw-r--r-- | src/com/android/settings/Utils.java | 22 |
5 files changed, 19 insertions, 19 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java index 7934800..b0e5c07 100644 --- a/src/com/android/settings/DevelopmentSettings.java +++ b/src/com/android/settings/DevelopmentSettings.java @@ -74,9 +74,7 @@ public class DevelopmentSettings extends PreferenceActivity @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { - // Those monkeys kept committing suicide, so we add this property - // to disable this functionality - if (!TextUtils.isEmpty(SystemProperties.get("monkey.running"))) { + if (Utils.isMonkeyRunning()) { return false; } diff --git a/src/com/android/settings/LanguageSettings.java b/src/com/android/settings/LanguageSettings.java index 2f1bd2c..1b9f0c1 100644 --- a/src/com/android/settings/LanguageSettings.java +++ b/src/com/android/settings/LanguageSettings.java @@ -204,9 +204,7 @@ public class LanguageSettings extends PreferenceActivity { public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { // Input Method stuff - // Those monkeys kept committing suicide, so we add this property - // to disable this functionality - if (!TextUtils.isEmpty(SystemProperties.get("monkey.running"))) { + if (Utils.isMonkeyRunning()) { return false; } diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java index 6cd8ad3..fd4a411 100644 --- a/src/com/android/settings/MasterClear.java +++ b/src/com/android/settings/MasterClear.java @@ -61,9 +61,7 @@ public class MasterClear extends Activity { private Button.OnClickListener mFinalClickListener = new Button.OnClickListener() { public void onClick(View v) { - // Those monkeys kept committing suicide, so we add this property - // to disable going through with the master clear - if (!TextUtils.isEmpty(SystemProperties.get("monkey.running"))) { + if (Utils.isMonkeyRunning()) { return; } diff --git a/src/com/android/settings/MediaFormat.java b/src/com/android/settings/MediaFormat.java index 870507f..e0d9af6 100644 --- a/src/com/android/settings/MediaFormat.java +++ b/src/com/android/settings/MediaFormat.java @@ -61,9 +61,7 @@ public class MediaFormat extends Activity { private Button.OnClickListener mFinalClickListener = new Button.OnClickListener() { public void onClick(View v) { - // Those monkeys kept committing suicide, so we add this property - // to disable going through with the format - if (!TextUtils.isEmpty(SystemProperties.get("monkey.running"))) { + if (Utils.isMonkeyRunning()) { return; } IMountService service = diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java index a23272b..d4f1f11 100644 --- a/src/com/android/settings/Utils.java +++ b/src/com/android/settings/Utils.java @@ -21,6 +21,7 @@ import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.os.SystemProperties; import android.preference.Preference; import android.preference.PreferenceGroup; @@ -36,7 +37,7 @@ public class Utils { /** * Finds a matching activity for a preference's intent. If a matching * activity is not found, it will remove the preference. - * + * * @param context The context. * @param parentPreferenceGroup The preference group that contains the * preference whose intent is being resolved. @@ -50,12 +51,12 @@ public class Utils { */ public static boolean updatePreferenceToSpecificActivityOrRemove(Context context, PreferenceGroup parentPreferenceGroup, String preferenceKey, int flags) { - + Preference preference = parentPreferenceGroup.findPreference(preferenceKey); if (preference == null) { return false; } - + Intent intent = preference.getIntent(); if (intent != null) { // Find the activity that is in the system image @@ -66,7 +67,7 @@ public class Utils { ResolveInfo resolveInfo = list.get(i); if ((resolveInfo.activityInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { - + // Replace the intent with this specific activity preference.setIntent(new Intent().setClassName( resolveInfo.activityInfo.packageName, @@ -76,7 +77,7 @@ public class Utils { // Set the preference title to the activity's label preference.setTitle(resolveInfo.loadLabel(pm)); } - + return true; } } @@ -84,8 +85,15 @@ public class Utils { // Did not find a matching activity, so remove the preference parentPreferenceGroup.removePreference(preference); - + return true; } - + + /** + * Returns true if Monkey is running. + */ + public static boolean isMonkeyRunning() { + return SystemProperties.getBoolean("ro.monkey", false); + } + } |