Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
development
Commits
34ca4b64
Commit
34ca4b64
authored
14 years ago
by
Yu Shan Emily Lau
Committed by
Android (Google) Code Review
14 years ago
Browse files
Options
Download
Plain Diff
Merge "Add the support for the alarmManager and force the device to wake up." into froyo
parents
e46d0514
52bbaa30
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
6 deletions
+35
-6
cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java
.../src/com/android/commands/monkey/MonkeyActivityEvent.java
+19
-3
cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
...y/src/com/android/commands/monkey/MonkeySourceScript.java
+16
-3
No files found.
cmds/monkey/src/com/android/commands/monkey/MonkeyActivityEvent.java
View file @
34ca4b64
...
...
@@ -19,23 +19,32 @@ package com.android.commands.monkey;
import
android.app.IActivityManager
;
import
android.content.ComponentName
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.RemoteException
;
import
android.view.IWindowManager
;
import
android.util.Log
;
/**
* monkey activity event
*/
public
class
MonkeyActivityEvent
extends
MonkeyEvent
{
private
ComponentName
mApp
;
String
mAlarmTime
;
public
MonkeyActivityEvent
(
ComponentName
app
)
{
super
(
EVENT_TYPE_ACTIVITY
);
mApp
=
app
;
}
/**
public
MonkeyActivityEvent
(
ComponentName
app
,
String
arg
)
{
super
(
EVENT_TYPE_ACTIVITY
);
mApp
=
app
;
mAlarmTime
=
arg
;
}
/**
* @return Intent for the new activity
*/
*/
private
Intent
getEvent
()
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_MAIN
);
intent
.
addCategory
(
Intent
.
CATEGORY_LAUNCHER
);
...
...
@@ -50,6 +59,13 @@ public class MonkeyActivityEvent extends MonkeyEvent {
if
(
verbose
>
0
)
{
System
.
out
.
println
(
":Switch: "
+
intent
.
toURI
());
}
if
(
mAlarmTime
!=
null
){
Bundle
args
=
new
Bundle
();
args
.
putString
(
"alarmTime"
,
mAlarmTime
);
intent
.
putExtras
(
args
);
}
try
{
iam
.
startActivity
(
null
,
intent
,
null
,
null
,
0
,
null
,
null
,
0
,
false
,
false
);
...
...
This diff is collapsed.
Click to expand it.
cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
View file @
34ca4b64
...
...
@@ -27,6 +27,7 @@ import java.io.IOException;
import
java.io.InputStreamReader
;
import
java.util.NoSuchElementException
;
import
java.util.Random
;
import
android.util.Log
;
/**
* monkey event queue. It takes a script to produce events sample script format:
...
...
@@ -271,12 +272,24 @@ public class MonkeySourceScript implements MonkeyEventSource {
}
// Handle launch events
if
(
s
.
indexOf
(
EVENT_KEYWORD_ACTIVITY
)
>=
0
&&
args
.
length
=
=
2
)
{
if
(
s
.
indexOf
(
EVENT_KEYWORD_ACTIVITY
)
>=
0
&&
args
.
length
>
=
2
)
{
String
pkg_name
=
args
[
0
];
String
cl_name
=
args
[
1
];
String
alarmTime
=
null
;
ComponentName
mApp
=
new
ComponentName
(
pkg_name
,
cl_name
);
MonkeyActivityEvent
e
=
new
MonkeyActivityEvent
(
mApp
);
mQ
.
addLast
(
e
);
if
(
args
.
length
>
2
)
{
alarmTime
=
args
[
2
];
}
if
(
args
.
length
==
2
)
{
MonkeyActivityEvent
e
=
new
MonkeyActivityEvent
(
mApp
);
mQ
.
addLast
(
e
);
}
else
{
MonkeyActivityEvent
e
=
new
MonkeyActivityEvent
(
mApp
,
alarmTime
);
mQ
.
addLast
(
e
);
}
return
;
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment