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
43b7ef81
Commit
43b7ef81
authored
Feb 02, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add disable, change busybox
parent
99ef0b8c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
16 deletions
+37
-16
SettingsActivity.java
app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java
+30
-16
strings.xml
app/src/main/res/values/strings.xml
+2
-0
app_settings.xml
app/src/main/res/xml/app_settings.xml
+5
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/SettingsActivity.java
View file @
43b7ef81
...
@@ -21,6 +21,9 @@ import com.topjohnwu.magisk.utils.Logger;
...
@@ -21,6 +21,9 @@ import com.topjohnwu.magisk.utils.Logger;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.File
;
import
java.io.IOException
;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.ButterKnife
;
...
@@ -137,28 +140,41 @@ public class SettingsActivity extends AppCompatActivity {
...
@@ -137,28 +140,41 @@ public class SettingsActivity extends AppCompatActivity {
Global
.
Events
.
reloadMainActivity
.
trigger
();
Global
.
Events
.
reloadMainActivity
.
trigger
();
}
}
break
;
break
;
case
"magiskhide"
:
case
"disable"
:
enabled
=
prefs
.
getBoolean
(
"magiskhide"
,
false
);
enabled
=
prefs
.
getBoolean
(
"disable"
,
false
);
File
disable
=
new
File
(
getActivity
().
getFilesDir
()
+
"/disable"
);
if
(
enabled
)
if
(
enabled
)
new
Async
.
MagiskHide
().
enable
();
try
{
disable
.
createNewFile
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
prefs
.
edit
().
putBoolean
(
"disable"
,
false
).
apply
();
}
else
else
new
Async
.
MagiskHide
().
disable
();
disable
.
delete
();
Toast
.
makeText
(
getActivity
(),
R
.
string
.
settings_reboot_toast
,
Toast
.
LENGTH_LONG
).
show
();
break
;
break
;
case
"busybox"
:
case
"busybox"
:
enabled
=
prefs
.
getBoolean
(
"busybox"
,
false
);
enabled
=
prefs
.
getBoolean
(
"busybox"
,
false
);
new
Async
.
RootTask
<
Void
,
Void
,
Void
>()
{
File
busybox
=
new
File
(
getActivity
().
getFilesDir
()
+
"/busybox"
);
private
boolean
enable
=
enabled
;
if
(
enabled
)
@Override
try
{
protected
Void
doInBackground
(
Void
...
params
)
{
busybox
.
createNewFile
();
if
(
enable
)
}
catch
(
IOException
e
)
{
Utils
.
createFile
(
"/magisk/.core/busybox/enable"
);
e
.
printStackTrace
();
else
prefs
.
edit
().
putBoolean
(
"busybox"
,
false
).
apply
();
Utils
.
removeItem
(
"/magisk/.core/busybox/enable"
);
return
null
;
}
}
}.
exec
();
else
busybox
.
delete
();
Toast
.
makeText
(
getActivity
(),
R
.
string
.
settings_reboot_toast
,
Toast
.
LENGTH_LONG
).
show
();
Toast
.
makeText
(
getActivity
(),
R
.
string
.
settings_reboot_toast
,
Toast
.
LENGTH_LONG
).
show
();
break
;
break
;
case
"magiskhide"
:
enabled
=
prefs
.
getBoolean
(
"magiskhide"
,
false
);
if
(
enabled
)
new
Async
.
MagiskHide
().
enable
();
else
new
Async
.
MagiskHide
().
disable
();
break
;
case
"hosts"
:
case
"hosts"
:
enabled
=
prefs
.
getBoolean
(
"hosts"
,
false
);
enabled
=
prefs
.
getBoolean
(
"hosts"
,
false
);
new
Async
.
RootTask
<
Void
,
Void
,
Void
>()
{
new
Async
.
RootTask
<
Void
,
Void
,
Void
>()
{
...
@@ -179,8 +195,6 @@ public class SettingsActivity extends AppCompatActivity {
...
@@ -179,8 +195,6 @@ public class SettingsActivity extends AppCompatActivity {
case
"su_access"
:
case
"su_access"
:
Global
.
Configs
.
suAccessState
=
Utils
.
getPrefsInt
(
prefs
,
"su_access"
,
0
);
Global
.
Configs
.
suAccessState
=
Utils
.
getPrefsInt
(
prefs
,
"su_access"
,
0
);
Shell
.
su
(
"setprop persist.sys.root_access "
+
Global
.
Configs
.
suAccessState
);
Shell
.
su
(
"setprop persist.sys.root_access "
+
Global
.
Configs
.
suAccessState
);
suAccess
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
su_access
)[
Global
.
Configs
.
suAccessState
]);
break
;
break
;
case
"su_request_timeout"
:
case
"su_request_timeout"
:
Global
.
Configs
.
suRequestTimeout
=
Utils
.
getPrefsInt
(
prefs
,
"su_request_timeout"
,
10
);
Global
.
Configs
.
suRequestTimeout
=
Utils
.
getPrefsInt
(
prefs
,
"su_request_timeout"
,
10
);
...
...
app/src/main/res/values/strings.xml
View file @
43b7ef81
...
@@ -185,5 +185,7 @@
...
@@ -185,5 +185,7 @@
<string
name=
"pid"
>
PID:\u0020
</string>
<string
name=
"pid"
>
PID:\u0020
</string>
<string
name=
"target_uid"
>
Target UID:\u0020
</string>
<string
name=
"target_uid"
>
Target UID:\u0020
</string>
<string
name=
"command"
>
Command:\u0020
</string>
<string
name=
"command"
>
Command:\u0020
</string>
<string
name=
"settings_disable_title"
>
Disable Magic Mount
</string>
<string
name=
"settings_disable_summary"
>
Disable Magic Mount, which will prevent all modules to work
</string>
</resources>
</resources>
app/src/main/res/xml/app_settings.xml
View file @
43b7ef81
...
@@ -21,6 +21,11 @@
...
@@ -21,6 +21,11 @@
android:key=
"magisk"
android:key=
"magisk"
android:title=
"@string/magisk"
>
android:title=
"@string/magisk"
>
<CheckBoxPreference
android:key=
"disable"
android:title=
"@string/settings_disable_title"
android:summary=
"@string/settings_disable_summary"
/>
<CheckBoxPreference
<CheckBoxPreference
android:key=
"busybox"
android:key=
"busybox"
android:defaultValue=
"false"
android:defaultValue=
"false"
...
...
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