-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- updated to the latest libs and tools
- implemented app shortcuts to quicktoggle between permissive and enforcing modes - new icons and notification styles - adaptive icons (including shortcuts) for 8.0+ - fixed crashes on rootless devices - fixed crashes on 8.0+ (still, app won't work if kernel doesn't allow context switching) - few tweaks and smaller bug-fixes.
- Loading branch information
Showing
36 changed files
with
239 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!-- drawable/lock_open_outline.xml --> | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:height="108dp" | ||
android:width="108dp" | ||
android:viewportWidth="48" | ||
android:viewportHeight="48"> | ||
<group android:translateX="12" android:translateY="12"> | ||
<path android:fillColor="#000" android:pathData="M18,20V10H6V20H18M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V10A2,2 0 0,1 6,8H15V6A3,3 0 0,0 12,3A3,3 0 0,0 9,6H7A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,17A2,2 0 0,1 10,15A2,2 0 0,1 12,13A2,2 0 0,1 14,15A2,2 0 0,1 12,17Z" /> | ||
</group> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!-- drawable/lock_outline.xml --> | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:height="108dp" | ||
android:width="108dp" | ||
android:viewportWidth="48" | ||
android:viewportHeight="48"> | ||
<group android:translateX="12" android:translateY="12"> | ||
<path android:fillColor="#000" android:pathData="M12,17C10.89,17 10,16.1 10,15C10,13.89 10.89,13 12,13A2,2 0 0,1 14,15A2,2 0 0,1 12,17M18,20V10H6V20H18M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V10C4,8.89 4.89,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z" /> | ||
</group> | ||
</vector> |
Oops, something went wrong.