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
59ec27c5
Commit
59ec27c5
authored
Oct 25, 2018
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
任务中断恢复
parent
db9a79a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
MainActivity.kt
app/src/main/java/com/duolebo/blyrobot/MainActivity.kt
+2
-0
Task.kt
app/src/main/java/com/duolebo/blyrobot/data/Task.kt
+3
-3
AppUtil.kt
app/src/main/java/com/duolebo/blyrobot/util/AppUtil.kt
+2
-2
No files found.
app/src/main/java/com/duolebo/blyrobot/MainActivity.kt
View file @
59ec27c5
...
...
@@ -64,6 +64,8 @@ class MainActivity : AppCompatActivity(), IAppBaseCallback {
textView
.
setText
(
R
.
string
.
tips_device_not_root
)
}
AdbUtil
.
exeCmdEcho
(
"ls"
,
true
)
startRobotService
()
startBtn
.
setOnClickListener
{
...
...
app/src/main/java/com/duolebo/blyrobot/data/Task.kt
View file @
59ec27c5
...
...
@@ -23,7 +23,7 @@ import kotlin.collections.ArrayList
class
Task
:
IAppBaseCallback
{
private
val
TAG
=
"Task"
private
val
TAG
=
"
Robot
Task"
val
STATUS_MAP
=
mapOf
(
"0"
to
"未处理"
,
...
...
@@ -84,7 +84,7 @@ class Task : IAppBaseCallback {
this
.
status
=
"1"
this
.
prepareReport
()
// 启动应用
this
.
launchApp
()
this
.
launchApp
(
true
)
// 频道轮询处理
try
{
val
success
=
this
.
processChannels
(
0
)
...
...
@@ -170,7 +170,7 @@ class Task : IAppBaseCallback {
capture
(
apkInfo
.
captureDelay
)
AdbUtil
.
sendMultiKey
(
this
.
apkInfo
.
channelKeyEvent
)
if
(!
AppUtil
.
isApp
Back
ground
(
context
,
this
.
apkInfo
.
packageName
))
{
if
(!
AppUtil
.
isApp
Fore
ground
(
context
,
this
.
apkInfo
.
packageName
))
{
Log
.
i
(
TAG
,
"targe app crashed?"
)
return
false
}
...
...
app/src/main/java/com/duolebo/blyrobot/util/AppUtil.kt
View file @
59ec27c5
...
...
@@ -173,7 +173,7 @@ object AppUtil {
return
sdcardAbsPath
}
fun
isApp
Back
ground
(
context
:
Context
,
packageName
:
String
):
Boolean
{
fun
isApp
Fore
ground
(
context
:
Context
,
packageName
:
String
):
Boolean
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
return
AdbUtil
.
isAppActive
(
packageName
)
...
...
@@ -183,7 +183,7 @@ object AppUtil {
val
appProcesses
=
activityManager
.
runningAppProcesses
for
(
appProcess
in
appProcesses
)
{
if
(
appProcess
.
processName
==
packageName
)
{
return
appProcess
.
importance
==
RunningAppProcessInfo
.
IMPORTANCE_
BACK
GROUND
return
appProcess
.
importance
==
RunningAppProcessInfo
.
IMPORTANCE_
FORE
GROUND
}
}
return
false
...
...
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