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
9b18960b
Commit
9b18960b
authored
Feb 02, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Getting APK doesn't need ContentProvider
parent
a009fdbd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
DynLoad.java
stub/src/main/java/com/topjohnwu/magisk/DynLoad.java
+10
-13
No files found.
stub/src/main/java/com/topjohnwu/magisk/DynLoad.java
View file @
9b18960b
package
com
.
topjohnwu
.
magisk
;
import
static
com
.
topjohnwu
.
magisk
.
BuildConfig
.
APPLICATION_ID
;
import
android.app.AppComponentFactory
;
import
android.app.Application
;
import
android.content.Context
;
...
...
@@ -7,7 +9,6 @@ import android.content.ContextWrapper;
import
android.content.pm.ApplicationInfo
;
import
android.content.pm.PackageInfo
;
import
android.content.pm.PackageManager
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Environment
;
import
android.util.Log
;
...
...
@@ -18,7 +19,6 @@ import java.io.File;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
...
...
@@ -105,19 +105,16 @@ public class DynLoad {
context
.
getExternalFilesDir
(
null
);
// If no APK to load, attempt to copy from previous app
if
(!
isDynLoader
()
&&
!
context
.
getPackageName
().
equals
(
BuildConfig
.
APPLICATION_ID
))
{
Uri
uri
=
new
Uri
.
Builder
().
scheme
(
"content"
)
.
authority
(
"com.topjohnwu.magisk.provider"
)
.
encodedPath
(
"apk_file"
).
build
();
if
(!
isDynLoader
()
&&
!
context
.
getPackageName
().
equals
(
APPLICATION_ID
))
{
try
{
InputStream
src
=
context
.
getContentResolver
().
openInputStream
(
uri
);
if
(
src
!=
null
)
{
var
info
=
context
.
getPackageManager
().
getApplicationInfo
(
APPLICATION_ID
,
0
);
var
src
=
new
FileInputStream
(
info
.
sourceDir
);
var
out
=
new
FileOutputStream
(
apk
);
try
(
src
;
out
)
{
APKInstall
.
transfer
(
src
,
out
);
}
loader
=
new
InjectedClassLoader
(
apk
);
}
}
catch
(
PackageManager
.
NameNotFoundException
ignored
)
{
}
catch
(
IOException
e
)
{
Log
.
e
(
DynLoad
.
class
.
getSimpleName
(),
""
,
e
);
apk
.
delete
();
...
...
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