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
a5b573ea
Commit
a5b573ea
authored
Jan 15, 2017
by
tonymanou
Committed by
topjohnwu
Jan 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Read only the first line instead of loading the whole file
parent
cbb32f82
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
Async.java
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
+2
-3
Utils.java
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
+11
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
View file @
a5b573ea
...
@@ -218,9 +218,8 @@ public class Async {
...
@@ -218,9 +218,8 @@ public class Async {
protected
boolean
unzipAndCheck
()
{
protected
boolean
unzipAndCheck
()
{
ZipUtils
.
unzip
(
mCachedFile
,
mCachedFile
.
getParentFile
(),
"META-INF/com/google/android"
);
ZipUtils
.
unzip
(
mCachedFile
,
mCachedFile
.
getParentFile
(),
"META-INF/com/google/android"
);
List
<
String
>
ret
;
String
line
=
Utils
.
readFirstLine
(
mCachedFile
.
getParent
()
+
"/META-INF/com/google/android/updater-script"
);
ret
=
Utils
.
readFile
(
mCachedFile
.
getParent
()
+
"/META-INF/com/google/android/updater-script"
);
return
line
!=
null
&&
line
.
contains
(
"#MAGISK"
);
return
Utils
.
isValidShellResponse
(
ret
)
&&
ret
.
get
(
0
).
contains
(
"#MAGISK"
);
}
}
@Override
@Override
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Utils.java
View file @
a5b573ea
...
@@ -75,6 +75,17 @@ public class Utils {
...
@@ -75,6 +75,17 @@ public class Utils {
return
ret
;
return
ret
;
}
}
public
static
String
readFirstLine
(
String
path
)
{
List
<
String
>
ret
;
String
command
=
"head -1 "
+
path
;
if
(
Shell
.
rootAccess
())
{
ret
=
Shell
.
su
(
command
);
}
else
{
ret
=
Shell
.
sh
(
command
);
}
return
isValidShellResponse
(
ret
)
?
ret
.
get
(
0
)
:
null
;
}
public
static
void
dlAndReceive
(
Context
context
,
DownloadReceiver
receiver
,
String
link
,
String
filename
)
{
public
static
void
dlAndReceive
(
Context
context
,
DownloadReceiver
receiver
,
String
link
,
String
filename
)
{
if
(
isDownloading
)
{
if
(
isDownloading
)
{
return
;
return
;
...
...
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