diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4c57523..16d04d4 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,6 +9,10 @@ + + + + + startActivity(launcher) + exitProcess(0) + } + .setNegativeButton("Ignore") { _, _ -> + sharedPreferences.edit(commit = true) { + putBoolean(IGNORE_KSU, true) + } + initShell() + } + .setOnCancelListener { + sharedPreferences.edit(commit = true) { + putBoolean(IGNORE_KSU, true) + } + initShell() + } + .show() + } + + private fun initShell() { + Shell.getShell { shell -> + val methodStr = if (shell.isRoot) "root" else "non-root" + Toast.makeText(applicationContext, "Using $methodStr method", Toast.LENGTH_SHORT) + .show() + launchActivity() + } + } - startActivity(intent) + private fun launchActivity() { + Intent(applicationContext, MainActivity::class.java).also { + startActivity(it) finish() } }