Refactoring
This commit is contained in:
parent
7737c6aee1
commit
615bbcae74
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,8 +1,5 @@
|
|||||||
*.iml
|
*.iml
|
||||||
.gradle
|
.gradle
|
||||||
/local.properties
|
/local.properties
|
||||||
/.idea/workspace.xml
|
/.idea/
|
||||||
/.idea/libraries
|
|
||||||
.DS_Store
|
|
||||||
/build
|
/build
|
||||||
/captures
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?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 @@
|
|||||||
<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="false">
|
<profile default="true" name="Default" enabled="true">
|
||||||
<processorPath useClasspath="true" />
|
<processorPath useClasspath="true" />
|
||||||
</profile>
|
</profile>
|
||||||
</annotationProcessing>
|
</annotationProcessing>
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
<component name="CopyrightManager">
|
|
||||||
<settings default="" />
|
|
||||||
</component>
|
|
@ -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$" />
|
||||||
|
@ -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 @@
|
|||||||
<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>
|
@ -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 {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
testCompile 'junit:junit:4.12'
|
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
|||||||
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();
|
||||||
@ -62,12 +96,12 @@ 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);
|
||||||
@ -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);
|
||||||
@ -111,71 +145,16 @@ public class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#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.10-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
|
||||||
|
Loading…
Reference in New Issue
Block a user