Bug:
5375336
Also use the correct API for testing if monkeys are running.
(ActivityManager.isUserAMonkey())
Bug:
5375910
Change-Id: I2bf8e061ee5977d521de197d3a92095c1a98218d
package com.android.settings;
+import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
* Returns true if Monkey is running.
*/
public static boolean isMonkeyRunning() {
- return SystemProperties.getBoolean("ro.monkey", false);
+ return ActivityManager.isUserAMonkey();
}
/**
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.Utils;
/**
* USB storage settings.
@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) {