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
2c78c415
Commit
2c78c415
authored
Mar 10, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Android P cannot install from sdcardfs, use TMPDIR
parent
79ccb30d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
33 deletions
+8
-33
SettingsActivity.java
src/main/java/com/topjohnwu/magisk/SettingsActivity.java
+1
-15
HideManager.java
src/main/java/com/topjohnwu/magisk/asyncs/HideManager.java
+4
-4
ZipUtils.java
src/main/java/com/topjohnwu/magisk/utils/ZipUtils.java
+3
-14
No files found.
src/main/java/com/topjohnwu/magisk/SettingsActivity.java
View file @
2c78c415
...
@@ -159,9 +159,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
...
@@ -159,9 +159,7 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
if
(
mm
.
magiskVersionCode
>=
1440
)
{
if
(
mm
.
magiskVersionCode
>=
1440
)
{
if
(
mm
.
getPackageName
().
equals
(
Const
.
ORIG_PKG_NAME
))
{
if
(
mm
.
getPackageName
().
equals
(
Const
.
ORIG_PKG_NAME
))
{
hideManager
.
setOnPreferenceClickListener
((
pref
)
->
{
hideManager
.
setOnPreferenceClickListener
((
pref
)
->
{
Utils
.
runWithPermission
(
getActivity
(),
new
HideManager
(
getActivity
()).
exec
();
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
()
->
new
HideManager
(
getActivity
()).
exec
());
return
true
;
return
true
;
});
});
generalCatagory
.
removePreference
(
restoreManager
);
generalCatagory
.
removePreference
(
restoreManager
);
...
@@ -188,18 +186,6 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
...
@@ -188,18 +186,6 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
generalCatagory
.
removePreference
(
hideManager
);
generalCatagory
.
removePreference
(
hideManager
);
}
}
if
(
mm
.
getPackageName
().
equals
(
Const
.
ORIG_PKG_NAME
)
&&
mm
.
magiskVersionCode
>=
1440
)
{
hideManager
.
setOnPreferenceClickListener
((
pref
)
->
{
Utils
.
runWithPermission
(
getActivity
(),
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
()
->
new
HideManager
(
getActivity
()).
exec
());
return
true
;
});
generalCatagory
.
removePreference
(
restoreManager
);
}
else
{
generalCatagory
.
removePreference
(
hideManager
);
}
if
(!
Shell
.
rootAccess
()
||
(
Const
.
USER_ID
>
0
&&
if
(!
Shell
.
rootAccess
()
||
(
Const
.
USER_ID
>
0
&&
mm
.
multiuserMode
==
Const
.
Value
.
MULTIUSER_MODE_OWNER_MANAGED
))
{
mm
.
multiuserMode
==
Const
.
Value
.
MULTIUSER_MODE_OWNER_MANAGED
))
{
prefScreen
.
removePreference
(
suCategory
);
prefScreen
.
removePreference
(
suCategory
);
...
...
src/main/java/com/topjohnwu/magisk/asyncs/HideManager.java
View file @
2c78c415
...
@@ -11,9 +11,10 @@ import com.topjohnwu.magisk.utils.Utils;
...
@@ -11,9 +11,10 @@ import com.topjohnwu.magisk.utils.Utils;
import
com.topjohnwu.magisk.utils.ZipUtils
;
import
com.topjohnwu.magisk.utils.ZipUtils
;
import
com.topjohnwu.superuser.Shell
;
import
com.topjohnwu.superuser.Shell
;
import
com.topjohnwu.superuser.ShellUtils
;
import
com.topjohnwu.superuser.ShellUtils
;
import
com.topjohnwu.superuser.io.SuFile
;
import
com.topjohnwu.superuser.io.SuFileOutputStream
;
import
com.topjohnwu.utils.JarMap
;
import
com.topjohnwu.utils.JarMap
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.security.SecureRandom
;
import
java.security.SecureRandom
;
import
java.util.jar.JarEntry
;
import
java.util.jar.JarEntry
;
...
@@ -104,8 +105,7 @@ public class HideManager extends ParallelTask<Void, Void, Boolean> {
...
@@ -104,8 +105,7 @@ public class HideManager extends ParallelTask<Void, Void, Boolean> {
MagiskManager
mm
=
MagiskManager
.
get
();
MagiskManager
mm
=
MagiskManager
.
get
();
// Generate a new unhide app with random package name
// Generate a new unhide app with random package name
File
repack
=
new
File
(
Const
.
EXTERNAL_PATH
,
"repack.apk"
);
SuFile
repack
=
new
SuFile
(
"/data/local/tmp/repack.apk"
,
true
);
repack
.
getParentFile
().
mkdirs
();
String
pkg
=
genPackageName
(
"com."
,
Const
.
ORIG_PKG_NAME
.
length
());
String
pkg
=
genPackageName
(
"com."
,
Const
.
ORIG_PKG_NAME
.
length
());
try
{
try
{
...
@@ -123,7 +123,7 @@ public class HideManager extends ParallelTask<Void, Void, Boolean> {
...
@@ -123,7 +123,7 @@ public class HideManager extends ParallelTask<Void, Void, Boolean> {
apk
.
getOutputStream
(
je
).
write
(
xml
);
apk
.
getOutputStream
(
je
).
write
(
xml
);
// Sign the APK
// Sign the APK
ZipUtils
.
signZip
(
apk
,
repack
);
ZipUtils
.
signZip
(
apk
,
new
SuFileOutputStream
(
repack
)
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
false
;
return
false
;
...
...
src/main/java/com/topjohnwu/magisk/utils/ZipUtils.java
View file @
2c78c415
...
@@ -49,21 +49,10 @@ public class ZipUtils {
...
@@ -49,21 +49,10 @@ public class ZipUtils {
}
}
}
}
public
static
void
signZip
(
InputStream
is
,
File
output
)
throws
Exception
{
try
(
JarMap
map
=
new
JarMap
(
is
,
false
))
{
signZip
(
map
,
output
);
}
}
public
static
void
signZip
(
File
input
,
File
output
)
throws
Exception
{
public
static
void
signZip
(
File
input
,
File
output
)
throws
Exception
{
try
(
JarMap
map
=
new
JarMap
(
input
,
false
))
{
try
(
JarMap
map
=
new
JarMap
(
input
,
false
);
signZip
(
map
,
output
);
BufferedOutputStream
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
output
)))
{
}
signZip
(
map
,
out
);
}
public
static
void
signZip
(
JarMap
input
,
File
output
)
throws
Exception
{
try
(
BufferedOutputStream
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
output
)))
{
signZip
(
input
,
out
);
}
}
}
}
...
...
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