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
945de8d9
Commit
945de8d9
authored
Feb 14, 2022
by
vvb2060
Committed by
John Wu
Feb 17, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Directly stream APK into install session
parent
6dabd3bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
18 deletions
+18
-18
DownloadActivity.java
.../src/main/java/com/topjohnwu/magisk/DownloadActivity.java
+14
-18
Request.java
stub/src/main/java/com/topjohnwu/magisk/net/Request.java
+4
-0
No files found.
stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java
View file @
945de8d9
...
...
@@ -116,28 +116,24 @@ public class DownloadActivity extends Activity {
private
void
dlAPK
()
{
dialog
=
ProgressDialog
.
show
(
themed
,
getString
(
dling
),
getString
(
dling
)
+
" "
+
APP_NAME
,
true
);
Runnable
onSuccess
=
()
->
{
dialog
.
dismiss
();
StubApk
.
restartProcess
(
this
);
finish
();
};
// Download and upgrade the app
File
apk
=
dynLoad
?
StubApk
.
current
(
this
)
:
new
File
(
getCacheDir
(),
"manager.apk"
);
request
(
apkLink
).
setExecutor
(
AsyncTask
.
THREAD_POOL_EXECUTOR
).
getAsFile
(
apk
,
file
->
{
if
(
dynLoad
)
{
runOnUiThread
(
onSuccess
);
}
else
{
var
request
=
request
(
apkLink
).
setExecutor
(
AsyncTask
.
THREAD_POOL_EXECUTOR
);
if
(
dynLoad
)
{
request
.
getAsFile
(
StubApk
.
current
(
this
),
file
->
StubApk
.
restartProcess
(
this
));
}
else
{
request
.
getAsInputStream
(
input
->
{
var
session
=
APKInstall
.
startSession
(
this
);
try
{
session
.
install
(
this
,
file
);
Intent
intent
=
session
.
waitIntent
();
if
(
intent
!=
null
)
startActivity
(
intent
);
try
(
input
;
var
out
=
session
.
openStream
(
this
))
{
if
(
out
!=
null
)
APKInstall
.
transfer
(
input
,
out
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
(
);
e
rror
(
e
);
}
}
});
Intent
intent
=
session
.
waitIntent
();
if
(
intent
!=
null
)
startActivity
(
intent
);
});
}
}
private
void
loadResources
()
{
...
...
stub/src/main/java/com/topjohnwu/magisk/net/Request.java
View file @
945de8d9
...
...
@@ -94,6 +94,10 @@ public class Request implements Closeable {
return
exec
(
this
::
getInputStream
);
}
public
void
getAsInputStream
(
ResponseListener
<
InputStream
>
rs
)
{
submit
(
this
::
getInputStream
,
rs
);
}
public
void
getAsFile
(
File
out
,
ResponseListener
<
File
>
rs
)
{
submit
(()
->
dlFile
(
out
),
rs
);
}
...
...
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