Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
qhy040404 committed Jan 16, 2023
1 parent 1b8334f commit fb3e39d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId = "com.qhy040404.fxxkmiuiad"
minSdk = 29
targetSdk = 33
versionCode = 1
versionName = "1.0.0"
versionCode = 2
versionName = "1.1.0"
}

buildTypes {
Expand Down
19 changes: 17 additions & 2 deletions app/src/main/java/com/qhy040404/fxxkmiuiad/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class MainActivity : AppCompatActivity() {
initView()
}

override fun onResume() {
super.onResume()
check(true)
}

override fun onDestroy() {
Shizuku.removeRequestPermissionResultListener(callback)
super.onDestroy()
Expand Down Expand Up @@ -114,7 +119,8 @@ class MainActivity : AppCompatActivity() {
}

enable.setOnClickListener {
if (permitted) {
@Suppress("KotlinConstantConditions")
if (running && permitted) {
val p = Shizuku.newProcess(arrayOf("sh"), null, null)
val out = p.outputStream
out.write(generateCmd(generatePmEnableCmd(fkList)).toByteArray())
Expand All @@ -127,10 +133,15 @@ class MainActivity : AppCompatActivity() {
recreate()
}
}
} else if (!running) {
Toast.makeText(this, "Shizuku 未运行", Toast.LENGTH_SHORT).show()
} else if (!permitted) {
Toast.makeText(this, "Shizuku 未授权", Toast.LENGTH_SHORT).show()
}
}
disable.setOnClickListener {
if (permitted) {
@Suppress("KotlinConstantConditions")
if (running && permitted) {
val p = Shizuku.newProcess(arrayOf("sh"), null, null)
val out = p.outputStream
out.write(generateCmd(generatePmDisableCmd(fkList)).toByteArray())
Expand All @@ -143,6 +154,10 @@ class MainActivity : AppCompatActivity() {
recreate()
}
}
} else if (!running) {
Toast.makeText(this, "Shizuku 未运行", Toast.LENGTH_SHORT).show()
} else if (!permitted) {
Toast.makeText(this, "Shizuku 未授权", Toast.LENGTH_SHORT).show()
}
}
}
Expand Down

0 comments on commit fb3e39d

Please sign in to comment.