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
0c247110
Commit
0c247110
authored
Aug 29, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also get default flags in non-root environment
parent
1643638a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
18 deletions
+29
-18
MagiskInstallDialog.java
.../com/topjohnwu/magisk/components/MagiskInstallDialog.java
+4
-4
RootUtils.java
app/src/full/java/com/topjohnwu/magisk/utils/RootUtils.java
+12
-14
nonroot_utils.sh
app/src/full/res/raw/nonroot_utils.sh
+13
-0
No files found.
app/src/full/java/com/topjohnwu/magisk/components/MagiskInstallDialog.java
View file @
0c247110
...
@@ -29,11 +29,11 @@ public class MagiskInstallDialog extends CustomAlertDialog {
...
@@ -29,11 +29,11 @@ public class MagiskInstallDialog extends CustomAlertDialog {
options
.
add
(
mm
.
getString
(
R
.
string
.
patch_boot_file
));
options
.
add
(
mm
.
getString
(
R
.
string
.
patch_boot_file
));
if
(
Shell
.
rootAccess
())
{
if
(
Shell
.
rootAccess
())
{
options
.
add
(
mm
.
getString
(
R
.
string
.
direct_install
));
options
.
add
(
mm
.
getString
(
R
.
string
.
direct_install
));
}
String
s
=
ShellUtils
.
fastCmd
(
"grep_prop ro.build.ab_update"
);
String
s
=
ShellUtils
.
fastCmd
(
"grep_prop ro.build.ab_update"
);
if
(!
s
.
isEmpty
()
&&
Boolean
.
parseBoolean
(
s
))
{
if
(!
s
.
isEmpty
()
&&
Boolean
.
parseBoolean
(
s
))
{
options
.
add
(
mm
.
getString
(
R
.
string
.
install_inactive_slot
));
options
.
add
(
mm
.
getString
(
R
.
string
.
install_inactive_slot
));
}
}
}
new
InstallMethodDialog
(
activity
,
options
).
show
();
new
InstallMethodDialog
(
activity
,
options
).
show
();
});
});
setNegativeButton
(
R
.
string
.
no_thanks
,
null
);
setNegativeButton
(
R
.
string
.
no_thanks
,
null
);
...
...
app/src/full/java/com/topjohnwu/magisk/utils/RootUtils.java
View file @
0c247110
...
@@ -12,7 +12,6 @@ import com.topjohnwu.superuser.ShellUtils;
...
@@ -12,7 +12,6 @@ import com.topjohnwu.superuser.ShellUtils;
import
com.topjohnwu.superuser.io.SuFile
;
import
com.topjohnwu.superuser.io.SuFile
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
public
class
RootUtils
extends
Shell
.
Initializer
{
public
class
RootUtils
extends
Shell
.
Initializer
{
...
@@ -27,17 +26,11 @@ public class RootUtils extends Shell.Initializer {
...
@@ -27,17 +26,11 @@ public class RootUtils extends Shell.Initializer {
@Override
@Override
public
boolean
onInit
(
Context
context
,
@NonNull
Shell
shell
)
{
public
boolean
onInit
(
Context
context
,
@NonNull
Shell
shell
)
{
Shell
.
Job
job
=
shell
.
newJob
();
if
(
shell
.
isRoot
())
{
if
(
shell
.
isRoot
())
{
try
(
InputStream
magiskUtils
=
context
.
getResources
().
openRawResource
(
R
.
raw
.
util_functions
);
InputStream
magiskUtils
=
context
.
getResources
().
openRawResource
(
R
.
raw
.
util_functions
);
InputStream
managerUtils
=
context
.
getResources
().
openRawResource
(
R
.
raw
.
utils
)
InputStream
managerUtils
=
context
.
getResources
().
openRawResource
(
R
.
raw
.
utils
);
)
{
job
.
add
(
magiskUtils
).
add
(
managerUtils
);
shell
.
newJob
()
.
add
(
magiskUtils
).
add
(
managerUtils
)
.
add
(
"mount_partitions"
,
"get_flags"
,
"run_migrations"
)
.
exec
();
}
catch
(
IOException
e
)
{
return
false
;
}
Const
.
MAGISK_DISABLE_FILE
=
new
SuFile
(
"/cache/.disable_magisk"
);
Const
.
MAGISK_DISABLE_FILE
=
new
SuFile
(
"/cache/.disable_magisk"
);
SuFile
file
=
new
SuFile
(
"/sbin/.core/img"
);
SuFile
file
=
new
SuFile
(
"/sbin/.core/img"
);
...
@@ -51,10 +44,15 @@ public class RootUtils extends Shell.Initializer {
...
@@ -51,10 +44,15 @@ public class RootUtils extends Shell.Initializer {
Const
.
MAGISK_HOST_FILE
=
new
SuFile
(
Const
.
MAGISK_PATH
+
"/.core/hosts"
);
Const
.
MAGISK_HOST_FILE
=
new
SuFile
(
Const
.
MAGISK_PATH
+
"/.core/hosts"
);
Data
.
loadMagiskInfo
();
Data
.
loadMagiskInfo
();
}
else
{
InputStream
nonroot
=
context
.
getResources
().
openRawResource
(
R
.
raw
.
nonroot_utils
);
job
.
add
(
nonroot
);
}
job
.
add
(
"mount_partitions"
,
"get_flags"
,
"run_migrations"
).
exec
();
Data
.
keepVerity
=
Boolean
.
parseBoolean
(
ShellUtils
.
fastCmd
(
"echo $KEEPVERITY"
));
Data
.
keepVerity
=
Boolean
.
parseBoolean
(
ShellUtils
.
fastCmd
(
"echo $KEEPVERITY"
));
Data
.
keepEnc
=
Boolean
.
parseBoolean
(
ShellUtils
.
fastCmd
(
"echo $KEEPFORCEENCRYPT"
));
Data
.
keepEnc
=
Boolean
.
parseBoolean
(
ShellUtils
.
fastCmd
(
"echo $KEEPFORCEENCRYPT"
));
}
return
true
;
return
true
;
}
}
}
}
app/src/full/res/raw/nonroot_utils.sh
0 → 100644
View file @
0c247110
mount_partitions
()
{
[
"
`
getprop ro.build.ab_update
`
"
=
"true"
]
&&
SLOT
=
`
getprop ro.boot.slot_suffix
`
||
SLOT
=
[
"
`
getprop ro.build.system_root_image
`
"
=
"true"
]
&&
SYSTEM_ROOT
=
true
||
SYSTEM_ROOT
=
false
}
get_flags
()
{
$SYSTEM_ROOT
&&
KEEPVERITY
=
true
||
KEEPVERITY
=
false
[
"
`
getprop ro.crypto.state
`
"
=
"encrypted"
]
&&
KEEPFORCEENCRYPT
=
true
||
KEEPFORCEENCRYPT
=
false
}
run_migrations
()
{
# NOP
}
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