am ae69755a: Disable USB connection type when monkeys are running.

* commit 'ae69755aa874dbac77e9874d9716ab891a144193':
  Disable USB connection type when monkeys are running.
This commit is contained in:
Amith Yamasani
2011-09-27 13:10:47 -07:00
committed by Android Git Automerger
2 changed files with 8 additions and 1 deletions

View File

@@ -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();
}
/**

View File

@@ -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.
@@ -110,6 +111,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) {