Still use ro.monkey

http://b/issue?id=1681101
So just some refactoring.
This commit is contained in:
Ying Wang
2010-01-04 18:45:10 -08:00
parent 50cb76f585
commit a718832e28
5 changed files with 19 additions and 19 deletions

View File

@@ -74,9 +74,7 @@ public class DevelopmentSettings extends PreferenceActivity
@Override @Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
// Those monkeys kept committing suicide, so we add this property if (Utils.isMonkeyRunning()) {
// to disable this functionality
if (!TextUtils.isEmpty(SystemProperties.get("monkey.running"))) {
return false; return false;
} }

View File

@@ -204,9 +204,7 @@ public class LanguageSettings extends PreferenceActivity {
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
// Input Method stuff // Input Method stuff
// Those monkeys kept committing suicide, so we add this property if (Utils.isMonkeyRunning()) {
// to disable this functionality
if (!TextUtils.isEmpty(SystemProperties.get("monkey.running"))) {
return false; return false;
} }

View File

@@ -61,9 +61,7 @@ public class MasterClear extends Activity {
private Button.OnClickListener mFinalClickListener = new Button.OnClickListener() { private Button.OnClickListener mFinalClickListener = new Button.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
// Those monkeys kept committing suicide, so we add this property if (Utils.isMonkeyRunning()) {
// to disable going through with the master clear
if (!TextUtils.isEmpty(SystemProperties.get("monkey.running"))) {
return; return;
} }

View File

@@ -61,9 +61,7 @@ public class MediaFormat extends Activity {
private Button.OnClickListener mFinalClickListener = new Button.OnClickListener() { private Button.OnClickListener mFinalClickListener = new Button.OnClickListener() {
public void onClick(View v) { public void onClick(View v) {
// Those monkeys kept committing suicide, so we add this property if (Utils.isMonkeyRunning()) {
// to disable going through with the format
if (!TextUtils.isEmpty(SystemProperties.get("monkey.running"))) {
return; return;
} }
IMountService service = IMountService service =

View File

@@ -21,6 +21,7 @@ import android.content.Intent;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.os.SystemProperties;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceGroup; import android.preference.PreferenceGroup;
@@ -88,4 +89,11 @@ public class Utils {
return true; return true;
} }
/**
* Returns true if Monkey is running.
*/
public static boolean isMonkeyRunning() {
return SystemProperties.getBoolean("ro.monkey", false);
}
} }