From e8cdc2077f295cf61ed7157f8ae2cdbb53c39054 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 8 Aug 2024 02:46:08 +0530 Subject: fix(build): compile against SDK 35 --- .../main/java/app/passwordstore/util/shortcuts/ShortcutHandler.kt | 4 +++- .../github/androidpasswordstore/autofillparser/AutofillHelper.kt | 7 +++++-- .../src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt | 2 +- gradle.properties | 1 + .../src/main/kotlin/app/passwordstore/ui/compose/theme/Theme.kt | 3 --- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/app/passwordstore/util/shortcuts/ShortcutHandler.kt b/app/src/main/java/app/passwordstore/util/shortcuts/ShortcutHandler.kt index b7e6549a..9248ba55 100644 --- a/app/src/main/java/app/passwordstore/util/shortcuts/ShortcutHandler.kt +++ b/app/src/main/java/app/passwordstore/util/shortcuts/ShortcutHandler.kt @@ -41,7 +41,9 @@ class ShortcutHandler @Inject constructor(@ApplicationContext val context: Conte val shortcuts = shortcutManager.dynamicShortcuts // If we're above or equal to the maximum shortcuts allowed, drop the last item. if (shortcuts.size >= MAX_SHORTCUT_COUNT) { - shortcuts.removeLast() + // We'd just do List.removeLast but the Kotlin stdlib extension gets shadowed by the API 35 + // JDK implementation + shortcuts.removeAt(shortcuts.lastIndex) } // Reverse the list so we can append our new shortcut at the 'end'. shortcuts.reverse() diff --git a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt index f08f3172..3514e8f1 100644 --- a/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt +++ b/autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillHelper.kt @@ -50,7 +50,10 @@ public fun computeCertificatesHash(context: Context, appPackage: String): String @SuppressLint("PackageManagerGetSignatures") @Suppress("DEPRECATION") val signaturesOld = - context.packageManager.getPackageInfo(appPackage, PackageManager.GET_SIGNATURES).signatures + context.packageManager + .getPackageInfo(appPackage, PackageManager.GET_SIGNATURES) + .signatures + .orEmpty() val stableHashOld = stableHash(signaturesOld.map { it.toByteArray() }) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { val info = @@ -63,7 +66,7 @@ public fun computeCertificatesHash(context: Context, appPackage: String): String context.packageManager.getPackageInfo(appPackage, PackageManager.GET_SIGNING_CERTIFICATES) } val signaturesNew = - info.signingInfo.signingCertificateHistory ?: info.signingInfo.apkContentsSigners + info.signingInfo?.signingCertificateHistory ?: info.signingInfo?.apkContentsSigners.orEmpty() val stableHashNew = stableHash(signaturesNew.map { it.toByteArray() }) if (stableHashNew != stableHashOld) logcat("CertificatesHash", ERROR) { diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt index 7157d3ae..bf12a32d 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/AndroidCommon.kt @@ -15,7 +15,7 @@ import org.gradle.kotlin.dsl.withType object AndroidCommon { fun configure(project: Project) { project.extensions.configure { - compileSdkVersion(34) + compileSdkVersion(35) defaultConfig { minSdk = 26 targetSdk = 34 diff --git a/gradle.properties b/gradle.properties index 0cc380ff..dde45722 100644 --- a/gradle.properties +++ b/gradle.properties @@ -48,6 +48,7 @@ android.disableEarlyManifestParsing=true # Disable warnings about unsupported features android.suppressUnsupportedOptionWarnings=android.dependencyResolutionAtConfigurationTime.disallow,android.disableEarlyManifestParsing,android.suppressUnsupportedOptionWarnings +android.suppressUnsupportedCompileSdk=35 # Maven publishing GROUP=com.github.android-password-store diff --git a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/theme/Theme.kt b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/theme/Theme.kt index 6827e01a..cf122f20 100644 --- a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/theme/Theme.kt +++ b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/theme/Theme.kt @@ -10,8 +10,6 @@ import androidx.compose.material3.dynamicLightColorScheme import androidx.compose.material3.lightColorScheme import androidx.compose.runtime.Composable import androidx.compose.runtime.SideEffect -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalView import androidx.core.view.WindowCompat @@ -95,7 +93,6 @@ public fun APSTheme( if (!view.isInEditMode) { SideEffect { val window = (view.context as Activity).window - window.statusBarColor = Color.Transparent.toArgb() WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme } } -- cgit v1.2.3