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
f3598946
Commit
f3598946
authored
Oct 18, 2018
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
APK图片抓取识别及轮播流地址抓取,客户端4.2版本文件读取问题
#BYLSERVER-1438
parent
3eb63bda
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
20 deletions
+44
-20
build.gradle
app/build.gradle
+1
-1
ApkInfo.kt
app/src/main/java/com/duolebo/blyrobot/data/ApkInfo.kt
+1
-1
Task.kt
app/src/main/java/com/duolebo/blyrobot/data/Task.kt
+21
-16
AppUtil.kt
app/src/main/java/com/duolebo/blyrobot/util/AppUtil.kt
+21
-2
No files found.
app/build.gradle
View file @
f3598946
...
...
@@ -33,7 +33,7 @@ android {
applicationVariants
.
all
{
variant
->
variant
.
outputs
.
all
{
outputFileName
=
"dlbr
e
bot_v${defaultConfig.versionName}_${releaseTime()}.apk"
outputFileName
=
"dlbr
o
bot_v${defaultConfig.versionName}_${releaseTime()}.apk"
}
}
}
...
...
app/src/main/java/com/duolebo/blyrobot/data/ApkInfo.kt
View file @
f3598946
...
...
@@ -40,7 +40,7 @@ class ApkInfo: IModel {
this
.
channelCount
=
json
.
optInt
(
CHANNEL_COUNT
,
5
)
this
.
channelKeyEvent
=
json
.
optString
(
CHANNEL_KEY_EVENT
)
this
.
mediaExt
=
json
.
optString
(
MEDIA_EXT
,
VIDEO_EXTS
)
this
.
filterUrl
=
json
.
optString
(
FILTER_URL
)
this
.
filterUrl
=
json
.
optString
(
FILTER_URL
,
""
)
this
.
menuKeyEvent
=
json
.
optString
(
MENU_KEY_EVENT
,
"ok"
)
return
true
...
...
app/src/main/java/com/duolebo/blyrobot/data/Task.kt
View file @
f3598946
...
...
@@ -30,16 +30,16 @@ class Task : IAppBaseCallback {
"0"
to
"未处理"
,
"1"
to
"进行中"
,
"2"
to
"中断"
,
"3"
to
"图片上传中"
,
"4"
to
"上报失败"
,
"5"
to
"处理完成"
)
"3"
to
"截图失败"
,
"4"
to
"图片上传中"
,
"5"
to
"上报失败"
,
"6"
to
"处理完成"
)
lateinit
var
apkInfo
:
ApkInfo
// 截图存放路径
private
lateinit
var
imagePath
:
String
// 抓包存放路径
private
var
capturePath
=
Environment
.
getExternalStorageDirectory
().
absolutePath
+
"/capture.txt"
private
var
capturePath
=
AppUtil
.
getAbsoluteSdcardPath
()
+
"/capture.txt"
private
var
uploadImages
=
ArrayList
<
String
>()
private
var
uploadId
=
""
...
...
@@ -65,8 +65,8 @@ class Task : IAppBaseCallback {
fun
from
(
apkInfo
:
ApkInfo
)
{
this
.
apkInfo
=
apkInfo
// this.imagePath = this.context.cacheDir.absolutePath + "/" + apkInfo.packageName
this
.
imagePath
=
Environment
.
getExternalStorageDirectory
().
absolute
Path
+
"/upload/"
+
apkInfo
.
packageName
val
sdPath
=
AppUtil
.
getAbsoluteSdcardPath
()
this
.
imagePath
=
sd
Path
+
"/upload/"
+
apkInfo
.
packageName
val
dir
=
File
(
this
.
imagePath
)
if
(!
dir
.
exists
())
dir
.
mkdirs
()
...
...
@@ -101,7 +101,7 @@ class Task : IAppBaseCallback {
this
.
processChannels
()
// 上传图片
this
.
uploadImage
()
this
.
status
=
"
3
"
this
.
status
=
"
4
"
}
catch
(
e
:
java
.
lang
.
Exception
)
{
this
.
status
=
"2"
e
.
printStackTrace
()
...
...
@@ -247,11 +247,11 @@ class Task : IAppBaseCallback {
val
host
=
it
.
substring
(
start
)
val
url
=
"http://$host$partUrl"
var
add
=
fals
e
var
add
=
tru
e
// 如果筛选url不为空,这里需要进行过滤
if
(!
this
.
apkInfo
.
filterUrl
.
is
NullOr
Empty
())
{
if
(
url
.
contains
(
this
.
apkInfo
.
filterUrl
))
add
=
tru
e
if
(!
this
.
apkInfo
.
filterUrl
.
isEmpty
())
{
if
(
!
url
.
contains
(
this
.
apkInfo
.
filterUrl
))
add
=
fals
e
}
if
(
add
)
{
...
...
@@ -301,7 +301,12 @@ class Task : IAppBaseCallback {
val
jpgPath
=
pngPath
.
replace
(
".png"
,
".jpg"
)
AdbUtil
.
screenShot
(
pngPath
)
// png转换成jpg
val
pngFile
=
File
(
pngPath
)
if
(
pngFile
.
exists
())
AppUtil
.
pngToJpg
(
pngPath
,
jpgPath
)
else
{
Log
.
i
(
TAG
,
"screen shot failed"
)
}
}
private
fun
uploadComplete
(
errorCount
:
Int
)
{
...
...
@@ -367,17 +372,17 @@ class Task : IAppBaseCallback {
}
override
fun
onProtocolFailed
(
p0
:
IProtocol
?)
{
this
.
status
=
"
4
"
this
.
status
=
"
5
"
finish
(
false
)
}
override
fun
onHttpFailed
(
p0
:
IProtocol
?)
{
this
.
status
=
"
4
"
this
.
status
=
"
5
"
finish
(
false
)
}
override
fun
onProtocolSucceed
(
p0
:
IProtocol
?)
{
this
.
status
=
"
5
"
this
.
status
=
"
6
"
finish
(
true
)
}
...
...
app/src/main/java/com/duolebo/blyrobot/util/AppUtil.kt
View file @
f3598946
...
...
@@ -9,8 +9,9 @@ import android.graphics.Bitmap
import
android.graphics.BitmapFactory
import
java.io.*
import
android.content.pm.PackageManager
import
android.os.Build
import
android.os.Environment
import
java.util.regex.Pattern
object
AppUtil
{
...
...
@@ -148,4 +149,22 @@ object AppUtil {
return
installed
}
fun
getAbsoluteSdcardPath
():
String
{
var
sdcardAbsPath
=
""
if
(
TextUtils
.
isEmpty
(
sdcardAbsPath
))
sdcardAbsPath
=
Environment
.
getExternalStorageDirectory
().
absolutePath
// 4.2系统存在legacy|0读取问题
if
(
Build
.
VERSION
.
SDK_INT
==
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
{
sdcardAbsPath
=
"/sdcard"
}
// val p = Pattern.compile("/?storage/emulated/\\d{1,2}")
// val m = p.matcher(sdcardAbsPath)
// if (m.find()) {
// sdcardAbsPath = sdcardAbsPath.replace("storage/emulated/", "storage/sdcard")
// }
return
sdcardAbsPath
}
}
\ 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