Update the intent that monkey uses to launch application
The purpose of the monkey event is to imitate user action of launching an app from launcher, and apparently launcher is using one extra flag FLAG_ACTIVITY_RESET_TASK_IF_NEEDED Bug: 6007633 Change-Id: Ie42cc84fd6235c9419b96bd9574056ed46687b25
This commit is contained in:
@@ -26,10 +26,10 @@ import android.view.IWindowManager;
|
|||||||
/**
|
/**
|
||||||
* monkey activity event
|
* monkey activity event
|
||||||
*/
|
*/
|
||||||
public class MonkeyActivityEvent extends MonkeyEvent {
|
public class MonkeyActivityEvent extends MonkeyEvent {
|
||||||
private ComponentName mApp;
|
private ComponentName mApp;
|
||||||
long mAlarmTime = 0;
|
long mAlarmTime = 0;
|
||||||
|
|
||||||
public MonkeyActivityEvent(ComponentName app) {
|
public MonkeyActivityEvent(ComponentName app) {
|
||||||
super(EVENT_TYPE_ACTIVITY);
|
super(EVENT_TYPE_ACTIVITY);
|
||||||
mApp = app;
|
mApp = app;
|
||||||
@@ -44,11 +44,11 @@ public class MonkeyActivityEvent extends MonkeyEvent {
|
|||||||
/**
|
/**
|
||||||
* @return Intent for the new activity
|
* @return Intent for the new activity
|
||||||
*/
|
*/
|
||||||
private Intent getEvent() {
|
private Intent getEvent() {
|
||||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||||
intent.setComponent(mApp);
|
intent.setComponent(mApp);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user