diff options
author | Amith Yamasani <yamasani@google.com> | 2011-09-27 11:33:17 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2011-09-27 11:33:17 -0700 |
commit | ae69755aa874dbac77e9874d9716ab891a144193 (patch) | |
tree | 91a33f9fd43a0e9e22d38ffe48f0268954fb95e8 | |
parent | 0e5fd21beb33a39b4254d4c8dd6b60c0939dbee0 (diff) | |
download | packages_apps_settings-ae69755aa874dbac77e9874d9716ab891a144193.zip packages_apps_settings-ae69755aa874dbac77e9874d9716ab891a144193.tar.gz packages_apps_settings-ae69755aa874dbac77e9874d9716ab891a144193.tar.bz2 |
Disable USB connection type when monkeys are running.
Bug: 5375336
Also use the correct API for testing if monkeys are running.
(ActivityManager.isUserAMonkey())
Bug: 5375910
Change-Id: I2bf8e061ee5977d521de197d3a92095c1a98218d
-rw-r--r-- | src/com/android/settings/Utils.java | 3 | ||||
-rw-r--r-- | src/com/android/settings/deviceinfo/UsbSettings.java | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java index 90336e2..ac6cb64 100644 --- a/src/com/android/settings/Utils.java +++ b/src/com/android/settings/Utils.java @@ -16,6 +16,7 @@ package com.android.settings; +import android.app.ActivityManager; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; @@ -278,7 +279,7 @@ public class Utils { * Returns true if Monkey is running. */ public static boolean isMonkeyRunning() { - return SystemProperties.getBoolean("ro.monkey", false); + return ActivityManager.isUserAMonkey(); } /** diff --git a/src/com/android/settings/deviceinfo/UsbSettings.java b/src/com/android/settings/deviceinfo/UsbSettings.java index 538cde7..c8671b9 100644 --- a/src/com/android/settings/deviceinfo/UsbSettings.java +++ b/src/com/android/settings/deviceinfo/UsbSettings.java @@ -34,6 +34,7 @@ import android.util.Log; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; +import com.android.settings.Utils; /** * USB storage settings. @@ -111,6 +112,11 @@ public class UsbSettings extends SettingsPreferenceFragment { @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { + // Don't allow any changes to take effect as the USB host will be disconnected, killing + // the monkeys + if (Utils.isMonkeyRunning()) { + return true; + } // temporary hack - using check boxes as radio buttons // don't allow unchecking them if (preference instanceof CheckBoxPreference) { |