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
0893ac31
Commit
0893ac31
authored
May 01, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No more old module exists
parent
fb40e969
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
31 deletions
+14
-31
DownloadModuleService.java
...opjohnwu/magisk/model/download/DownloadModuleService.java
+14
-17
Repo.java
...src/main/java/com/topjohnwu/magisk/model/entity/Repo.java
+0
-14
No files found.
app/src/main/java/com/topjohnwu/magisk/model/download/DownloadModuleService.java
View file @
0893ac31
...
@@ -25,7 +25,6 @@ import java.io.FileOutputStream;
...
@@ -25,7 +25,6 @@ import java.io.FileOutputStream;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipEntry
;
...
@@ -95,7 +94,7 @@ public class DownloadModuleService extends Service {
...
@@ -95,7 +94,7 @@ public class DownloadModuleService extends Service {
.
setDownloadProgressListener
(
progress
)
.
setDownloadProgressListener
(
progress
)
.
execForInputStream
().
getResult
();
.
execForInputStream
().
getResult
();
OutputStream
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
output
));
OutputStream
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
output
));
processZip
(
in
,
out
,
repo
.
isNewInstaller
()
);
processZip
(
in
,
out
);
Intent
intent
=
new
Intent
(
this
,
ClassMap
.
get
(
FlashActivity
.
class
));
Intent
intent
=
new
Intent
(
this
,
ClassMap
.
get
(
FlashActivity
.
class
));
intent
.
setData
(
Uri
.
fromFile
(
output
))
intent
.
setData
(
Uri
.
fromFile
(
output
))
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
...
@@ -120,25 +119,23 @@ public class DownloadModuleService extends Service {
...
@@ -120,25 +119,23 @@ public class DownloadModuleService extends Service {
removeNotification
(
progress
);
removeNotification
(
progress
);
}
}
private
void
processZip
(
InputStream
in
,
OutputStream
out
,
boolean
inject
)
private
void
processZip
(
InputStream
in
,
OutputStream
out
)
throws
IOException
{
throws
IOException
{
try
(
ZipInputStream
zin
=
new
ZipInputStream
(
in
);
try
(
ZipInputStream
zin
=
new
ZipInputStream
(
in
);
ZipOutputStream
zout
=
new
ZipOutputStream
(
out
))
{
ZipOutputStream
zout
=
new
ZipOutputStream
(
out
))
{
if
(
inject
)
{
// Inject latest module-installer.sh as update-binary
// Inject latest module-installer.sh as update-binary
zout
.
putNextEntry
(
new
ZipEntry
(
"META-INF/"
));
zout
.
putNextEntry
(
new
ZipEntry
(
"META-INF/"
));
zout
.
putNextEntry
(
new
ZipEntry
(
"META-INF/com/"
));
zout
.
putNextEntry
(
new
ZipEntry
(
"META-INF/com/"
));
zout
.
putNextEntry
(
new
ZipEntry
(
"META-INF/com/google/"
));
zout
.
putNextEntry
(
new
ZipEntry
(
"META-INF/com/google/"
));
zout
.
putNextEntry
(
new
ZipEntry
(
"META-INF/com/google/android/"
));
zout
.
putNextEntry
(
new
ZipEntry
(
"META-INF/com/google/android/"
));
zout
.
putNextEntry
(
new
ZipEntry
(
"META-INF/com/google/android/update-binary"
));
zout
.
putNextEntry
(
new
ZipEntry
(
"META-INF/com/google/android/update-binary"
));
try
(
InputStream
update_bin
=
Networking
.
get
(
Const
.
Url
.
MODULE_INSTALLER
)
try
(
InputStream
update_bin
=
Networking
.
get
(
Const
.
Url
.
MODULE_INSTALLER
)
.
execForInputStream
().
getResult
())
{
.
execForInputStream
().
getResult
())
{
ShellUtils
.
pump
(
update_bin
,
zout
);
ShellUtils
.
pump
(
update_bin
,
zout
);
}
zout
.
putNextEntry
(
new
ZipEntry
(
"META-INF/com/google/android/updater-script"
));
zout
.
write
(
"#MAGISK\n"
.
getBytes
(
StandardCharsets
.
UTF_8
));
}
}
zout
.
putNextEntry
(
new
ZipEntry
(
"META-INF/com/google/android/updater-script"
));
zout
.
write
(
"#MAGISK\n"
.
getBytes
(
"UTF-8"
));
int
off
=
-
1
;
int
off
=
-
1
;
ZipEntry
entry
;
ZipEntry
entry
;
...
@@ -148,7 +145,7 @@ public class DownloadModuleService extends Service {
...
@@ -148,7 +145,7 @@ public class DownloadModuleService extends Service {
String
path
=
entry
.
getName
().
substring
(
off
);
String
path
=
entry
.
getName
().
substring
(
off
);
if
(
path
.
isEmpty
())
if
(
path
.
isEmpty
())
continue
;
continue
;
if
(
inject
&&
path
.
startsWith
(
"META-INF"
))
if
(
path
.
startsWith
(
"META-INF"
))
continue
;
continue
;
zout
.
putNextEntry
(
new
ZipEntry
(
path
));
zout
.
putNextEntry
(
new
ZipEntry
(
path
));
if
(!
entry
.
isDirectory
())
if
(!
entry
.
isDirectory
())
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/Repo.java
View file @
0893ac31
...
@@ -7,8 +7,6 @@ import android.os.Parcelable;
...
@@ -7,8 +7,6 @@ import android.os.Parcelable;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.net.Networking
;
import
com.topjohnwu.net.Request
;
import
java.text.DateFormat
;
import
java.text.DateFormat
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -91,18 +89,6 @@ public class Repo extends BaseModule {
...
@@ -91,18 +89,6 @@ public class Repo extends BaseModule {
return
String
.
format
(
Const
.
Url
.
FILE_URL
,
getId
(),
file
);
return
String
.
format
(
Const
.
Url
.
FILE_URL
,
getId
(),
file
);
}
}
public
boolean
isNewInstaller
()
{
try
(
Request
install
=
Networking
.
get
(
getFileUrl
(
"install.sh"
)))
{
if
(
install
.
connect
().
isSuccess
())
{
// Double check whether config.sh exists
try
(
Request
config
=
Networking
.
get
(
getFileUrl
(
"config.sh"
)))
{
return
!
config
.
connect
().
isSuccess
();
}
}
return
false
;
}
}
public
String
getLastUpdateString
()
{
public
String
getLastUpdateString
()
{
return
DateFormat
.
getDateTimeInstance
(
DateFormat
.
MEDIUM
,
DateFormat
.
MEDIUM
).
format
(
mLastUpdate
);
return
DateFormat
.
getDateTimeInstance
(
DateFormat
.
MEDIUM
,
DateFormat
.
MEDIUM
).
format
(
mLastUpdate
);
}
}
...
...
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