fix permission poups and add settings to see permission state
This commit is contained in:
@@ -15,12 +15,36 @@ object RootManager {
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun hasRoot(): Boolean = withContext(Dispatchers.IO) {
|
||||
Shell.isAppGrantedRoot() == true
|
||||
/**
|
||||
* Check if root was previously granted (cached status, no popup).
|
||||
* Returns true if granted, false if denied, null if unknown.
|
||||
*/
|
||||
fun isRootGrantedCached(): Boolean? {
|
||||
return Shell.isAppGrantedRoot()
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if root is available. Will trigger Magisk popup if not previously decided.
|
||||
*/
|
||||
suspend fun hasRoot(): Boolean = withContext(Dispatchers.IO) {
|
||||
try {
|
||||
// getShell() initializes the shell and checks root status with Magisk
|
||||
// If already granted, Magisk will auto-approve silently
|
||||
Shell.getShell().isRoot
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request root access. Will trigger Magisk popup.
|
||||
*/
|
||||
suspend fun requestRoot(): Boolean = withContext(Dispatchers.IO) {
|
||||
Shell.getShell().isRoot
|
||||
try {
|
||||
Shell.getShell().isRoot
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun executeCommand(command: String): CommandResult = withContext(Dispatchers.IO) {
|
||||
|
||||
Reference in New Issue
Block a user