Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Commit

Permalink
R3.15.7
Browse files Browse the repository at this point in the history
#31 添加对Sui的支持,感谢@Kazurin-775
附加组件更新
  • Loading branch information
ryuunoakaihitomi committed May 2, 2022
1 parent 11cac03 commit 7b5e4c0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
18 changes: 9 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ android {
//targetSdkVersion compileSdkVersion
targetSdkVersion 32
// 版本号:发布日期
versionCode 20220419
versionCode 20220503
// 版本名说明: R3.x.y.z (R3:Refactoring 第三次重构,z:Quick Fix序号)
// 不要包含非ASCII可打印字符,会导致Github release文件名异常
versionName 'R3.15.7'
versionName 'R3.15.8'
resConfigs "en", "zh-rCN"

buildConfigField 'String', 'BUILD_TIME', '\"' + new Date() + '\"'
Expand Down Expand Up @@ -132,12 +132,12 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"

// https://github.com/firebase/firebase-android-sdk
normalImplementation platform('com.google.firebase:firebase-bom:29.2.1')
normalImplementation platform('com.google.firebase:firebase-bom:29.3.1')
normalImplementation 'com.google.firebase:firebase-analytics-ktx'
normalImplementation 'com.google.firebase:firebase-crashlytics-ktx'

// https://github.com/microsoft/appcenter-sdk-android
normalImplementation 'com.microsoft.appcenter:appcenter-analytics:4.4.2'
normalImplementation 'com.microsoft.appcenter:appcenter-analytics:4.4.3'

/* ------- 其他第三方开源组件 ------- */

Expand All @@ -154,7 +154,7 @@ dependencies {
implementation "dev.rikka.shizuku:provider:$shizuku_version"

// https://github.com/ryuunoakaihitomi/PowerAct
implementation 'github.ryuunoakaihitomi.poweract:poweract:1.6.1'
implementation 'github.ryuunoakaihitomi.poweract:poweract:1.7.1'

// https://github.com/ryuunoakaihitomi/ReToast
runtimeOnly 'github.ryuunoakaihitomi.retoast:retoast:2.0.0'
Expand Down Expand Up @@ -189,10 +189,10 @@ dependencies {
implementation 'com.jakewharton.timber:timber:5.0.1'

// https://github.com/PureWriter/about-page
implementation 'com.drakeet.about:about:2.5.0'
implementation 'com.drakeet.about:about:2.5.1'

// https://github.com/zxing/zxing
implementation 'com.google.zxing:core:3.4.1'
implementation 'com.google.zxing:core:3.5.0'

// https://github.com/CyanogenMod/cm_platform_sdk
implementation 'org.cyanogenmod:platform.sdk:6.0'
Expand All @@ -207,10 +207,10 @@ dependencies {
implementation 'dev.rikka.rikkax.compatibility:compatibility:2.0.0'

// https://github.com/KyuubiRan/EzXHelper
implementation 'com.github.kyuubiran:EzXHelper:0.8.6'
implementation 'com.github.kyuubiran:EzXHelper:0.8.8'

// https://github.com/square/leakcanary
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'

// https://github.com/whataa/pandora
// 最新版是v2.1.0,仅支持android-support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import io.noties.markwon.image.ImagesPlugin
import org.apache.commons.io.IOUtils
import rikka.compatibility.DeviceCompatibility
import rikka.shizuku.Shizuku
import rikka.sui.Sui
import timber.log.Timber
import java.nio.charset.Charset
import java.util.*
Expand Down Expand Up @@ -97,9 +98,10 @@ class MainActivity : AppCompatActivity() {
}
powerViewModel.infoArray.observe(this) {
val rootMode = powerViewModel.rootMode.value ?: false
/* 特权模式下主动请求Shizuku授权,在受限模式下PowerAct已经处理好这个步骤 */
// 特权模式下(或者发现 Sui 时)主动请求 Shizuku 授权
// 在受限模式下 PowerAct 已经处理好这个步骤
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
rootMode && Shizuku.pingBinder() &&
(rootMode || Sui.isSui()) && Shizuku.pingBinder() &&
Shizuku.checkSelfPermission() != PackageManager.PERMISSION_GRANTED
) {
Timber.i("Request shizuku permission.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import github.ryuunoakaihitomi.powerpanel.util.RC
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import rikka.shizuku.Shizuku
import rikka.sui.Sui
import timber.log.Timber

// AndroidViewModel 因为魔法问题不可用了
Expand Down Expand Up @@ -60,14 +61,20 @@ class PowerViewModel : ViewModel() {
// 用来显示对话框
fun prepare() {
viewModelScope.launch(Dispatchers.IO) {
// 在这里提供root状态
// 由于libsu 4.0.0的变更,Shell.rootAccess()在返回true的情况下不再准确;需要进一步判断
val isRoot = if (Shell.rootAccess()) {
Shell.getShell().isRoot
} else false
val hasPrivilege = if (Sui.isSui()) {
// use Sui whenever available
Shizuku.checkSelfPermission() == PackageManager.PERMISSION_GRANTED
} else {
// if Sui is not present, fallback to plain old su
// 在这里提供root状态
// 由于libsu 4.0.0的变更,Shell.rootAccess()在返回true的情况下不再准确;需要进一步判断
if (Shell.rootAccess()) {
Shell.getShell().isRoot
} else false
}

viewModelScope.launch {
_rootMode.value = isRoot
_rootMode.value = hasPrivilege
forceMode.value = false
changeInfo()
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.6.20'
repositories {
google()
mavenCentral()
Expand Down

1 comment on commit 7b5e4c0

@ryuunoakaihitomi
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R3.15.8

Please sign in to comment.