From f1810dcd206fb0a951d93213f14e7cfc3789c844 Mon Sep 17 00:00:00 2001 From: Michatec Date: Thu, 29 Oct 2026 19:48:21 +0100 Subject: [PATCH] feat: add Shizuku integration for background playback optimization - Implement `Shizuku` helper and `ShizukuFragment` using Jetpack Compose to manage system permissions and Doze mode battery optimization whitelisting. - Add Shizuku API and provider dependencies, manifest provider configuration, vector icon, and localized strings. - Add Shizuku preference entry to `SettingsFragment` and navigation graph. - Update QR code verification logic to show a toast message on Android TV instead of hiding the preference. --- app/build.gradle.kts | 5 + app/src/main/AndroidManifest.xml | 9 + app/src/main/assets/web/index.html | 2 +- app/src/main/assets/web/translations.json | 10 + .../java/com/michatec/radio/MainActivity.kt | 6 + .../radio/fragments/SettingsFragment.kt | 23 +- .../radio/fragments/ShizukuFragment.kt | 328 ++++++++++++++++++ .../michatec/radio/integrations/Shizuku.kt | 157 +++++++++ app/src/main/res/drawable/ic_shizuku_24dp.xml | 35 ++ .../main/res/navigation/nav_graph_main.xml | 9 + app/src/main/res/values-da/strings.xml | 25 ++ app/src/main/res/values-de/strings.xml | 25 ++ app/src/main/res/values-el/strings.xml | 25 ++ app/src/main/res/values-fr/strings.xml | 25 ++ app/src/main/res/values-ja/strings.xml | 25 ++ app/src/main/res/values-nl/strings.xml | 25 ++ app/src/main/res/values-pl/strings.xml | 25 ++ app/src/main/res/values-ru/strings.xml | 23 ++ app/src/main/res/values-uk/strings.xml | 23 ++ app/src/main/res/values/strings.xml | 25 ++ gradle/libs.versions.toml | 5 + 21 files changed, 833 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/com/michatec/radio/fragments/ShizukuFragment.kt create mode 100644 app/src/main/java/com/michatec/radio/integrations/Shizuku.kt create mode 100644 app/src/main/res/drawable/ic_shizuku_24dp.xml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 144c94f..b7c9d1a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -73,6 +73,7 @@ dependencies { implementation(libs.material3) implementation(libs.gson) implementation(libs.play.services.cast.framework) + implementation(libs.ui.graphics) implementation(libs.zxing.core) implementation(libs.zxing.embedded) @@ -112,4 +113,8 @@ dependencies { implementation(libs.compose.material3) implementation(libs.aboutLibraries.compose) implementation(libs.compose.material.icons.extended) + + // Shizuku // + implementation(libs.shizuku.api) + implementation(libs.shizuku.provider) } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 45f43e4..d7f31f6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -21,6 +21,7 @@ + + + diff --git a/app/src/main/assets/web/index.html b/app/src/main/assets/web/index.html index d4dd4f5..671d6b7 100644 --- a/app/src/main/assets/web/index.html +++ b/app/src/main/assets/web/index.html @@ -202,7 +202,7 @@ socket.onmessage = (event) => {