Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
huangzhicong
/
SmartCanteen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5f0003b3
authored
Mar 13, 2020
by
pye52
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化安装代理的业务逻辑
parent
b477048e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
app/src/main/java/com/bgycc/smartcanteen/utils/InstallManager.java
+4
-3
No files found.
app/src/main/java/com/bgycc/smartcanteen/utils/InstallManager.java
View file @
5f0003b3
...
...
@@ -12,18 +12,19 @@ import static com.bgycc.smartcanteen.utils.SmartCanteenUtils.TAG;
public
class
InstallManager
{
public
static
boolean
install
(
File
updateApk
)
{
String
model
=
Build
.
MODEL
;
if
(
model
.
contains
(
DeviceProxy
.
DEVICE_MODEL_TPS
)
)
{
if
(
Build
.
VERSION
.
SDK_INT
<=
Build
.
VERSION_CODES
.
M
)
{
// 6.0以下安装包需要修改权限才能安装
try
{
Process
p
=
Runtime
.
getRuntime
().
exec
(
"chmod 755 "
+
updateApk
);
p
.
waitFor
();
DangerousUtils
.
installAppSilent
(
updateApk
);
LogUtils
.
d
(
TAG
,
"开始安装"
);
return
true
;
}
catch
(
Exception
e
)
{
LogUtils
.
e
(
TAG
,
"安装文件权限修改失败"
);
return
false
;
}
}
if
(
model
.
contains
(
DeviceProxy
.
DEVICE_MODEL_TPS
))
{
return
DangerousUtils
.
installAppSilent
(
updateApk
);
}
else
if
(
model
.
contains
(
DeviceProxy
.
DEVICE_MODEL_QUAD
))
{
AppUtils
.
installApp
(
updateApk
);
return
true
;
...
...
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