Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target Android 15 (SDK 35) #5204

Draft
wants to merge 11 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.duckduckgo.mobile.android.vpn.heartbeat

import android.content.Context
import android.os.Process
import com.duckduckgo.common.utils.ConflatedJob
import com.duckduckgo.common.utils.DispatcherProvider
Expand All @@ -42,7 +41,6 @@ import logcat.logcat
)
@SingleInstanceIn(VpnScope::class)
class VpnServiceHeartbeat @Inject constructor(
private val context: Context,
private val vpnDatabase: VpnDatabase,
private val dispatcherProvider: DispatcherProvider,
) : VpnServiceCallbacks {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2023,7 +2023,7 @@ class BrowserTabFragment :

private fun launchDialogForIntent(
context: Context,
pm: PackageManager?,
pm: PackageManager,
intent: Intent,
activities: List<ResolveInfo>,
useFirstActivityFound: Boolean,
Expand Down Expand Up @@ -2487,7 +2487,6 @@ class BrowserTabFragment :
mixedContentMode = WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE
javaScriptCanOpenWindowsAutomatically = appBuildConfig.isTest // only allow when running tests
setSupportMultipleWindows(true)
disableWebSql(this)
setSupportZoom(true)
if (accessibilitySettingsDataStore.overrideSystemFontSize) {
textZoom = accessibilitySettingsDataStore.fontSize.toInt()
Expand Down Expand Up @@ -2872,13 +2871,6 @@ class BrowserTabFragment :
binding.swipeRefreshContainer.progressViewStartOffset -= 15
}

/**
* Explicitly disable database to try protect against Magellan WebSQL/SQLite vulnerability
*/
private fun disableWebSql(settings: WebSettings) {
settings.databaseEnabled = false
}

@Suppress("NewApi") // This API and the behaviour described only apply to apps with targetSdkVersion ≥ TIRAMISU.
private fun setAlgorithmicDarkeningAllowed(settings: WebSettings) {
// https://developer.android.com/reference/androidx/webkit/WebSettingsCompat#setAlgorithmicDarkeningAllowed(android.webkit.WebSettings,boolean)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class UrlExtractingWebView(
javaScriptEnabled = true
domStorageEnabled = true
mixedContentMode = WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE
disableWebSql(this)
loadsImagesAutomatically = false
}
setWebViewClient(webViewClient)
Expand All @@ -54,13 +53,6 @@ class UrlExtractingWebView(
}
}

/**
* Explicitly disable database to try protect against Magellan WebSQL/SQLite vulnerability
*/
private fun disableWebSql(settings: WebSettings) {
settings.databaseEnabled = false
}

override fun loadUrl(url: String) {
initialUrl = url
super.loadUrl(url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private class ViewChildrenRecursiveSequence(private val view: View) : Sequence<V

private class RecursiveViewIterator(view: View) : Iterator<View> {
private val sequences = arrayListOf(view.childrenSequence())
private var current = sequences.removeLast().iterator()
private var current = sequences.removeLastElement().iterator()

override fun next(): View {
if (!hasNext()) throw NoSuchElementException()
Expand All @@ -80,13 +80,13 @@ private class ViewChildrenRecursiveSequence(private val view: View) : Sequence<V

override fun hasNext(): Boolean {
if (!current.hasNext() && sequences.isNotEmpty()) {
current = sequences.removeLast().iterator()
current = sequences.removeLastElement().iterator()
}
return current.hasNext()
}

@Suppress("NOTHING_TO_INLINE")
private inline fun <T : Any> MutableList<T>.removeLast(): T {
private inline fun <T : Any> MutableList<T>.removeLastElement(): T {
if (isEmpty()) throw NoSuchElementException()
return removeAt(size - 1)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class SyncSavedSitesRepositoryTest {
savedSitesRelationsDao.insertList(relation)

val removedEntities = entities.toMutableList()
val removedEntity = removedEntities.removeFirst()
val removedEntity = removedEntities.removeAt(0)

val removedEntitiesIds = removedEntities.map { it.entityId }
val childrenJSON = stringListAdapter.toJson(removedEntitiesIds)
Expand Down Expand Up @@ -320,7 +320,7 @@ class SyncSavedSitesRepositoryTest {
savedSitesRelationsDao.insertList(folderRelation)

val updatedChildren = bookmarks.toMutableList()
val removedChildren = updatedChildren.removeFirst()
val removedChildren = updatedChildren.removeAt(0)

repository.replaceBookmarkFolder(folder, updatedChildren.map { it.entityId })

Expand Down
2 changes: 1 addition & 1 deletion autofill/autofill-impl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ dependencies {
implementation AndroidX.room.ktx
implementation AndroidX.biometric

implementation "net.zetetic:android-database-sqlcipher:_"
implementation "net.zetetic:sqlcipher-android:_"
implementation "com.facebook.shimmer:shimmer:_"

// Testing dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import com.duckduckgo.securestorage.store.db.SecureStorageDatabase
import com.squareup.anvil.annotations.ContributesBinding
import dagger.SingleInstanceIn
import javax.inject.Inject
import net.sqlcipher.database.SupportFactory
import net.zetetic.database.sqlcipher.SupportOpenHelperFactory

interface SecureStorageDatabaseFactory {
fun getDatabase(): SecureStorageDatabase?
Expand Down Expand Up @@ -52,7 +52,7 @@ class RealSecureStorageDatabaseFactory @Inject constructor(
context,
SecureStorageDatabase::class.java,
"secure_storage_database_encrypted.db",
).openHelperFactory(SupportFactory(keyProvider.getl1Key()))
).openHelperFactory(SupportOpenHelperFactory(keyProvider.getl1Key()))
.addMigrations(*ALL_MIGRATIONS)
.build()
_database
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {

ext {
min_sdk = 26
target_sdk = 34
compile_sdk = 34
target_sdk = 35
compile_sdk = 35

// Calculate lint_version (must always be gradle_plugin + 23)
def gradle_plugin_version = versionFor(project, Android.tools.build.gradlePlugin)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>

<!--
~ Copyright (c) 2024 DuckDuckGo
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<resources>

<style name="Platform.Theme.DuckDuckGo" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:windowLightStatusBar">?attr/preferDarkStatusBarIcons</item>
<item name="android:windowLightNavigationBar">?attr/preferDarkNavigationBarIcons</item>
<item name="android:statusBarColor">?attr/preferredStatusBarColor</item>
<item name="android:navigationBarColor">?attr/preferredNavigationBarColor</item>
<item name="preferDarkNavigationBarIcons">false</item>
<item name="preferredNavigationBarColor">?attr/daxColorBlack</item>
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ class SubscriptionsWebViewActivity : DuckDuckGoActivity(), DownloadConfirmationD
displayZoomControls = false
mixedContentMode = WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE
setSupportMultipleWindows(false)
databaseEnabled = false
setSupportZoom(true)
}
it.setDownloadListener { url, _, contentDisposition, mimeType, _ ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ class SigningCertificateHashExtractorImpl @Inject constructor(
return null
}

if (info.signingInfo.signingCertificateHistory.size != 1) {
if (info.signingInfo!!.signingCertificateHistory.size != 1) {
return null
}

return info.signingInfo.signingCertificateHistory?.lastOrNull()?.sha256()
return info.signingInfo!!.signingCertificateHistory?.lastOrNull()?.sha256()
}

private fun Signature.sha256(): String {
Expand Down
6 changes: 3 additions & 3 deletions versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ version.mockito=5.13.0

version.moshi=1.8.0

version.okhttp3=4.12.0
version.net.zetetic..sqlcipher-android=4.6.1

version.net.zetetic..android-database-sqlcipher=4.5.4
version.okhttp3=4.12.0

version.okio=3.9.0

Expand All @@ -143,7 +143,7 @@ version.com.jakewharton.retrofit..retrofit2-kotlin-coroutines-adapter=0.9.2

version.androidx.viewpager2=1.1.0

version.robolectric=4.13
version.robolectric=4.14

version.com.facebook.shimmer..shimmer=0.5.0

Expand Down
Loading