Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
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
Administrator
Magisk
Commits
4084e879
Commit
4084e879
authored
Dec 05, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix APK installation on old Android versions
parent
8d931dd7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
APKInstall.java
app/src/main/java/com/topjohnwu/magisk/utils/APKInstall.java
+7
-10
No files found.
app/src/main/java/com/topjohnwu/magisk/utils/APKInstall.java
View file @
4084e879
...
...
@@ -11,18 +11,15 @@ import androidx.core.content.FileProvider;
public
class
APKInstall
{
public
static
void
install
(
Context
c
,
File
apk
)
{
Intent
install
=
new
Intent
(
Intent
.
ACTION_INSTALL_PACKAGE
);
install
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
install
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
Intent
install
=
new
Intent
(
Intent
.
ACTION_INSTALL_PACKAGE
);
install
.
addFlags
(
Intent
.
FLAG_GRANT_READ_URI_PERMISSION
);
install
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
Uri
content
=
FileProvider
.
getUriForFile
(
c
,
c
.
getPackageName
()
+
".provider"
,
apk
);
install
.
setData
(
content
);
c
.
startActivity
(
install
);
install
.
setData
(
FileProvider
.
getUriForFile
(
c
,
c
.
getPackageName
()
+
".provider"
,
apk
));
}
else
{
Intent
install
=
new
Intent
(
Intent
.
ACTION_VIEW
);
install
.
setDataAndType
(
Uri
.
fromFile
(
apk
),
"application/vnd.android.package-archive"
);
install
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
c
.
startActivity
(
install
);
apk
.
setReadable
(
true
,
false
);
install
.
setData
(
Uri
.
fromFile
(
apk
));
}
c
.
startActivity
(
install
);
}
}
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