Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fuyue82
o2oa
提交
9e9aef89
o2oa
项目概览
fuyue82
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9e9aef89
编写于
9月 28, 2020
作者:
F
fancy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加Root检测
上级
6b1093da
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
230 addition
and
23 deletion
+230
-23
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/app/im/O2InstantMessageActivity.kt
...bpm/mobile/v1/zoneXBPM/app/im/O2InstantMessageActivity.kt
+3
-1
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/app/o2/launch/LaunchActivity.kt
.../x/bpm/mobile/v1/zoneXBPM/app/o2/launch/LaunchActivity.kt
+17
-13
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/app/o2/main/IndexFragment.kt
...and/x/bpm/mobile/v1/zoneXBPM/app/o2/main/IndexFragment.kt
+2
-1
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/app/o2/main/MyAppPresenter.kt
...nd/x/bpm/mobile/v1/zoneXBPM/app/o2/main/MyAppPresenter.kt
+8
-8
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/utils/CheckRoot.java
...et/zoneland/x/bpm/mobile/v1/zoneXBPM/utils/CheckRoot.java
+200
-0
未找到文件。
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/app/im/O2InstantMessageActivity.kt
浏览文件 @
9e9aef89
...
...
@@ -16,6 +16,7 @@ import net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.base.BaseMVPActivity
import
net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.bbs.main.BBSMainActivity
import
net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.calendar.CalendarMainActivity
import
net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.clouddrive.CloudDriveActivity
import
net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.clouddrive.v2.CloudDiskActivity
import
net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.cms.index.CMSIndexActivity
import
net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.meeting.main.MeetingMainActivity
import
net.zoneland.x.bpm.mobile.v1.zoneXBPM.app.o2.webview.TaskWebViewActivity
...
...
@@ -122,7 +123,8 @@ class O2InstantMessageActivity : BaseMVPActivity<O2InstantMessageContract.View,
}
}
else
if
(
type
.
startsWith
(
"attachment_"
))
{
setLinkStyle
(
textView
)
{
go
<
CloudDriveActivity
>()
// go<CloudDriveActivity>()
go
<
CloudDiskActivity
>()
}
}
else
if
(
type
.
startsWith
(
"calendar_"
))
{
setLinkStyle
(
textView
)
{
...
...
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/app/o2/launch/LaunchActivity.kt
浏览文件 @
9e9aef89
...
...
@@ -120,21 +120,25 @@ class LaunchActivity : BaseMVPActivity<LaunchContract.View, LaunchContract.Prese
fun
start
()
{
tv_launch_status
.
text
=
getString
(
R
.
string
.
launch_start
)
//开始启动
circleProgressBar_launch
.
visible
()
PermissionRequester
(
this
)
.
request
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
.
o2Subscribe
{
onNext
{
(
granted
,
shouldShowRequestPermissionRationale
,
deniedPermissions
)
->
Log
.
d
(
"LaunchActivity"
,
"granted:$granted, show:$shouldShowRequestPermissionRationale, deniedList:$deniedPermissions"
)
if
(!
granted
)
{
O2DialogSupport
.
openAlertDialog
(
this
@LaunchActivity
,
"非常抱歉,应用需要存储权限才能正常运行, 马上去设置"
,
{
permissionSetting
()
})
}
else
{
checkNetwork
()
if
(
CheckRoot
.
isDeviceRooted
())
{
O2DialogSupport
.
openAlertDialog
(
this
,
"当前是Root环境,App禁止使用!"
)
}
else
{
PermissionRequester
(
this
)
.
request
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
.
o2Subscribe
{
onNext
{
(
granted
,
shouldShowRequestPermissionRationale
,
deniedPermissions
)
->
Log
.
d
(
"LaunchActivity"
,
"granted:$granted, show:$shouldShowRequestPermissionRationale, deniedList:$deniedPermissions"
)
if
(!
granted
)
{
O2DialogSupport
.
openAlertDialog
(
this
@LaunchActivity
,
"非常抱歉,应用需要存储权限才能正常运行, 马上去设置"
,
{
permissionSetting
()
})
}
else
{
checkNetwork
()
}
}
onError
{
e
,
_
->
Log
.
e
(
"LaunchActivity"
,
"检查权限出错"
,
e
)
}
}
onError
{
e
,
_
->
Log
.
e
(
"LaunchActivity"
,
"检查权限出错"
,
e
)
}
}
}
}
/**
...
...
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/app/o2/main/IndexFragment.kt
浏览文件 @
9e9aef89
...
...
@@ -81,7 +81,8 @@ class IndexFragment : BaseMVPViewPagerFragment<IndexContract.View, IndexContract
ApplicationEnum
.
READCOMPLETED
.
key
->
activity
.
go
<
ReadCompletedListActivity
>()
ApplicationEnum
.
BBS
.
key
->
activity
.
go
<
BBSMainActivity
>()
ApplicationEnum
.
CMS
.
key
->
activity
.
go
<
CMSIndexActivity
>()
ApplicationEnum
.
YUNPAN
.
key
->
activity
.
go
<
CloudDriveActivity
>()
ApplicationEnum
.
YUNPAN
.
key
->
activity
.
go
<
CloudDiskActivity
>()
// ApplicationEnum.YUNPAN.key -> activity.go<CloudDriveActivity>()
ApplicationEnum
.
clouddisk
.
key
->
activity
.
go
<
CloudDiskActivity
>()
ApplicationEnum
.
MEETING
.
key
->
activity
.
go
<
MeetingMainActivity
>()
ApplicationEnum
.
ATTENDANCE
.
key
->
activity
.
go
<
AttendanceMainActivity
>()
...
...
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/app/o2/main/MyAppPresenter.kt
浏览文件 @
9e9aef89
...
...
@@ -35,10 +35,10 @@ class MyAppPresenter : BasePresenterImpl<MyAppContract.View>(), MyAppContract.Pr
obj
.
appTitle
=
it
.
name
result
.
add
(
obj
)
}
val
newCloudDiskApp
=
MyAppListObject
()
newCloudDiskApp
.
appId
=
ApplicationEnum
.
clouddisk
.
key
newCloudDiskApp
.
appTitle
=
ApplicationEnum
.
clouddisk
.
appName
result
.
add
(
newCloudDiskApp
)
//
val newCloudDiskApp = MyAppListObject()
//
newCloudDiskApp.appId = ApplicationEnum.clouddisk.key
//
newCloudDiskApp.appTitle = ApplicationEnum.clouddisk.appName
//
result.add(newCloudDiskApp)
service
.
findAllPortalList
()
}
?.
flatMap
{
list
->
...
...
@@ -66,10 +66,10 @@ class MyAppPresenter : BasePresenterImpl<MyAppContract.View>(), MyAppContract.Pr
obj
.
appTitle
=
it
.
name
result
.
add
(
obj
)
}
val
newCloudDiskApp
=
MyAppListObject
()
newCloudDiskApp
.
appId
=
ApplicationEnum
.
clouddisk
.
key
newCloudDiskApp
.
appTitle
=
ApplicationEnum
.
clouddisk
.
appName
result
.
add
(
newCloudDiskApp
)
//
val newCloudDiskApp = MyAppListObject()
//
newCloudDiskApp.appId = ApplicationEnum.clouddisk.key
//
newCloudDiskApp.appTitle = ApplicationEnum.clouddisk.appName
//
result.add(newCloudDiskApp)
portalList
.
filter
{
portal
->
portal
.
enable
}.
map
{
val
obj
=
MyAppListObject
()
obj
.
appId
=
it
.
id
...
...
o2android/app/src/main/java/net/zoneland/x/bpm/mobile/v1/zoneXBPM/utils/CheckRoot.java
0 → 100644
浏览文件 @
9e9aef89
package
net.zoneland.x.bpm.mobile.v1.zoneXBPM.utils
;
/**
* Created by fancyLou on 2020-09-28.
* Copyright © 2020 O2. All rights reserved.
*/
import
android.util.Log
;
import
java.io.BufferedReader
;
import
java.io.BufferedWriter
;
import
java.io.ByteArrayOutputStream
;
import
java.io.DataOutputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.InputStreamReader
;
import
java.io.OutputStreamWriter
;
import
java.util.ArrayList
;
public
class
CheckRoot
{
private
static
String
LOG_TAG
=
CheckRoot
.
class
.
getName
();
public
static
boolean
isDeviceRooted
()
{
if
(
checkDeviceDebuggable
())
{
return
true
;
}
//check buildTags
if
(
checkSuperuserApk
())
{
return
true
;
}
//Superuser.apk
//if (checkRootPathSU()){return true;}//find su in some path
//if (checkRootWhichSU()){return true;}//find su use 'which'
if
(
checkBusybox
())
{
return
true
;
}
//find su use 'which'
if
(
checkAccessRootData
())
{
return
true
;
}
//find su use 'which'
if
(
checkGetRootAuth
())
{
return
true
;
}
//exec su
return
false
;
}
public
static
boolean
checkDeviceDebuggable
()
{
String
buildTags
=
android
.
os
.
Build
.
TAGS
;
if
(
buildTags
!=
null
&&
buildTags
.
contains
(
"test-keys"
))
{
Log
.
i
(
LOG_TAG
,
"buildTags="
+
buildTags
);
return
true
;
}
return
false
;
}
public
static
boolean
checkSuperuserApk
()
{
try
{
File
file
=
new
File
(
"/system/app/Superuser.apk"
);
if
(
file
.
exists
())
{
Log
.
i
(
LOG_TAG
,
"/system/app/Superuser.apk exist"
);
return
true
;
}
}
catch
(
Exception
e
)
{
}
return
false
;
}
public
static
synchronized
boolean
checkGetRootAuth
()
{
Process
process
=
null
;
DataOutputStream
os
=
null
;
try
{
Log
.
i
(
LOG_TAG
,
"to exec su"
);
process
=
Runtime
.
getRuntime
().
exec
(
"su"
);
os
=
new
DataOutputStream
(
process
.
getOutputStream
());
os
.
writeBytes
(
"exit\n"
);
os
.
flush
();
int
exitValue
=
process
.
waitFor
();
Log
.
i
(
LOG_TAG
,
"exitValue="
+
exitValue
);
if
(
exitValue
==
0
)
{
return
true
;
}
else
{
return
false
;
}
}
catch
(
Exception
e
)
{
Log
.
i
(
LOG_TAG
,
"Unexpected error - Here is what I know: "
+
e
.
getMessage
());
return
false
;
}
finally
{
try
{
if
(
os
!=
null
)
{
os
.
close
();
}
process
.
destroy
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
public
static
synchronized
boolean
checkBusybox
()
{
try
{
Log
.
i
(
LOG_TAG
,
"to exec busybox df"
);
String
[]
strCmd
=
new
String
[]{
"busybox"
,
"df"
};
ArrayList
<
String
>
execResult
=
executeCommand
(
strCmd
);
if
(
execResult
!=
null
)
{
Log
.
i
(
LOG_TAG
,
"execResult="
+
execResult
.
toString
());
return
true
;
}
else
{
Log
.
i
(
LOG_TAG
,
"execResult=null"
);
return
false
;
}
}
catch
(
Exception
e
)
{
Log
.
i
(
LOG_TAG
,
"Unexpected error - Here is what I know: "
+
e
.
getMessage
());
return
false
;
}
}
public
static
ArrayList
<
String
>
executeCommand
(
String
[]
shellCmd
)
{
String
line
=
null
;
ArrayList
<
String
>
fullResponse
=
new
ArrayList
<
String
>();
Process
localProcess
=
null
;
try
{
Log
.
i
(
LOG_TAG
,
"to shell exec which for find su :"
);
localProcess
=
Runtime
.
getRuntime
().
exec
(
shellCmd
);
}
catch
(
Exception
e
)
{
return
null
;
}
BufferedWriter
out
=
new
BufferedWriter
(
new
OutputStreamWriter
(
localProcess
.
getOutputStream
()));
BufferedReader
in
=
new
BufferedReader
(
new
InputStreamReader
(
localProcess
.
getInputStream
()));
try
{
while
((
line
=
in
.
readLine
())
!=
null
)
{
Log
.
i
(
LOG_TAG
,
"–> Line received: "
+
line
);
fullResponse
.
add
(
line
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
Log
.
i
(
LOG_TAG
,
"–> Full response was: "
+
fullResponse
);
return
fullResponse
;
}
public
static
synchronized
boolean
checkAccessRootData
()
{
try
{
Log
.
i
(
LOG_TAG
,
"to write /data"
);
String
fileContent
=
"test_ok"
;
Boolean
writeFlag
=
writeFile
(
"/data/su_test"
,
fileContent
);
if
(
writeFlag
)
{
Log
.
i
(
LOG_TAG
,
"write ok"
);
}
else
{
Log
.
i
(
LOG_TAG
,
"write failed"
);
}
Log
.
i
(
LOG_TAG
,
"to read /data"
);
String
strRead
=
readFile
(
"/data/su_test"
);
Log
.
i
(
LOG_TAG
,
"strRead="
+
strRead
);
if
(
fileContent
.
equals
(
strRead
))
{
return
true
;
}
else
{
return
false
;
}
}
catch
(
Exception
e
)
{
Log
.
i
(
LOG_TAG
,
"Unexpected error - Here is what I know: "
+
e
.
getMessage
());
return
false
;
}
}
//写文件
public
static
Boolean
writeFile
(
String
fileName
,
String
message
)
{
try
{
FileOutputStream
fout
=
new
FileOutputStream
(
fileName
);
byte
[]
bytes
=
message
.
getBytes
();
fout
.
write
(
bytes
);
fout
.
close
();
return
true
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
false
;
}
}
//读文件
public
static
String
readFile
(
String
fileName
)
{
File
file
=
new
File
(
fileName
);
try
{
FileInputStream
fis
=
new
FileInputStream
(
file
);
byte
[]
bytes
=
new
byte
[
1024
];
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
int
len
;
while
((
len
=
fis
.
read
(
bytes
))
>
0
)
{
bos
.
write
(
bytes
,
0
,
len
);
}
String
result
=
new
String
(
bos
.
toByteArray
());
Log
.
i
(
LOG_TAG
,
result
);
return
result
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录