Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BYLAppRobot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuyang
BYLAppRobot
Commits
db9a79a1
Commit
db9a79a1
authored
Oct 25, 2018
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
任务中断恢复
parent
a7833cb4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
Task.kt
app/src/main/java/com/duolebo/blyrobot/data/Task.kt
+10
-6
TaskManager.kt
app/src/main/java/com/duolebo/blyrobot/tools/TaskManager.kt
+1
-0
No files found.
app/src/main/java/com/duolebo/blyrobot/data/Task.kt
View file @
db9a79a1
...
...
@@ -87,13 +87,15 @@ class Task : IAppBaseCallback {
this
.
launchApp
()
// 频道轮询处理
try
{
val
success
=
this
.
processChannels
()
val
success
=
this
.
processChannels
(
0
)
// 再次尝试
if
(!
success
)
{
this
.
reset
()
this
.
prepareReport
()
this
.
launchApp
()
this
.
processChannels
()
// 重新切换到上次崩溃的频道,接着抓取
for
(
i
in
0
until
this
.
channelIndex
)
{
AdbUtil
.
sendMultiKey
(
this
.
apkInfo
.
channelKeyEvent
)
}
this
.
processChannels
(
this
.
channelIndex
)
}
// 上传图片
this
.
uploadImage
()
...
...
@@ -159,16 +161,17 @@ class Task : IAppBaseCallback {
}
}
private
fun
processChannels
():
Boolean
{
private
fun
processChannels
(
index
:
Int
):
Boolean
{
Log
.
i
(
TAG
,
"processChannels"
)
step
()
for
(
i
in
1
until
this
.
apkInfo
.
channelCount
)
{
for
(
i
in
index
+
1
until
this
.
apkInfo
.
channelCount
)
{
// 模拟按键事件. 切换频道进行抓取
this
.
channelIndex
=
i
capture
(
apkInfo
.
captureDelay
)
AdbUtil
.
sendMultiKey
(
this
.
apkInfo
.
channelKeyEvent
)
if
(!
AppUtil
.
isAppBackground
(
context
,
this
.
apkInfo
.
packageName
))
{
Log
.
i
(
TAG
,
"targe app crashed?"
)
return
false
}
...
...
@@ -179,6 +182,7 @@ class Task : IAppBaseCallback {
}
private
fun
step
()
{
Log
.
i
(
TAG
,
"step channel ${this.channelIndex}"
)
// 截图保存
val
screenShots
=
saveScreenShot
()
if
(
screenShots
.
size
>
0
)
...
...
app/src/main/java/com/duolebo/blyrobot/tools/TaskManager.kt
View file @
db9a79a1
...
...
@@ -98,6 +98,7 @@ class TaskManager {
this
.
overTasks
.
clear
()
this
.
isRunning
=
false
this
.
updateTime
=
0L
}
companion
object
{
...
...
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