From cabc84a43df2a418f7a9e82fd04fa2bebc7f6826 Mon Sep 17 00:00:00 2001 From: Soren Stoutner <soren@stoutner.com> Date: Tue, 17 Oct 2023 14:44:49 -0700 Subject: [PATCH] Bump target API to 34. https://redmine.stoutner.com/issues/1104 --- app/build.gradle | 29 +++++++++++++------ app/src/main/AndroidManifest.xml | 12 ++++++-- app/src/main/assets/de/permissions.html | 6 +++- app/src/main/assets/en/permissions.html | 6 +++- app/src/main/assets/es/permissions.html | 6 +++- app/src/main/assets/fr/permissions.html | 6 +++- app/src/main/assets/it/permissions.html | 6 +++- app/src/main/assets/ru/permissions.html | 6 +++- .../privacycell/fragments/SettingsFragment.kt | 6 ++-- .../privacycell/helpers/ProtocolHelper.kt | 5 ++-- .../receivers/OnBootCompletedReceiver.kt | 4 +-- .../workers/RegisterRealtimeListenerWorker.kt | 4 +-- .../workers/RestartServiceWorker.kt | 4 +-- build.gradle | 6 ++-- gradle.properties | 15 +++++++++- gradle/wrapper/gradle-wrapper.properties | 19 +++++++++++- 16 files changed, 107 insertions(+), 33 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 39d64f4..ccdfa9a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,15 +23,26 @@ plugins { } android { - compileSdk 33 + compileSdk 34 defaultConfig { applicationId "com.stoutner.privacycell" minSdk 30 - targetSdk 33 + targetSdk 34 versionCode 11 versionName "1.9" - resConfigs "en", "de", "es", "fr", "it", "ru" + resourceConfigurations += ['en', 'de', 'es', 'fr', 'it', 'ru'] + } + + // Specify the compile Java version. This must match the Kotlin JVM target. For some reason the system was not setting this correctly. These can probably be removed in the future. + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } + + // Specify the Kotlin JVM target. This must match the compile Java version. For some reason the system was not setting this correctly. These can probably be removed in the future. + kotlinOptions { + jvmTarget = 17 } buildTypes { @@ -53,16 +64,16 @@ android { dependencies { // Include the following AndroidX libraries. implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'androidx.core:core-ktx:1.9.0' - implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0' - implementation 'androidx.preference:preference-ktx:1.2.0' + implementation 'androidx.core:core-ktx:1.12.0' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2' + implementation 'androidx.preference:preference-ktx:1.2.1' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' - implementation 'androidx.webkit:webkit:1.6.0' + implementation 'androidx.webkit:webkit:1.8.0' implementation 'androidx.work:work-runtime-ktx:2.8.1' // Include the Kotlin standard library. This should be the same version number listed in the project build.gradle. - implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0' + implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22' // Include the Google material library. - implementation 'com.google.android.material:material:1.8.0' + implementation 'com.google.android.material:material:1.10.0' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 528c4c3..a0b6238 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - Copyright 2021-2022 Soren Stoutner <soren@stoutner.com>. + Copyright 2021-2023 Soren Stoutner <soren@stoutner.com>. This file is part of Privacy Cell <https://www.stoutner.com/privacy-cell>. @@ -32,6 +32,7 @@ <!-- Required to run a foreground service (which is the only type of service that can display notifications). --> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> + <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" /> <!-- Required to start the realtime notification icon at boot. --> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> @@ -93,7 +94,14 @@ android:screenOrientation="fullUser" /> <!-- Realtime Monitoring Service. --> - <service android:name=".services.RealtimeMonitoringService" /> + <service + android:name=".services.RealtimeMonitoringService" + android:foregroundServiceType="specialUse" > + + <property + android:name="android.app.PROPERTY_SPECIAL_USE_FGS_SUBTYPE" + android:value="Displays current cell protocol security information." /> + </service> <!-- On Boot Completed Receiver. --> <receiver diff --git a/app/src/main/assets/de/permissions.html b/app/src/main/assets/de/permissions.html index 8c13759..8eb987e 100644 --- a/app/src/main/assets/de/permissions.html +++ b/app/src/main/assets/de/permissions.html @@ -1,5 +1,5 @@ <!-- - Copyright © 2021 Soren Stoutner <soren@stoutner.com>. + Copyright 2021,2023 Soren Stoutner <soren@stoutner.com>. Translation 2021 Bernhard G. Keller. Copyright assigned to Soren Stoutner <soren@stoutner.com>. @@ -39,6 +39,10 @@ <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE">android.permission.<wbr>FOREGROUND_SERVICE</a></p> <p>Erlaubt Privacy Cell, ein Benachrichtigungs-Icon für die Echtzeit-Ãberwachung in der Status-Zeile anzuzeigen.</p> + <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE_SPECIAL_USE">android.permission.<wbr>FOREGROUND_SERVICE_<wbr>SPECIAL_USE</a></p> + <p>Specifies the type of foreground service. + Special Use is for services that don't fit into any of the <a href="https://developer.android.com/about/versions/14/changes/fgs-types-required">standard categories</a>.</p> + <h3>Ausführung bei Systemstart</h3> <p><a href="https://developer.android.com/reference/android/Manifest.permission#RECEIVE_BOOT_COMPLETED">android.permission.<wbr>RECEIVE_BOOT_COMPLETED</a></p> <p>Erlaubt Privacy Cell die Echtzeit-Ãberwachung zu aktivieren, wenn das Smartphone gebootet wird.</p> diff --git a/app/src/main/assets/en/permissions.html b/app/src/main/assets/en/permissions.html index be792c7..5317604 100644 --- a/app/src/main/assets/en/permissions.html +++ b/app/src/main/assets/en/permissions.html @@ -1,5 +1,5 @@ <!-- - Copyright © 2021 Soren Stoutner <soren@stoutner.com>. + Copyright 2021,2023 Soren Stoutner <soren@stoutner.com>. This file is part of Privacy Cell <https://www.stoutner.com/privacy-cell>. @@ -37,6 +37,10 @@ <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE">android.permission.<wbr>FOREGROUND_SERVICE</a></p> <p>Allows Privacy Cell to display a realtime monitoring notification icon in the status bar.</p> + <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE_SPECIAL_USE">android.permission.<wbr>FOREGROUND_SERVICE_<wbr>SPECIAL_USE</a></p> + <p>Specifies the type of foreground service. + Special Use is for services that don't fit into any of the <a href="https://developer.android.com/about/versions/14/changes/fgs-types-required">standard categories</a>.</p> + <h3>Run at startup</h3> <p><a href="https://developer.android.com/reference/android/Manifest.permission#RECEIVE_BOOT_COMPLETED">android.permission.<wbr>RECEIVE_BOOT_COMPLETED</a></p> <p>Allows Privacy Cell to enable the realtime monitoring service when the phone boots.</p> diff --git a/app/src/main/assets/es/permissions.html b/app/src/main/assets/es/permissions.html index dd8000e..2d1378c 100644 --- a/app/src/main/assets/es/permissions.html +++ b/app/src/main/assets/es/permissions.html @@ -1,5 +1,5 @@ <!-- - Copyright © 2021 Soren Stoutner <soren@stoutner.com>. + Copyright 2021,2023 Soren Stoutner <soren@stoutner.com>. Translation 2021 Jose A. León. Copyright assigned to Soren Stoutner <soren@stoutner.com>. @@ -39,6 +39,10 @@ <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE">android.permission.<wbr>FOREGROUND_SERVICE</a></p> <p>Allows Privacy Cell to display a realtime monitoring notification icon in the status bar.</p> + <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE_SPECIAL_USE">android.permission.<wbr>FOREGROUND_SERVICE_<wbr>SPECIAL_USE</a></p> + <p>Specifies the type of foreground service. + Special Use is for services that don't fit into any of the <a href="https://developer.android.com/about/versions/14/changes/fgs-types-required">standard categories</a>.</p> + <h3>Run at startup</h3> <p><a href="https://developer.android.com/reference/android/Manifest.permission#RECEIVE_BOOT_COMPLETED">android.permission.<wbr>RECEIVE_BOOT_COMPLETED</a></p> <p>Allows Privacy Cell to enable the realtime monitoring service when the phone boots.</p> diff --git a/app/src/main/assets/fr/permissions.html b/app/src/main/assets/fr/permissions.html index 04e1c79..275c3c1 100644 --- a/app/src/main/assets/fr/permissions.html +++ b/app/src/main/assets/fr/permissions.html @@ -1,5 +1,5 @@ <!-- - Copyright © 2021 Soren Stoutner <soren@stoutner.com>. + Copyright 2021,2023 Soren Stoutner <soren@stoutner.com>. Translation 2021 Kévin L. <kevinliste@framalistes.org>. Copyright assigned to Soren Stoutner <soren@stoutner.com>. @@ -39,6 +39,10 @@ <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE">android.permission.<wbr>FOREGROUND_SERVICE</a></p> <p>Permet à Privacy Cell d'afficher une icône de notification de surveillance en temps réel dans la barre d'état.</p> + <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE_SPECIAL_USE">android.permission.<wbr>FOREGROUND_SERVICE_<wbr>SPECIAL_USE</a></p> + <p>Specifies the type of foreground service. + Special Use is for services that don't fit into any of the <a href="https://developer.android.com/about/versions/14/changes/fgs-types-required">standard categories</a>.</p> + <h3>Exécution au démarrage</h3> <p><a href="https://developer.android.com/reference/android/Manifest.permission#RECEIVE_BOOT_COMPLETED">android.permission.<wbr>RECEIVE_BOOT_COMPLETED</a></p> <p>Permet à Privacy Cell d'activer le service de surveillance en temps réel lorsque le téléphone démarre.</p> diff --git a/app/src/main/assets/it/permissions.html b/app/src/main/assets/it/permissions.html index 5062c6a..caeae35 100644 --- a/app/src/main/assets/it/permissions.html +++ b/app/src/main/assets/it/permissions.html @@ -1,5 +1,5 @@ <!-- - Copyright © 2021 Soren Stoutner <soren@stoutner.com>. + Copyright 2021,2023 Soren Stoutner <soren@stoutner.com>. Translation 2021 Francesco Buratti. Copyright assigned to Soren Stoutner <soren@stoutner.com>. @@ -39,6 +39,10 @@ <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE">android.permission.<wbr>FOREGROUND_SERVICE</a></p> <p>Allows Privacy Cell to display a realtime monitoring notification icon in the status bar.</p> + <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE_SPECIAL_USE">android.permission.<wbr>FOREGROUND_SERVICE_<wbr>SPECIAL_USE</a></p> + <p>Specifies the type of foreground service. + Special Use is for services that don't fit into any of the <a href="https://developer.android.com/about/versions/14/changes/fgs-types-required">standard categories</a>.</p> + <h3>Run at startup</h3> <p><a href="https://developer.android.com/reference/android/Manifest.permission#RECEIVE_BOOT_COMPLETED">android.permission.<wbr>RECEIVE_BOOT_COMPLETED</a></p> <p>Allows Privacy Cell to enable the realtime monitoring service when the phone boots.</p> diff --git a/app/src/main/assets/ru/permissions.html b/app/src/main/assets/ru/permissions.html index 8c84905..29c24b9 100644 --- a/app/src/main/assets/ru/permissions.html +++ b/app/src/main/assets/ru/permissions.html @@ -1,5 +1,5 @@ <!-- - Copyright © 2021 Soren Stoutner <soren@stoutner.com>. + Copyright 2021,2023 Soren Stoutner <soren@stoutner.com>. This file is part of Privacy Cell <https://www.stoutner.com/privacy-cell>. @@ -37,6 +37,10 @@ <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE">android.permission.<wbr>FOREGROUND_SERVICE</a></p> <p>РазÑеÑÐ°ÐµÑ Privacy Cell оÑобÑажаÑÑ Ð·Ð½Ð°Ñок ÑÐ²ÐµÐ´Ð¾Ð¼Ð»ÐµÐ½Ð¸Ñ Ð¾ мониÑоÑинге в ÑеалÑном вÑемени в ÑÑÑоке ÑоÑÑоÑниÑ.</p> + <p><a href="https://developer.android.com/reference/android/Manifest.permission#FOREGROUND_SERVICE_SPECIAL_USE">android.permission.<wbr>FOREGROUND_SERVICE_<wbr>SPECIAL_USE</a></p> + <p>Specifies the type of foreground service. + Special Use is for services that don't fit into any of the <a href="https://developer.android.com/about/versions/14/changes/fgs-types-required">standard categories</a>.</p> + <h3>ÐапÑÑк пÑи загÑÑзке</h3> <p><a href="https://developer.android.com/reference/android/Manifest.permission#RECEIVE_BOOT_COMPLETED">android.permission.<wbr>RECEIVE_BOOT_COMPLETED</a></p> <p>РазÑеÑÐ°ÐµÑ Privacy Cell вклÑÑаÑÑ ÑлÑÐ¶Ð±Ñ Ð¼Ð¾Ð½Ð¸ÑоÑинга в ÑеалÑном вÑемени пÑи загÑÑзке ÑелеÑона.</p> diff --git a/app/src/main/java/com/stoutner/privacycell/fragments/SettingsFragment.kt b/app/src/main/java/com/stoutner/privacycell/fragments/SettingsFragment.kt index dc8545f..911ab08 100644 --- a/app/src/main/java/com/stoutner/privacycell/fragments/SettingsFragment.kt +++ b/app/src/main/java/com/stoutner/privacycell/fragments/SettingsFragment.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021-2022 Soren Stoutner <soren@stoutner.com>. + * Copyright 2021-2023 Soren Stoutner <soren@stoutner.com>. * * This file is part of Privacy Cell <https://www.stoutner.com/privacy-cell>. * @@ -56,7 +56,7 @@ class SettingsFragment : PreferenceFragmentCompat() { private lateinit var bottomAppBarPreference: Preference companion object { - // Declare the private static class variables. Otherwise, onRestart will not pull the same values that are populated from the saved instance state. + // Declare the private static class variables. For some reason (I'm looking at you Android's Activity Lifecycle) this only works if these are static. private var fragmentRestarted: Boolean = false private var scrollY: Int = 0 } @@ -140,7 +140,7 @@ class SettingsFragment : PreferenceFragmentCompat() { // Check if the fragment has been restarted. if (savedInstanceState != null) { - // Set the fragment restored flag. + // Set the fragment restarted flag. fragmentRestarted = true // Save the scroll Y. diff --git a/app/src/main/java/com/stoutner/privacycell/helpers/ProtocolHelper.kt b/app/src/main/java/com/stoutner/privacycell/helpers/ProtocolHelper.kt index 11407f7..cb6ca1d 100644 --- a/app/src/main/java/com/stoutner/privacycell/helpers/ProtocolHelper.kt +++ b/app/src/main/java/com/stoutner/privacycell/helpers/ProtocolHelper.kt @@ -1,5 +1,5 @@ /* - * Copyright 2022 Soren Stoutner <soren@stoutner.com>. + * Copyright 2022-2023 Soren Stoutner <soren@stoutner.com>. * * This file is part of Privacy Cell <https://www.stoutner.com/privacy-cell>. * @@ -84,7 +84,8 @@ class ProtocolHelper { } fun getNetworkTypeStringArray(networkType: Int, context: Context) : Array<String> { - // Return the string array that corresponds to the network type. + // Return the string array that corresponds to the network type. The deprecated `NETWORK_TYPE_IDEN` can be removed once the minimum API >= 34. + @Suppress("DEPRECATION") return when(networkType) { TelephonyManager.NETWORK_TYPE_UNKNOWN -> arrayOf(context.getString(R.string.unknown), "") TelephonyManager.NETWORK_TYPE_GPRS -> arrayOf(context.getString(R.string.gprs), context.getString(R.string.gprs_detail)) diff --git a/app/src/main/java/com/stoutner/privacycell/receivers/OnBootCompletedReceiver.kt b/app/src/main/java/com/stoutner/privacycell/receivers/OnBootCompletedReceiver.kt index 54e23e9..72cc453 100644 --- a/app/src/main/java/com/stoutner/privacycell/receivers/OnBootCompletedReceiver.kt +++ b/app/src/main/java/com/stoutner/privacycell/receivers/OnBootCompletedReceiver.kt @@ -1,5 +1,5 @@ /* - * Copyright © 2021 Soren Stoutner <soren@stoutner.com>. + * Copyright 2021,2023 Soren Stoutner <soren@stoutner.com>. * * This file is part of Privacy Cell <https://www.stoutner.com/privacy-cell>. * @@ -42,4 +42,4 @@ class OnBootCompletedReceiver : BroadcastReceiver() { } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/stoutner/privacycell/workers/RegisterRealtimeListenerWorker.kt b/app/src/main/java/com/stoutner/privacycell/workers/RegisterRealtimeListenerWorker.kt index 6bb76ad..d899bf7 100644 --- a/app/src/main/java/com/stoutner/privacycell/workers/RegisterRealtimeListenerWorker.kt +++ b/app/src/main/java/com/stoutner/privacycell/workers/RegisterRealtimeListenerWorker.kt @@ -1,5 +1,5 @@ /* - * Copyright © 2021-2022 Soren Stoutner <soren@stoutner.com>. + * Copyright 2021-2023 Soren Stoutner <soren@stoutner.com>. * * This file is part of Privacy Cell <https://www.stoutner.com/privacy-cell>. * @@ -100,4 +100,4 @@ class RegisterRealtimeListenerWorker(appContext: Context, workerParameters: Work // Return a success. return Result.success() } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/stoutner/privacycell/workers/RestartServiceWorker.kt b/app/src/main/java/com/stoutner/privacycell/workers/RestartServiceWorker.kt index 720ca7a..ed1fdde 100644 --- a/app/src/main/java/com/stoutner/privacycell/workers/RestartServiceWorker.kt +++ b/app/src/main/java/com/stoutner/privacycell/workers/RestartServiceWorker.kt @@ -1,5 +1,5 @@ /* - * Copyright © 2021-2022 Soren Stoutner <soren@stoutner.com>. + * Copyright 2021-2023 Soren Stoutner <soren@stoutner.com>. * * This file is part of Privacy Cell <https://www.stoutner.com/privacy-cell>. * @@ -51,4 +51,4 @@ class RestartServiceWorker(appContext: Context, workerParameters: WorkerParamete // Return a success. return Result.success() } -} \ No newline at end of file +} diff --git a/build.gradle b/build.gradle index 7045733..428e4af 100644 --- a/build.gradle +++ b/build.gradle @@ -25,14 +25,14 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0" + classpath 'com.android.tools.build:gradle:8.1.2' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } -task clean(type: Delete) { +tasks.register('clean', Delete) { delete rootProject.buildDir } diff --git a/gradle.properties b/gradle.properties index 02ba79e..06cfed7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,17 +24,30 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 + # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true + # AndroidX package structure to make it clearer which packages are bundled with the # Android operating system, and which are packaged with your app"s APK # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true + # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true + # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official + # Enable the configuration cache, which improves build speed. -org.gradle.unsafe.configuration-cache=true \ No newline at end of file +org.gradle.unsafe.configuration-cache=true + +# Use non-transitive R classes, which speed up the build process when the configuration has not changed. +android.nonTransitiveRClass=true + +# Use non-final resource IDs for faster incremental compilation. +android.nonFinalResIds=true + +android.defaults.buildfeatures.buildconfig=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1e2b5c5..2f3069e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,23 @@ +# Copyright 2023 Soren Stoutner <soren@stoutner.com>. +# +# This file is part of Privacy Cell <https://www.stoutner.com/privacy-cell>. +# +# Privacy Cell is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Privacy Cell is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Privacy Browser. If not, see <http://www.gnu.org/licenses/>. + #Thu Aug 12 09:15:13 MST 2021 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME -- 2.47.2