diff --git a/app/build.gradle b/app/build.gradle
index 340f6cf..05614af 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,18 +1,16 @@
apply plugin: 'com.android.application'
-
apply plugin: 'kotlin-android'
-
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
- buildToolsVersion "26.0.0"
+ buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.mrbimc.selinux"
minSdkVersion 17
targetSdkVersion 26
- versionCode 20170724
- versionName "10.0"
+ versionCode 20171031
+ versionName "11.0"
}
buildTypes {
release {
@@ -22,15 +20,19 @@ android {
}
}
+ext {
+ supportLibVersion = "26.1.0"
+}
+
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
- implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
+ implementation "com.android.support:appcompat-v7:$supportLibVersion"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.16'
- implementation 'com.android.support:design:26.0.0-beta2'
- implementation 'com.android.support:cardview-v7:26.0.0-beta2'
- implementation 'eu.chainfire:libsuperuser:1.0.0.+'
- implementation 'com.yarolegovich:lovely-dialog:1.0.7'
- implementation 'net.sourceforge.streamsupport:streamsupport-cfuture:1.5.5'
+ implementation "com.android.support:design:$supportLibVersion"
+ implementation "com.android.support:cardview-v7:$supportLibVersion"
+ implementation "eu.chainfire:libsuperuser:1.0.0.+"
+ implementation "com.yarolegovich:lovely-dialog:1.0.7"
+ implementation "net.sourceforge.streamsupport:streamsupport-cfuture:1.5.5"
}
kotlin {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 1f9fd72..66fa3fa 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -5,7 +5,6 @@
-
+
+
+
+
-
+
diff --git a/app/src/main/java/com/mrbimc/selinux/MainActivity.kt b/app/src/main/java/com/mrbimc/selinux/MainActivity.kt
index d6ec59d..8db2181 100644
--- a/app/src/main/java/com/mrbimc/selinux/MainActivity.kt
+++ b/app/src/main/java/com/mrbimc/selinux/MainActivity.kt
@@ -18,7 +18,7 @@ import kotlinx.android.synthetic.main.layout_command.*
import kotlinx.android.synthetic.main.layout_context.*
import kotlinx.android.synthetic.main.layout_notifications.*
import kotlinx.android.synthetic.main.layout_selinux_state.*
-
+import kotlinx.android.synthetic.main.layout_autostart.*
class MainActivity : AppCompatActivity() {
@@ -32,6 +32,7 @@ class MainActivity : AppCompatActivity() {
checkCommand()
checkContext()
checkNotificationSettings()
+ checkAutoStartSettings()
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
@@ -58,7 +59,7 @@ class MainActivity : AppCompatActivity() {
}
}
- fun checkContext() {
+ private fun checkContext() {
val items = resources.getStringArray(R.array.selinux_contexts)
val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, items)
@@ -78,7 +79,7 @@ class MainActivity : AppCompatActivity() {
}
}
- fun checkCommand() {
+ private fun checkCommand() {
val items = resources.getStringArray(R.array.selinux_commands)
val adapter = ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, items)
@@ -97,15 +98,23 @@ class MainActivity : AppCompatActivity() {
}
}
- fun checkNotificationSettings() {
- notificationsSwitch.isChecked = sp.getBoolean("notifications", true)
+ private fun checkNotificationSettings() {
+ notificationsSwitch.isChecked = sp.getBoolean(KEY_NOTIFICATIONS, true)
notificationsSwitch.setOnCheckedChangeListener { _, isChecked ->
sp.edit().putBoolean(KEY_NOTIFICATIONS, isChecked).apply()
}
}
- fun checkSELinuxState() {
+ private fun checkAutoStartSettings() {
+ autoStartSwitch.isChecked = sp.getBoolean(KEY_AUTOSTART, true)
+
+ autoStartSwitch.setOnCheckedChangeListener { _, isChecked ->
+ sp.edit().putBoolean(KEY_AUTOSTART, isChecked).apply()
+ }
+ }
+
+ private fun checkSELinuxState() {
val ad = LovelyProgressDialog(this)
.setTopColorRes(R.color.colorAccent)
@@ -139,7 +148,7 @@ class MainActivity : AppCompatActivity() {
}
}
- fun showInfoDialog(): Boolean {
+ private fun showInfoDialog(): Boolean {
LovelyStandardDialog(this)
.setTopColorRes(R.color.colorAccent)
.setTopTitle(getString(R.string.about_this_app))
@@ -156,7 +165,7 @@ class MainActivity : AppCompatActivity() {
return true
}
- fun openGithub() {
+ private fun openGithub() {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/MrBIMC/SELinuxModeChanger")))
}
diff --git a/app/src/main/java/com/mrbimc/selinux/SELinuxBroadcastReceiver.kt b/app/src/main/java/com/mrbimc/selinux/SELinuxBroadcastReceiver.kt
index 845654b..6888925 100644
--- a/app/src/main/java/com/mrbimc/selinux/SELinuxBroadcastReceiver.kt
+++ b/app/src/main/java/com/mrbimc/selinux/SELinuxBroadcastReceiver.kt
@@ -4,9 +4,7 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.preference.PreferenceManager
-import com.mrbimc.selinux.util.KEY_SELINUX_STATE
-import com.mrbimc.selinux.util.SELinuxState
-import com.mrbimc.selinux.util.setSELinuxState
+import com.mrbimc.selinux.util.*
/**
* Created by Pavel Sikun on 23.07.17.
@@ -15,10 +13,16 @@ import com.mrbimc.selinux.util.setSELinuxState
class SELinuxBroadcastReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
- val selinuxState = PreferenceManager.getDefaultSharedPreferences(context).getInt(KEY_SELINUX_STATE, SELinuxState.UNKNOWN.value)
+ val sp = PreferenceManager.getDefaultSharedPreferences(context)
+ if (!sp.getBoolean(KEY_AUTOSTART, true)) {
+ return
+ }
+
+ val selinuxState = sp.getInt(KEY_SELINUX_STATE, SELinuxState.UNKNOWN.value)
when (selinuxState) {
0 -> context.setSELinuxState(SELinuxState.PERMISSIVE)
1 -> context.setSELinuxState(SELinuxState.ENFORCING)
+ else -> context.createNotification(context.getString(R.string.no_root_access))
}
}
}
diff --git a/app/src/main/java/com/mrbimc/selinux/ShortcutActivity.kt b/app/src/main/java/com/mrbimc/selinux/ShortcutActivity.kt
new file mode 100644
index 0000000..556e418
--- /dev/null
+++ b/app/src/main/java/com/mrbimc/selinux/ShortcutActivity.kt
@@ -0,0 +1,44 @@
+package com.mrbimc.selinux
+
+import android.app.Activity
+import android.content.Context
+import android.content.Intent
+import android.content.pm.ShortcutManager
+import android.os.Bundle
+import com.mrbimc.selinux.util.*
+
+/**
+ * Created by Pavel Sikun on 31.10.2017.
+ */
+
+class ShortcutActivity : Activity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ processShortcut(intent)
+ finish()
+ }
+
+ private fun processShortcut(intent: Intent) {
+ val uri = intent.data ?: return
+
+ val host = uri.host
+ reportShortcutUsed(host)
+
+ when (host) {
+ SHORTCUT_ENFORCING -> {
+ setSELinuxState(SELinuxState.ENFORCING)
+ }
+ SHORTCUT_PERMISSIVE -> {
+ setSELinuxState(SELinuxState.PERMISSIVE)
+ }
+ }
+ }
+
+ private fun reportShortcutUsed(shortcutId: String) {
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) {
+ val shortcutManager = getSystemService(Context.SHORTCUT_SERVICE) as ShortcutManager
+ shortcutManager.reportShortcutUsed(shortcutId)
+ }
+ }
+
+}
diff --git a/app/src/main/java/com/mrbimc/selinux/util/Constants.kt b/app/src/main/java/com/mrbimc/selinux/util/Constants.kt
index 548126f..7c4d305 100644
--- a/app/src/main/java/com/mrbimc/selinux/util/Constants.kt
+++ b/app/src/main/java/com/mrbimc/selinux/util/Constants.kt
@@ -7,4 +7,8 @@ package com.mrbimc.selinux.util
const val KEY_COMMAND = "selinux_command"
const val KEY_CONTEXT = "selinux_context"
const val KEY_NOTIFICATIONS = "notifications"
-const val KEY_SELINUX_STATE = "selinux"
\ No newline at end of file
+const val KEY_AUTOSTART = "autostart"
+const val KEY_SELINUX_STATE = "selinux"
+
+const val SHORTCUT_ENFORCING = "enforcing"
+const val SHORTCUT_PERMISSIVE = "permissive"
\ No newline at end of file
diff --git a/app/src/main/java/com/mrbimc/selinux/util/ContextUtil.kt b/app/src/main/java/com/mrbimc/selinux/util/ContextUtil.kt
index 7b73299..57ab438 100644
--- a/app/src/main/java/com/mrbimc/selinux/util/ContextUtil.kt
+++ b/app/src/main/java/com/mrbimc/selinux/util/ContextUtil.kt
@@ -23,10 +23,6 @@ import kotlinx.coroutines.experimental.launch
fun Context.getSELinuxState(callback: (SELinuxState) -> Unit) = launch(CommonPool) {
val sp = PreferenceManager.getDefaultSharedPreferences(this@getSELinuxState)
when(executeGetSELinuxState().get()) {
- SELinuxState.UNKNOWN -> {
- sp.edit().putInt(KEY_SELINUX_STATE, SELinuxState.UNKNOWN.value).apply()
- callback(SELinuxState.UNKNOWN)
- }
SELinuxState.ENFORCING -> {
sp.edit().putInt(KEY_SELINUX_STATE, SELinuxState.ENFORCING.value).apply()
callback(SELinuxState.ENFORCING)
@@ -35,6 +31,10 @@ fun Context.getSELinuxState(callback: (SELinuxState) -> Unit) = launch(CommonPoo
sp.edit().putInt(KEY_SELINUX_STATE, SELinuxState.PERMISSIVE.value).apply()
callback(SELinuxState.PERMISSIVE)
}
+ else -> { // SELinuxState.UNKNOWN && black magic cases
+ sp.edit().putInt(KEY_SELINUX_STATE, SELinuxState.UNKNOWN.value).apply()
+ callback(SELinuxState.UNKNOWN)
+ }
}
}
@@ -44,7 +44,7 @@ fun Context.setSELinuxState(state: SELinuxState, callback: (SELinuxState) -> Uni
val defaultCommand = resources.getStringArray(R.array.selinux_commands)[0]
val defaultContext = resources.getStringArray(R.array.selinux_contexts)[0]
- val command = sp.getString(KEY_COMMAND, defaultCommand).replace("#STATE#", "${state.value}")
+ val command = sp.getString(KEY_COMMAND, defaultCommand).replace("\$STATE", "${state.value}")
val context = sp.getString(KEY_CONTEXT, defaultContext)
var commandToExecute = command
@@ -54,11 +54,6 @@ fun Context.setSELinuxState(state: SELinuxState, callback: (SELinuxState) -> Uni
}
when(executeSetSELinuxState(state, commandToExecute).get()) {
- SELinuxState.UNKNOWN -> {
- createNotification(getString(R.string.no_root_access))
- sp.edit().putInt(KEY_SELINUX_STATE, SELinuxState.UNKNOWN.value).apply()
- callback(SELinuxState.UNKNOWN)
- }
SELinuxState.ENFORCING -> {
createNotification(getString(R.string.selinux_set_to_enforcing))
sp.edit().putInt(KEY_SELINUX_STATE, SELinuxState.ENFORCING.value).apply()
@@ -69,6 +64,11 @@ fun Context.setSELinuxState(state: SELinuxState, callback: (SELinuxState) -> Uni
sp.edit().putInt(KEY_SELINUX_STATE, SELinuxState.PERMISSIVE.value).apply()
callback(SELinuxState.PERMISSIVE)
}
+ else -> { // SELinuxState.UNKNOWN && black magic cases
+ createNotification(getString(R.string.no_root_access))
+ sp.edit().putInt(KEY_SELINUX_STATE, SELinuxState.UNKNOWN.value).apply()
+ callback(SELinuxState.UNKNOWN)
+ }
}
}
@@ -85,13 +85,14 @@ fun Context.createNotification(message: String) {
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val contentIntent = PendingIntent.getActivity(this, 0, Intent(this, MainActivity::class.java), 0)
- val notificationID = 1
+ val notificationID = 12459
val channelID = KEY_NOTIFICATIONS
val notification = NotificationCompat.Builder(this, channelID)
- .setSmallIcon(R.mipmap.ic_launcher)
+ .setSmallIcon(R.drawable.security)
.setColor(ContextCompat.getColor(this, R.color.colorAccent))
- .setContentText(message)
+ .setContentTitle(message)
+ .setContentText(getString(R.string.tap_for_details))
.setContentIntent(contentIntent)
.setAutoCancel(false)
.build()
@@ -104,9 +105,9 @@ fun Context.createNotificationChannel() {
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val id = KEY_NOTIFICATIONS
val name = getString(R.string.channel_name)
- val importance = NotificationManager.IMPORTANCE_UNSPECIFIED
-
+ val importance = NotificationManager.IMPORTANCE_DEFAULT
val channel = NotificationChannel(id, name, importance)
+
channel.enableLights(true)
channel.lightColor = Color.GREEN
channel.enableVibration(false)
diff --git a/app/src/main/java/com/mrbimc/selinux/util/ShellUtil.kt b/app/src/main/java/com/mrbimc/selinux/util/ShellUtil.kt
index 13384ab..b407503 100644
--- a/app/src/main/java/com/mrbimc/selinux/util/ShellUtil.kt
+++ b/app/src/main/java/com/mrbimc/selinux/util/ShellUtil.kt
@@ -17,10 +17,11 @@ private val shell by lazy { Shell.Builder()
fun executeGetSELinuxState(): CompletableFuture {
val future = CompletableFuture()
- shell.addCommand("/system/bin/getenforce", 1) { _, _, output: MutableList ->
- val outputString = output.joinToString()
- val isEnforcing = outputString.toLowerCase().contains("enforcing")
- future.complete(if (isEnforcing) SELinuxState.ENFORCING else SELinuxState.PERMISSIVE)
+ if (Shell.SU.available()) {
+ future.complete(if (Shell.SU.isSELinuxEnforcing()) SELinuxState.ENFORCING else SELinuxState.PERMISSIVE)
+ }
+ else {
+ future.complete(SELinuxState.UNKNOWN)
}
return future
@@ -29,10 +30,15 @@ fun executeGetSELinuxState(): CompletableFuture {
fun executeSetSELinuxState(state: SELinuxState, command: String): CompletableFuture {
val future = CompletableFuture()
- shell.addCommand(command, 1) { _, _, output: MutableList ->
- val outputString = output.joinToString()
- val isError = outputString.trim().isNotEmpty()
- future.complete(if (isError) SELinuxState.UNKNOWN else state)
+ if (Shell.SU.available()) {
+ shell.addCommand(command, 1) { _, _, output: MutableList ->
+ val outputString = output.joinToString()
+ val isError = outputString.trim().isNotEmpty()
+ future.complete(if (isError) SELinuxState.UNKNOWN else state)
+ }
+ }
+ else {
+ future.complete(SELinuxState.UNKNOWN)
}
return future
diff --git a/app/src/main/res/drawable/lock_open_outline.xml b/app/src/main/res/drawable/lock_open_outline.xml
new file mode 100644
index 0000000..1040133
--- /dev/null
+++ b/app/src/main/res/drawable/lock_open_outline.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/lock_outline.xml b/app/src/main/res/drawable/lock_outline.xml
new file mode 100644
index 0000000..7cde818
--- /dev/null
+++ b/app/src/main/res/drawable/lock_outline.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/security.xml b/app/src/main/res/drawable/security.xml
index 2944410..6323606 100644
--- a/app/src/main/res/drawable/security.xml
+++ b/app/src/main/res/drawable/security.xml
@@ -4,5 +4,5 @@
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
-
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/security_launcher.xml b/app/src/main/res/drawable/security_launcher.xml
new file mode 100644
index 0000000..329ff14
--- /dev/null
+++ b/app/src/main/res/drawable/security_launcher.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 2a57a5f..58844a3 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -21,5 +21,7 @@
+
+
diff --git a/app/src/main/res/layout/layout_autostart.xml b/app/src/main/res/layout/layout_autostart.xml
new file mode 100644
index 0000000..3a4123d
--- /dev/null
+++ b/app/src/main/res/layout/layout_autostart.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..bf0a1e5
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_shortcut_enforcing.xml b/app/src/main/res/mipmap-anydpi-v26/ic_shortcut_enforcing.xml
new file mode 100644
index 0000000..79f35a8
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_shortcut_enforcing.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_shortcut_permissive.xml b/app/src/main/res/mipmap-anydpi-v26/ic_shortcut_permissive.xml
new file mode 100644
index 0000000..824051e
--- /dev/null
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_shortcut_permissive.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
index 8f9c05d..00aee6c 100755
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_shortcut_enforcing.png b/app/src/main/res/mipmap-hdpi/ic_shortcut_enforcing.png
new file mode 100755
index 0000000..e442a68
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_shortcut_enforcing.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_shortcut_permissive.png b/app/src/main/res/mipmap-hdpi/ic_shortcut_permissive.png
new file mode 100755
index 0000000..62ddf81
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_shortcut_permissive.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 633e5ae..de99331 100755
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_shortcut_enforcing.png b/app/src/main/res/mipmap-mdpi/ic_shortcut_enforcing.png
new file mode 100755
index 0000000..52f3598
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_shortcut_enforcing.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_shortcut_permissive.png b/app/src/main/res/mipmap-mdpi/ic_shortcut_permissive.png
new file mode 100755
index 0000000..8b4de2b
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_shortcut_permissive.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index 87cb961..00aee6c 100755
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_shortcut_enforcing.png b/app/src/main/res/mipmap-xhdpi/ic_shortcut_enforcing.png
new file mode 100755
index 0000000..e1d1073
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_shortcut_enforcing.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_shortcut_permissive.png b/app/src/main/res/mipmap-xhdpi/ic_shortcut_permissive.png
new file mode 100755
index 0000000..62ddf81
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_shortcut_permissive.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index a164e32..eb7acbd 100755
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_shortcut_enforcing.png b/app/src/main/res/mipmap-xxhdpi/ic_shortcut_enforcing.png
new file mode 100755
index 0000000..b7570c5
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_shortcut_enforcing.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_shortcut_permissive.png b/app/src/main/res/mipmap-xxhdpi/ic_shortcut_permissive.png
new file mode 100755
index 0000000..b0a8837
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_shortcut_permissive.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index a9b3bba..6e0702c 100755
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_shortcut_enforcing.png b/app/src/main/res/mipmap-xxxhdpi/ic_shortcut_enforcing.png
new file mode 100755
index 0000000..29bb4c5
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_shortcut_enforcing.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_shortcut_permissive.png b/app/src/main/res/mipmap-xxxhdpi/ic_shortcut_permissive.png
new file mode 100755
index 0000000..d902261
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_shortcut_permissive.png differ
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 3456d41..66d1402 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -1,8 +1,8 @@
- - /system/bin/setenforce #STATE#
- - echo #STATE# > /sys/fs/selinux/enforce
+ - /system/bin/setenforce $STATE
+ - echo $STATE > /sys/fs/selinux/enforce
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 7c002fd..cb69230 100755
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -14,8 +14,10 @@
App was unable to gain root access
Show notification after mode changed
+ Automatically start on boot
Notifications
+ Tap for details and options
Awaiting for root access…
This app can change the SELinux Modes without having to permanently modify the boot script files of the device.\n\nAny device, by default, boots in default SELinux "Enforcing" mode. Every time you reboot your device app will execute the script to change SELinux to the mode you\'ve last selected.\n\nFor more information, check app\'s github repo.
Close dialog
@@ -23,4 +25,7 @@
About this app
Select SU command:
Select SU context:
+
+ Set to Permissive
+ Set to Enforcing
diff --git a/app/src/main/res/xml/shortcuts.xml b/app/src/main/res/xml/shortcuts.xml
new file mode 100644
index 0000000..05fbef0
--- /dev/null
+++ b/app/src/main/res/xml/shortcuts.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index 78f7689..97c0cf8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = '1.1.3-2'
+ ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.0.0-alpha7'
+ classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
@@ -19,7 +19,6 @@ allprojects {
repositories {
google()
jcenter()
- mavenCentral()
}
}