Don't let monkeys launch storage management activities.

Guard against monkeys in two places where intents to other activities are
launched.

Bug: 5415988
Change-Id: Ia3c5514c02423f7b249f655296bb02e279789dfd
This commit is contained in:
Amith Yamasani
2012-04-23 13:46:10 -07:00
parent c1da7b105a
commit 3fd8051a89
2 changed files with 12 additions and 5 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.applications;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.applications.ApplicationsState.AppEntry;
import android.app.Activity;
@@ -907,10 +908,12 @@ public class InstalledAppDetails extends Fragment
mActivitiesButton.setEnabled(false);
} else if(v == mClearDataButton) {
if (mAppEntry.info.manageSpaceActivityName != null) {
Intent intent = new Intent(Intent.ACTION_DEFAULT);
intent.setClassName(mAppEntry.info.packageName,
mAppEntry.info.manageSpaceActivityName);
startActivityForResult(intent, -1);
if (!Utils.isMonkeyRunning()) {
Intent intent = new Intent(Intent.ACTION_DEFAULT);
intent.setClassName(mAppEntry.info.packageName,
mAppEntry.info.manageSpaceActivityName);
startActivityForResult(intent, -1);
}
} else {
showDialogInner(DLG_CLEAR_DATA, 0);
}

View File

@@ -48,6 +48,7 @@ import android.widget.Toast;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
public class Memory extends SettingsPreferenceFragment {
private static final String TAG = "MemorySettings";
@@ -237,7 +238,10 @@ public class Memory extends SettingsPreferenceFragment {
StorageVolumePreferenceCategory svpc = mStorageVolumePreferenceCategories[i];
Intent intent = svpc.intentForClick(preference);
if (intent != null) {
startActivity(intent);
// Don't go across app boundary if monkey is running
if (!Utils.isMonkeyRunning()) {
startActivity(intent);
}
return true;
}