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
d453a8b0
Commit
d453a8b0
authored
Oct 11, 2018
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
APK图片抓取识别及轮播流地址抓取,客户端任务控制
#BYLSERVER-1438
parent
8b7715a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
6 deletions
+31
-6
Task.kt
app/src/main/java/com/duolebo/blyrobot/data/Task.kt
+13
-0
TaskManager.kt
app/src/main/java/com/duolebo/blyrobot/tools/TaskManager.kt
+18
-6
No files found.
app/src/main/java/com/duolebo/blyrobot/data/Task.kt
View file @
d453a8b0
...
...
@@ -102,6 +102,18 @@ class Task : IAppBaseCallback {
AdbUtil
.
stopApp
(
this
.
apkInfo
.
packageName
)
}
fun
reset
()
{
this
.
status
=
"0"
this
.
channelIndex
=
0
this
.
uploadImages
.
clear
()
val
dir
=
File
(
this
.
imagePath
)
if
(
dir
.
exists
())
{
for
(
file
in
dir
.
listFiles
())
file
.
delete
()
}
}
fun
destroy
()
{
// 杀掉tcpdump进程
AdbUtil
.
killTcpdump
()
...
...
@@ -283,6 +295,7 @@ class Task : IAppBaseCallback {
private
fun
uploadImageCallback
():
UploadStatusDelegate
{
val
totalUpload
=
this
.
uploadImages
.
size
Log
.
i
(
TAG
,
"total upload count : $totalUpload"
)
var
uploadCount
=
0
return
object
:
UploadStatusDelegate
{
...
...
app/src/main/java/com/duolebo/blyrobot/tools/TaskManager.kt
View file @
d453a8b0
...
...
@@ -6,18 +6,28 @@ import kotlin.collections.ArrayList
class
TaskManager
{
private
val
TAG
=
"TaskManager"
private
val
RUN_TASK_PERIOD
=
6
*
60
*
60
*
1000
val
tasks
=
ArrayList
<
Task
>()
private
var
isRunning
=
false
var
isRunning
=
false
private
var
status
=
IDLE
private
var
currentTask
:
Task
?=
null
// 处理时间
var
updateTime
=
0L
private
val
runnable
=
Runnable
{
val
dist
=
System
.
currentTimeMillis
()
-
updateTime
while
(
isRunning
&&
tasks
.
size
>
0
&&
dist
>
6
*
60
*
60
*
1000
)
{
this
.
updateTime
=
System
.
currentTimeMillis
()
currentTask
=
tasks
[
0
]
currentTask
!!
.
start
()
while
(
isRunning
&&
this
.
status
==
0
)
{
for
(
task
in
tasks
)
{
task
.
reset
()
currentTask
=
task
currentTask
!!
.
start
()
}
this
.
status
=
COMPLETE
Thread
.
sleep
(
3
*
1000
)
}
}
...
...
@@ -60,6 +70,7 @@ class TaskManager {
}
this
.
isRunning
=
true
this
.
status
=
0
val
t
=
Thread
(
runnable
)
t
.
start
()
}
...
...
@@ -70,11 +81,12 @@ class TaskManager {
it
.
destroy
()
}
this
.
tasks
.
clear
()
this
.
isRunning
=
false
}
companion
object
{
val
instance
=
TaskManager
()
const
val
IDLE
=
0
const
val
COMPLETE
=
1
}
}
\ No newline at end of file
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