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
0f5465c5
Commit
0f5465c5
authored
Sep 29, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small fixes
parent
e4cba700
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
Repo.java
app/src/main/java/com/topjohnwu/magisk/module/Repo.java
+4
-0
Async.java
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
+8
-2
Shell.java
app/src/main/java/com/topjohnwu/magisk/utils/Shell.java
+2
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/module/Repo.java
View file @
0f5465c5
...
@@ -6,6 +6,7 @@ import android.preference.PreferenceManager;
...
@@ -6,6 +6,7 @@ import android.preference.PreferenceManager;
import
android.util.Log
;
import
android.util.Log
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.ModuleHelper
;
import
com.topjohnwu.magisk.utils.ModuleHelper
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.WebRequest
;
import
com.topjohnwu.magisk.utils.WebRequest
;
...
@@ -30,12 +31,15 @@ public class Repo extends BaseModule {
...
@@ -30,12 +31,15 @@ public class Repo extends BaseModule {
}
}
public
void
update
()
{
public
void
update
()
{
Logger
.
dev
(
"Repo: Re-fetch prop "
+
mId
);
String
props
=
WebRequest
.
makeWebServiceCall
(
mManifestUrl
,
WebRequest
.
GET
,
true
);
String
props
=
WebRequest
.
makeWebServiceCall
(
mManifestUrl
,
WebRequest
.
GET
,
true
);
String
lines
[]
=
props
.
split
(
"\\n"
);
String
lines
[]
=
props
.
split
(
"\\n"
);
parseProps
(
lines
);
parseProps
(
lines
);
}
}
public
void
update
(
Date
lastUpdate
)
{
public
void
update
(
Date
lastUpdate
)
{
Logger
.
dev
(
"Repo: Old: "
+
mLastUpdate
);
Logger
.
dev
(
"Repo: New: "
+
lastUpdate
);
if
(
lastUpdate
.
after
(
mLastUpdate
))
{
if
(
lastUpdate
.
after
(
mLastUpdate
))
{
mLastUpdate
=
lastUpdate
;
mLastUpdate
=
lastUpdate
;
update
();
update
();
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Async.java
View file @
0f5465c5
...
@@ -203,6 +203,7 @@ public class Async {
...
@@ -203,6 +203,7 @@ public class Async {
try
{
try
{
InputStream
in
=
mContext
.
getContentResolver
().
openInputStream
(
mUri
);
InputStream
in
=
mContext
.
getContentResolver
().
openInputStream
(
mUri
);
mFile
=
new
File
(
mContext
.
getCacheDir
().
getAbsolutePath
()
+
"/install.zip"
);
mFile
=
new
File
(
mContext
.
getCacheDir
().
getAbsolutePath
()
+
"/install.zip"
);
Utils
.
removeFile
(
mFile
.
getPath
());
createFileFromInputStream
(
in
,
mFile
);
createFileFromInputStream
(
in
,
mFile
);
in
.
close
();
in
.
close
();
}
catch
(
FileNotFoundException
e
)
{
}
catch
(
FileNotFoundException
e
)
{
...
@@ -251,7 +252,12 @@ public class Async {
...
@@ -251,7 +252,12 @@ public class Async {
}
}
// Copy the file to sdcard
// Copy the file to sdcard
if
(
copyToSD
&&
mFile
!=
null
)
{
if
(
copyToSD
&&
mFile
!=
null
)
{
sdFile
=
new
File
(
Environment
.
getExternalStorageDirectory
()
+
"/MagiskManager/"
+
(
mName
.
contains
(
".zip"
)
?
mName
:
mName
+
".zip"
).
replace
(
" "
,
"_"
));
String
filename
=
(
mName
.
contains
(
".zip"
)
?
mName
:
mName
+
".zip"
);
filename
=
filename
.
replace
(
" "
,
"_"
).
replace
(
"'"
,
""
).
replace
(
"\""
,
""
)
.
replace
(
"$"
,
""
).
replace
(
"`"
,
""
).
replace
(
"("
,
"_"
).
replace
(
")"
,
"_"
)
.
replace
(
"#"
,
""
).
replace
(
"@"
,
""
).
replace
(
"*"
,
""
);
sdFile
=
new
File
(
Environment
.
getExternalStorageDirectory
()
+
"/MagiskManager/"
+
filename
);
Logger
.
dev
(
"FlashZip: Copy zip back to "
+
sdFile
.
getPath
());
if
((!
sdFile
.
getParentFile
().
exists
()
&&
!
sdFile
.
getParentFile
().
mkdirs
())
||
(
sdFile
.
exists
()
&&
!
sdFile
.
delete
()))
{
if
((!
sdFile
.
getParentFile
().
exists
()
&&
!
sdFile
.
getParentFile
().
mkdirs
())
||
(
sdFile
.
exists
()
&&
!
sdFile
.
delete
()))
{
sdFile
=
null
;
sdFile
=
null
;
}
else
{
}
else
{
...
@@ -269,7 +275,7 @@ public class Async {
...
@@ -269,7 +275,7 @@ public class Async {
}
}
}
}
if
(
mFile
.
exists
()
&&
!
mFile
.
delete
())
{
if
(
mFile
.
exists
()
&&
!
mFile
.
delete
())
{
Shell
.
su
(
"rm -f "
+
mFile
.
getPath
());
Utils
.
removeFile
(
mFile
.
getPath
());
}
}
}
}
if
(
ret
!=
null
&&
Boolean
.
parseBoolean
(
ret
.
get
(
ret
.
size
()
-
1
)))
{
if
(
ret
!=
null
&&
Boolean
.
parseBoolean
(
ret
.
get
(
ret
.
size
()
-
1
)))
{
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Shell.java
View file @
0f5465c5
...
@@ -191,9 +191,11 @@ public class Shell {
...
@@ -191,9 +191,11 @@ public class Shell {
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
if
(!
e
.
getMessage
().
contains
(
"EPIPE"
))
{
if
(!
e
.
getMessage
().
contains
(
"EPIPE"
))
{
Logger
.
dev
(
"Shell: Root shell error..."
);
return
null
;
return
null
;
}
}
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
Logger
.
dev
(
"Shell: Root shell error..."
);
return
null
;
return
null
;
}
}
...
...
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