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
615bbcae
Commit
615bbcae
authored
Aug 17, 2016
by
dvdandroid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactoring
parent
7737c6ae
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
117 additions
and
84 deletions
+117
-84
.gitignore
.gitignore
+1
-4
compiler.xml
.idea/compiler.xml
+2
-2
profiles_settings.xml
.idea/copyright/profiles_settings.xml
+0
-3
gradle.xml
.idea/gradle.xml
+1
-1
misc.xml
.idea/misc.xml
+58
-1
build.gradle
app/build.gradle
+4
-1
MainActivity.java
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
+48
-69
build.gradle
build.gradle
+1
-1
gradle-wrapper.properties
gradle/wrapper/gradle-wrapper.properties
+2
-2
No files found.
.gitignore
View file @
615bbcae
*.iml
*.iml
.gradle
.gradle
/local.properties
/local.properties
/.idea/workspace.xml
/.idea/
/.idea/libraries
.DS_Store
/build
/build
/captures
.idea/compiler.xml
View file @
615bbcae
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"CompilerConfiguration"
>
<component
name=
"CompilerConfiguration"
>
<option
name=
"DEFAULT_COMPILER"
value=
"Javac"
/>
<resourceExtensions
/>
<resourceExtensions
/>
<wildcardResourcePatterns>
<wildcardResourcePatterns>
<entry
name=
"!?*.java"
/>
<entry
name=
"!?*.java"
/>
...
@@ -11,10 +12,9 @@
...
@@ -11,10 +12,9 @@
<entry
name=
"!?*.flex"
/>
<entry
name=
"!?*.flex"
/>
<entry
name=
"!?*.kt"
/>
<entry
name=
"!?*.kt"
/>
<entry
name=
"!?*.clj"
/>
<entry
name=
"!?*.clj"
/>
<entry
name=
"!?*.aj"
/>
</wildcardResourcePatterns>
</wildcardResourcePatterns>
<annotationProcessing>
<annotationProcessing>
<profile
default=
"true"
name=
"Default"
enabled=
"
fals
e"
>
<profile
default=
"true"
name=
"Default"
enabled=
"
tru
e"
>
<processorPath
useClasspath=
"true"
/>
<processorPath
useClasspath=
"true"
/>
</profile>
</profile>
</annotationProcessing>
</annotationProcessing>
...
...
.idea/copyright/profiles_settings.xml
deleted
100644 → 0
View file @
7737c6ae
<component
name=
"CopyrightManager"
>
<settings
default=
""
/>
</component>
\ No newline at end of file
.idea/gradle.xml
View file @
615bbcae
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<GradleProjectSettings>
<GradleProjectSettings>
<option
name=
"distributionType"
value=
"LOCAL"
/>
<option
name=
"distributionType"
value=
"LOCAL"
/>
<option
name=
"externalProjectPath"
value=
"$PROJECT_DIR$"
/>
<option
name=
"externalProjectPath"
value=
"$PROJECT_DIR$"
/>
<option
name=
"gradleHome"
value=
"
$APPLICATION_HOME_DIR$/gradle/gradle-2.10
"
/>
<option
name=
"gradleHome"
value=
"
C:\Program Files\Android-Studio\gradle\gradle-2.14.1
"
/>
<option
name=
"modules"
>
<option
name=
"modules"
>
<set>
<set>
<option
value=
"$PROJECT_DIR$"
/>
<option
value=
"$PROJECT_DIR$"
/>
...
...
.idea/misc.xml
View file @
615bbcae
...
@@ -27,6 +27,47 @@
...
@@ -27,6 +27,47 @@
</value>
</value>
</option>
</option>
</component>
</component>
<component
name=
"ProjectInspectionProfilesVisibleTreeState"
>
<entry
key=
"Project Default"
>
<profile-state>
<expanded-state>
<State>
<id>
Android Lint
</id>
</State>
<State>
<id>
Groovy
</id>
</State>
<State>
<id>
HTML
</id>
</State>
<State>
<id>
J2ME issues
</id>
</State>
<State>
<id>
JUnit issues
</id>
</State>
<State>
<id>
Java language level issues
</id>
</State>
<State>
<id>
JavaBeans issues
</id>
</State>
<State>
<id>
Pattern Validation
</id>
</State>
<State>
<id>
Threading issues
</id>
</State>
<State>
<id>
Threading issuesGroovy
</id>
</State>
<State>
<id>
XML
</id>
</State>
</expanded-state>
</profile-state>
</entry>
</component>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"false"
>
<component
name=
"ProjectLevelVcsManager"
settingsEditedManually=
"false"
>
<OptionsSetting
value=
"true"
id=
"Add"
/>
<OptionsSetting
value=
"true"
id=
"Add"
/>
<OptionsSetting
value=
"true"
id=
"Remove"
/>
<OptionsSetting
value=
"true"
id=
"Remove"
/>
...
@@ -37,10 +78,26 @@
...
@@ -37,10 +78,26 @@
<ConfirmationsSetting
value=
"0"
id=
"Add"
/>
<ConfirmationsSetting
value=
"0"
id=
"Add"
/>
<ConfirmationsSetting
value=
"0"
id=
"Remove"
/>
<ConfirmationsSetting
value=
"0"
id=
"Remove"
/>
</component>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
7"
default=
"true
"
assert-keyword=
"true"
jdk-15=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1_
8
"
assert-keyword=
"true"
jdk-15=
"true"
project-jdk-name=
"1.8"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
</component>
<component
name=
"ProjectType"
>
<component
name=
"ProjectType"
>
<option
name=
"id"
value=
"Android"
/>
<option
name=
"id"
value=
"Android"
/>
</component>
</component>
<component
name=
"masterDetails"
>
<states>
<state
key=
"ProjectJDKs.UI"
>
<settings>
<last-edited>
1.8
</last-edited>
<splitter-proportions>
<option
name=
"proportions"
>
<list>
<option
value=
"0.2"
/>
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
</project>
\ No newline at end of file
app/build.gradle
View file @
615bbcae
...
@@ -10,6 +10,10 @@ android {
...
@@ -10,6 +10,10 @@ android {
targetSdkVersion
24
targetSdkVersion
24
versionCode
3
versionCode
3
versionName
"v4"
versionName
"v4"
jackOptions
{
enabled
true
}
}
}
buildTypes
{
buildTypes
{
release
{
release
{
...
@@ -21,5 +25,4 @@ android {
...
@@ -21,5 +25,4 @@ android {
dependencies
{
dependencies
{
compile
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
compile
fileTree
(
dir:
'libs'
,
include:
[
'*.jar'
])
testCompile
'junit:junit:4.12'
}
}
app/src/main/java/com/topjohnwu/magisk/MainActivity.java
View file @
615bbcae
...
@@ -5,10 +5,9 @@ import android.graphics.Color;
...
@@ -5,10 +5,9 @@ import android.graphics.Color;
import
android.os.AsyncTask
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.Switch
;
import
android.widget.Switch
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.DataOutputStream
;
import
java.io.DataOutputStream
;
import
java.io.File
;
import
java.io.File
;
...
@@ -21,6 +20,41 @@ public class MainActivity extends Activity {
...
@@ -21,6 +20,41 @@ public class MainActivity extends Activity {
private
TextView
magiskVersion
,
rootStatus
,
selinuxStatus
,
safetyNet
,
permissive
;
private
TextView
magiskVersion
,
rootStatus
,
selinuxStatus
,
safetyNet
,
permissive
;
private
String
suPath
;
private
String
suPath
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
magiskVersion
=
(
TextView
)
findViewById
(
R
.
id
.
magisk_version
);
rootToggle
=
(
Switch
)
findViewById
(
R
.
id
.
root_toggle
);
selinuxToggle
=
(
Switch
)
findViewById
(
R
.
id
.
selinux_toggle
);
rootStatus
=
(
TextView
)
findViewById
(
R
.
id
.
root_status
);
selinuxStatus
=
(
TextView
)
findViewById
(
R
.
id
.
selinux_status
);
safetyNet
=
(
TextView
)
findViewById
(
R
.
id
.
safety_net
);
permissive
=
(
TextView
)
findViewById
(
R
.
id
.
permissive
);
suPath
=
execute
(
"getprop magisk.supath"
);
updateStatus
();
rootToggle
.
setOnClickListener
(
view
->
{
Switch
s
=
(
Switch
)
view
;
if
(
s
.
isChecked
())
{
(
new
SU
()).
execute
(
"setprop magisk.root 1"
);
}
else
{
(
new
SU
()).
execute
(
"setprop magisk.root 0"
);
}
});
selinuxToggle
.
setOnClickListener
(
view
->
{
Switch
s
=
(
Switch
)
view
;
if
(
s
.
isChecked
())
{
new
SU
().
execute
(
"setenforce 1"
);
}
else
{
new
SU
().
execute
(
"setenforce 0"
);
}
});
}
private
String
execute
(
String
command
)
{
private
String
execute
(
String
command
)
{
StringBuilder
output
=
new
StringBuilder
();
StringBuilder
output
=
new
StringBuilder
();
...
@@ -32,8 +66,8 @@ public class MainActivity extends Activity {
...
@@ -32,8 +66,8 @@ public class MainActivity extends Activity {
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
p
.
getInputStream
()));
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
p
.
getInputStream
()));
String
line
;
String
line
;
while
((
line
=
reader
.
readLine
())!=
null
)
{
while
((
line
=
reader
.
readLine
())
!=
null
)
{
if
(
output
.
length
()
!=
0
)
output
.
append
(
"\n"
);
if
(
output
.
length
()
!=
0
)
output
.
append
(
"\n"
);
output
.
append
(
line
);
output
.
append
(
line
);
}
}
...
@@ -50,7 +84,7 @@ public class MainActivity extends Activity {
...
@@ -50,7 +84,7 @@ public class MainActivity extends Activity {
magiskVersion
.
setText
(
getString
(
R
.
string
.
magisk_version
,
execute
(
"getprop magisk.version"
)));
magiskVersion
.
setText
(
getString
(
R
.
string
.
magisk_version
,
execute
(
"getprop magisk.version"
)));
selinuxStatus
.
setText
(
selinux
);
selinuxStatus
.
setText
(
selinux
);
if
(
selinux
.
equals
(
"Enforcing"
))
{
if
(
selinux
.
equals
(
"Enforcing"
))
{
selinuxStatus
.
setTextColor
(
Color
.
GREEN
);
selinuxStatus
.
setTextColor
(
Color
.
GREEN
);
selinuxToggle
.
setChecked
(
true
);
selinuxToggle
.
setChecked
(
true
);
permissive
.
setText
(
R
.
string
.
selinux_enforcing_info
);
permissive
.
setText
(
R
.
string
.
selinux_enforcing_info
);
...
@@ -62,17 +96,17 @@ public class MainActivity extends Activity {
...
@@ -62,17 +96,17 @@ public class MainActivity extends Activity {
permissive
.
setTextColor
(
Color
.
RED
);
permissive
.
setTextColor
(
Color
.
RED
);
}
}
if
((
new
File
(
"/system/framework/twframework.jar"
)
).
exists
())
{
if
(
new
File
(
"/system/framework/twframework.jar"
).
exists
())
{
selinuxToggle
.
setEnabled
(
false
);
selinuxToggle
.
setEnabled
(
false
);
permissive
.
setText
(
R
.
string
.
selinux_samsung
);
permissive
.
setText
(
R
.
string
.
selinux_samsung
);
}
}
if
((
new
File
(
"/system/xbin/su"
).
exists
()
))
{
if
(
new
File
(
"/system/xbin/su"
).
exists
(
))
{
rootStatus
.
setTextColor
(
Color
.
RED
);
rootStatus
.
setTextColor
(
Color
.
RED
);
safetyNet
.
setTextColor
(
Color
.
RED
);
safetyNet
.
setTextColor
(
Color
.
RED
);
rootToggle
.
setChecked
(
true
);
rootToggle
.
setChecked
(
true
);
if
(!(
new
File
(
suPath
+
"/su"
)).
exists
())
{
if
(!(
new
File
(
suPath
+
"/su"
)).
exists
())
{
rootStatus
.
setText
(
R
.
string
.
root_system
);
rootStatus
.
setText
(
R
.
string
.
root_system
);
safetyNet
.
setText
(
R
.
string
.
root_system_info
);
safetyNet
.
setText
(
R
.
string
.
root_system_info
);
rootToggle
.
setEnabled
(
false
);
rootToggle
.
setEnabled
(
false
);
...
@@ -86,7 +120,7 @@ public class MainActivity extends Activity {
...
@@ -86,7 +120,7 @@ public class MainActivity extends Activity {
safetyNet
.
setTextColor
(
Color
.
GREEN
);
safetyNet
.
setTextColor
(
Color
.
GREEN
);
rootToggle
.
setChecked
(
false
);
rootToggle
.
setChecked
(
false
);
if
(!(
new
File
(
suPath
+
"/su"
)
).
exists
())
{
if
(!
new
File
(
suPath
+
"/su"
).
exists
())
{
rootStatus
.
setText
(
R
.
string
.
root_none
);
rootStatus
.
setText
(
R
.
string
.
root_none
);
safetyNet
.
setText
(
R
.
string
.
root_none_info
);
safetyNet
.
setText
(
R
.
string
.
root_none_info
);
rootToggle
.
setEnabled
(
false
);
rootToggle
.
setEnabled
(
false
);
...
@@ -105,77 +139,22 @@ public class MainActivity extends Activity {
...
@@ -105,77 +139,22 @@ public class MainActivity extends Activity {
try
{
try
{
Process
su
=
Runtime
.
getRuntime
().
exec
(
suPath
+
"/su"
);
Process
su
=
Runtime
.
getRuntime
().
exec
(
suPath
+
"/su"
);
DataOutputStream
out
=
new
DataOutputStream
(
su
.
getOutputStream
());
DataOutputStream
out
=
new
DataOutputStream
(
su
.
getOutputStream
());
for
(
String
command
:
params
)
{
for
(
String
command
:
params
)
{
out
.
writeBytes
(
command
+
"\n"
);
out
.
writeBytes
(
command
+
"\n"
);
out
.
flush
();
out
.
flush
();
}
}
out
.
writeBytes
(
"exit\n"
);
out
.
writeBytes
(
"exit\n"
);
out
.
flush
();
out
.
flush
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
null
;
return
null
;
}
}
@Override
@Override
protected
void
onPostExecute
(
Void
aVoid
)
{
protected
void
onPostExecute
(
Void
aVoid
)
{
final
Handler
handler
=
new
Handler
();
final
Handler
handler
=
new
Handler
();
handler
.
postDelayed
(
new
Runnable
()
{
handler
.
postDelayed
(
MainActivity
.
this
::
updateStatus
,
1500
);
@Override
public
void
run
()
{
updateStatus
();
}
},
1500
);
}
}
}
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
magiskVersion
=
(
TextView
)
findViewById
(
R
.
id
.
magisk_version
);
rootToggle
=
(
Switch
)
findViewById
(
R
.
id
.
root_toggle
);
selinuxToggle
=
(
Switch
)
findViewById
(
R
.
id
.
selinux_toggle
);
rootStatus
=
(
TextView
)
findViewById
(
R
.
id
.
root_status
);
selinuxStatus
=
(
TextView
)
findViewById
(
R
.
id
.
selinux_status
);
safetyNet
=
(
TextView
)
findViewById
(
R
.
id
.
safety_net
);
permissive
=
(
TextView
)
findViewById
(
R
.
id
.
permissive
);
suPath
=
execute
(
"getprop magisk.supath"
);
setContentView
(
R
.
layout
.
activity_main
);
magiskVersion
=
(
TextView
)
findViewById
(
R
.
id
.
magisk_version
);
rootToggle
=
(
Switch
)
findViewById
(
R
.
id
.
root_toggle
);
selinuxToggle
=
(
Switch
)
findViewById
(
R
.
id
.
selinux_toggle
);
rootStatus
=
(
TextView
)
findViewById
(
R
.
id
.
root_status
);
selinuxStatus
=
(
TextView
)
findViewById
(
R
.
id
.
selinux_status
);
safetyNet
=
(
TextView
)
findViewById
(
R
.
id
.
safety_net
);
permissive
=
(
TextView
)
findViewById
(
R
.
id
.
permissive
);
updateStatus
();
rootToggle
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Switch
s
=
(
Switch
)
view
;
if
(
s
.
isChecked
())
{
(
new
SU
()).
execute
(
"setprop magisk.root 1"
);
}
else
{
(
new
SU
()).
execute
(
"setprop magisk.root 0"
);
}
}
});
selinuxToggle
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Switch
s
=
(
Switch
)
view
;
if
(
s
.
isChecked
())
{
(
new
SU
()).
execute
(
"setenforce 1"
);
}
else
{
(
new
SU
()).
execute
(
"setenforce 0"
);
}
}
});
}
}
}
build.gradle
View file @
615bbcae
...
@@ -5,7 +5,7 @@ buildscript {
...
@@ -5,7 +5,7 @@ buildscript {
jcenter
()
jcenter
()
}
}
dependencies
{
dependencies
{
classpath
'com.android.tools.build:gradle:2.1.
2
'
classpath
'com.android.tools.build:gradle:2.1.
3
'
// NOTE: Do not place your application dependencies here; they belong
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// in the individual module build.gradle files
...
...
gradle/wrapper/gradle-wrapper.properties
View file @
615bbcae
#
Mon Dec 28 10:00:20 PST 2015
#
Wed Aug 17 11:39:12 CEST 2016
distributionBase
=
GRADLE_USER_HOME
distributionBase
=
GRADLE_USER_HOME
distributionPath
=
wrapper/dists
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-2.1
0
-all.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-2.1
4.1
-all.zip
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