diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index e2456cbd..00000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/Android.bp b/Android.bp index 5664d6d1..cf5d6f51 100644 --- a/Android.bp +++ b/Android.bp @@ -27,6 +27,7 @@ android_app { "kotlin-stdlib-jdk8", "androidx.core_core-ktx", "androidx.preference_preference", + "androidx.documentfile_documentfile", "androidx.lifecycle_lifecycle-viewmodel-ktx", "androidx.lifecycle_lifecycle-livedata-ktx", "androidx-constraintlayout_constraintlayout", @@ -37,9 +38,8 @@ android_app { "androidx.room_room-runtime", "libprotobuf-java-lite", // koin - "seedvault-lib-koin-core", // did not manage to add this as transitive dependency + "seedvault-lib-koin-core-jvm", // did not manage to add this as transitive dependency "seedvault-lib-koin-android", - "seedvault-lib-koin-androidx-viewmodel", // bip39 "seedvault-lib-kotlin-bip39", ], diff --git a/app/build.gradle b/app/build.gradle index 8509fc4f..eb78fa33 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,9 +1,7 @@ -import groovy.xml.XmlUtil - plugins { id "com.android.application" id "kotlin-android" - id "org.jlleitschuh.gradle.ktlint" version "9.4.0" + id "org.jlleitschuh.gradle.ktlint" version "10.2.0" } def gitDescribe = { -> @@ -34,7 +32,9 @@ android { } lintOptions { - disable "CheckedExceptions" + disable "DialogFragmentCallbacksDetector", + "InvalidFragmentVersionForActivityResult", + "CheckedExceptions" abortOnError true } compileOptions { @@ -43,7 +43,7 @@ android { } kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8.toString() - languageVersion = "1.3" + languageVersion = "1.4" } testOptions { unitTests.all { @@ -98,6 +98,7 @@ dependencies { implementation rootProject.ext.std_libs.androidx_core // A newer version gets pulled in with AOSP via core, so we include fragment here explicitly implementation rootProject.ext.std_libs.androidx_fragment + implementation rootProject.ext.std_libs.androidx_activity implementation rootProject.ext.std_libs.androidx_preference implementation rootProject.ext.std_libs.androidx_lifecycle_viewmodel_ktx implementation rootProject.ext.std_libs.androidx_lifecycle_livedata_ktx @@ -119,12 +120,15 @@ dependencies { * If the dependencies below are updated, * please make sure to update the prebuilt libraries and the Android.bp files * in the top-level `libs` folder to reflect that. - * You can copy these libraries from ~/.gradle/caches/modules-2 + * You can copy these libraries from ~/.gradle/caches/modules-2/files-2.1 */ // later versions than 2.1.1 require newer kotlin version +// implementation "io.insert-koin:koin-core-jvm:3.1.2" +// implementation "io.insert-koin:koin-android:3.1.2" implementation fileTree(include: ['*.jar'], dir: "${rootProject.rootDir}/libs/koin-android") implementation fileTree(include: ['*.aar'], dir: "${rootProject.rootDir}/libs/koin-android") +// implementation "cash.z.ecc.android:kotlin-bip39:1.0.2" implementation fileTree(include: ['kotlin-bip39-1.0.2.jar'], dir: "${rootProject.rootDir}/libs") /** @@ -134,7 +138,7 @@ dependencies { // anything less than 'implementation' fails tests run with gradlew testImplementation rootProject.ext.aosp_libs - testImplementation 'androidx.test.ext:junit:1.1.2' + testImplementation 'androidx.test.ext:junit:1.1.3' testImplementation('org.robolectric:robolectric:4.3.1') { // 4.4 has issue with non-idle Looper // https://github.com/robolectric/robolectric/issues/5245 exclude group: "com.google.auto.service", module: "auto-service" @@ -146,9 +150,9 @@ dependencies { testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit5_version" testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$junit5_version" - androidTestImplementation 'androidx.test:runner:1.3.0' - androidTestImplementation 'androidx.test:rules:1.3.0' - androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test:runner:1.4.0' + androidTestImplementation 'androidx.test:rules:1.4.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation "io.mockk:mockk-android:$mockk_version" } @@ -163,30 +167,6 @@ gradle.projectsEvaluated { } } -// http://www.31mins.com/android-studio-build-system-application/ -preBuild.doLast { - def imlFile = file(project.name + ".iml") - - try { - def parsedXml = (new XmlParser()).parse(imlFile) - def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' } - parsedXml.component[1].remove(jdkNode) - - def apiString = android.compileSdkVersion.substring("android-".length()) - def sdkString = "Android API " + apiString + " Platform" - //noinspection GroovyResultOfObjectAllocationIgnored // the note gets inserted - new Node(parsedXml.component[1], 'orderEntry', [ - 'type' : 'jdk', - 'jdkName': sdkString, - 'jdkType': 'Android SDK' - ]) - XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile)) - - } catch (NullPointerException | FileNotFoundException ex) { - ex.printStackTrace() - } -} - configurations { all { resolutionStrategy { diff --git a/app/libs/android.jar b/app/libs/android.jar index 8e479c1f..48002e33 100644 Binary files a/app/libs/android.jar and b/app/libs/android.jar differ diff --git a/app/libs/libcore.jar b/app/libs/libcore.jar index c79b11f5..94d798d2 100644 Binary files a/app/libs/libcore.jar and b/app/libs/libcore.jar differ diff --git a/app/src/androidTest/java/com/stevesoltys/seedvault/PluginTest.kt b/app/src/androidTest/java/com/stevesoltys/seedvault/PluginTest.kt index 2045add9..688f01b3 100644 --- a/app/src/androidTest/java/com/stevesoltys/seedvault/PluginTest.kt +++ b/app/src/androidTest/java/com/stevesoltys/seedvault/PluginTest.kt @@ -23,8 +23,8 @@ import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -import org.koin.core.KoinComponent -import org.koin.core.inject +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject @RunWith(AndroidJUnit4::class) @Suppress("BlockingMethodInNonBlockingContext") diff --git a/app/src/androidTest/java/com/stevesoltys/seedvault/plugins/saf/DocumentsStorageTest.kt b/app/src/androidTest/java/com/stevesoltys/seedvault/plugins/saf/DocumentsStorageTest.kt index 8068aed4..d6bdf680 100644 --- a/app/src/androidTest/java/com/stevesoltys/seedvault/plugins/saf/DocumentsStorageTest.kt +++ b/app/src/androidTest/java/com/stevesoltys/seedvault/plugins/saf/DocumentsStorageTest.kt @@ -32,8 +32,8 @@ import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -import org.koin.core.KoinComponent -import org.koin.core.inject +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject import java.io.IOException import kotlin.random.Random diff --git a/app/src/androidTest/java/com/stevesoltys/seedvault/transport/backup/PackageServiceTest.kt b/app/src/androidTest/java/com/stevesoltys/seedvault/transport/backup/PackageServiceTest.kt index 4d5ecc21..64ea9c40 100644 --- a/app/src/androidTest/java/com/stevesoltys/seedvault/transport/backup/PackageServiceTest.kt +++ b/app/src/androidTest/java/com/stevesoltys/seedvault/transport/backup/PackageServiceTest.kt @@ -4,8 +4,8 @@ import android.util.Log import androidx.test.ext.junit.runners.AndroidJUnit4 import org.junit.Test import org.junit.runner.RunWith -import org.koin.core.KoinComponent -import org.koin.core.inject +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject @RunWith(AndroidJUnit4::class) class PackageServiceTest : KoinComponent { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7c330d90..79b2ea5b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -129,7 +129,8 @@ + android:name=".SecretCodeReceiver" + android:exported="true"> diff --git a/app/src/main/java/com/stevesoltys/seedvault/App.kt b/app/src/main/java/com/stevesoltys/seedvault/App.kt index 9ac333e7..b99e87b5 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/App.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/App.kt @@ -7,6 +7,7 @@ import android.content.Context.BACKUP_SERVICE import android.os.Build import android.os.ServiceManager.getService import android.os.StrictMode +import org.koin.core.logger.Level import com.stevesoltys.seedvault.crypto.cryptoModule import com.stevesoltys.seedvault.header.headerModule import com.stevesoltys.seedvault.metadata.MetadataManager @@ -77,7 +78,7 @@ open class App : Application() { } protected open fun startKoin() = startKoin { - androidLogger() + androidLogger(Level.ERROR) androidContext(this@App) modules( listOf( diff --git a/app/src/main/java/com/stevesoltys/seedvault/UsbIntentReceiver.kt b/app/src/main/java/com/stevesoltys/seedvault/UsbIntentReceiver.kt index 8f175a3f..4800fcef 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/UsbIntentReceiver.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/UsbIntentReceiver.kt @@ -22,7 +22,7 @@ import com.stevesoltys.seedvault.storage.StorageBackupService import com.stevesoltys.seedvault.storage.StorageBackupService.Companion.EXTRA_START_APP_BACKUP import com.stevesoltys.seedvault.transport.requestBackup import com.stevesoltys.seedvault.ui.storage.AUTHORITY_STORAGE -import org.koin.core.context.KoinContextHandler.get +import org.koin.core.context.GlobalContext.get import java.util.concurrent.TimeUnit.HOURS private val TAG = UsbIntentReceiver::class.java.simpleName @@ -32,8 +32,8 @@ private const val HOURS_AUTO_BACKUP: Long = 24 class UsbIntentReceiver : UsbMonitor() { // using KoinComponent would crash robolectric tests :( - private val settingsManager: SettingsManager by lazy { get().get() } - private val metadataManager: MetadataManager by lazy { get().get() } + private val settingsManager: SettingsManager by lazy { get().get() } + private val metadataManager: MetadataManager by lazy { get().get() } override fun shouldMonitorStatus(context: Context, action: String, device: UsbDevice): Boolean { if (action != ACTION_USB_DEVICE_ATTACHED) return false diff --git a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreErrorBroadcastReceiver.kt b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreErrorBroadcastReceiver.kt index d8e3ed38..b3ad72c4 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreErrorBroadcastReceiver.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreErrorBroadcastReceiver.kt @@ -6,7 +6,7 @@ import android.content.Intent import android.content.Intent.FLAG_ACTIVITY_NEW_TASK import androidx.core.net.toUri import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager -import org.koin.core.context.KoinContextHandler.get +import org.koin.core.context.GlobalContext.get internal const val ACTION_RESTORE_ERROR_UNINSTALL = "com.stevesoltys.seedvault.action.UNINSTALL" internal const val EXTRA_PACKAGE_NAME = "com.stevesoltys.seedvault.extra.PACKAGE_NAME" diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransport.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransport.kt index 35926664..c4b65399 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransport.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransport.kt @@ -14,8 +14,8 @@ import com.stevesoltys.seedvault.settings.SettingsActivity import com.stevesoltys.seedvault.transport.backup.BackupCoordinator import com.stevesoltys.seedvault.transport.restore.RestoreCoordinator import kotlinx.coroutines.runBlocking -import org.koin.core.KoinComponent -import org.koin.core.inject +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject // If we ever change this, we should use a ComponentName like the other backup transports. val TRANSPORT_ID: String = ConfigurableBackupTransport::class.java.name diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransportService.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransportService.kt index 143b47a2..69a3513f 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransportService.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/ConfigurableBackupTransportService.kt @@ -14,9 +14,9 @@ import com.stevesoltys.seedvault.crypto.KeyManager import com.stevesoltys.seedvault.transport.backup.PackageService import com.stevesoltys.seedvault.ui.notification.BackupNotificationManager import com.stevesoltys.seedvault.ui.notification.NotificationBackupObserver -import org.koin.core.KoinComponent -import org.koin.core.context.KoinContextHandler.get -import org.koin.core.inject +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject +import org.koin.core.context.GlobalContext.get private val TAG = ConfigurableBackupTransportService::class.java.simpleName diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/notification/NotificationBackupObserver.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/notification/NotificationBackupObserver.kt index ef5fa809..2fdc262b 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/notification/NotificationBackupObserver.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/notification/NotificationBackupObserver.kt @@ -11,8 +11,8 @@ import com.stevesoltys.seedvault.MAGIC_PACKAGE_MANAGER import com.stevesoltys.seedvault.R import com.stevesoltys.seedvault.metadata.MetadataManager import com.stevesoltys.seedvault.transport.backup.ExpectedAppTotals -import org.koin.core.KoinComponent -import org.koin.core.inject +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject private val TAG = NotificationBackupObserver::class.java.simpleName diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeInputFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeInputFragment.kt index 8cb7fd89..4aa09635 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeInputFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeInputFragment.kt @@ -166,6 +166,7 @@ class RecoveryCodeInputFragment : Fragment() { @RequiresApi(30) private fun storeNewCodeAfterAuth(input: List) { + val context = requireContext() val biometricPrompt = BiometricPrompt.Builder(context) .setConfirmationRequired(true) .setTitle(getString(R.string.recovery_code_auth_title)) diff --git a/app/src/main/res/layout/fragment_restore_files_started.xml b/app/src/main/res/layout/fragment_restore_files_started.xml index 8746717b..df39a4a3 100644 --- a/app/src/main/res/layout/fragment_restore_files_started.xml +++ b/app/src/main/res/layout/fragment_restore_files_started.xml @@ -10,11 +10,11 @@ android:layout_width="32dp" android:layout_height="32dp" android:layout_margin="16dp" - android:tint="?android:colorAccent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:srcCompat="@drawable/ic_cloud_restore" + app:tint="?android:colorAccent" tools:ignore="ContentDescription" /> - + diff --git a/storage/lib/Android.bp b/storage/lib/Android.bp index b5f86793..53927ddf 100644 --- a/storage/lib/Android.bp +++ b/storage/lib/Android.bp @@ -10,6 +10,6 @@ android_library_import { java_import { name: "seedvault-lib-tink-android", - jars: ["libs/tink-android-1.5.0.jar"], + jars: ["libs/tink-android-1.6.1.jar"], sdk_version: "current", } diff --git a/storage/lib/build.gradle b/storage/lib/build.gradle index 5702127f..1384e5d5 100644 --- a/storage/lib/build.gradle +++ b/storage/lib/build.gradle @@ -3,7 +3,7 @@ plugins { id 'com.google.protobuf' id 'kotlin-android' id 'kotlin-kapt' - id "org.jlleitschuh.gradle.ktlint" version "9.4.0" + id "org.jlleitschuh.gradle.ktlint" version "10.2.0" id 'org.jetbrains.dokka' version '1.4.20' } @@ -14,8 +14,6 @@ android { defaultConfig { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "0.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunnerArguments disableAnalytics: 'true' @@ -40,6 +38,7 @@ android { } kotlinOptions { jvmTarget = '1.8' + languageVersion = "1.4" freeCompilerArgs += '-Xopt-in=kotlin.RequiresOptIn' freeCompilerArgs += '-Xexplicit-api=strict' } @@ -57,6 +56,11 @@ android { } } } + lintOptions { + disable "DialogFragmentCallbacksDetector", + "InvalidFragmentVersionForActivityResult", + "CheckedExceptions" + } } kotlin { @@ -64,11 +68,12 @@ kotlin { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation rootProject.ext.kotlin_libs.std implementation rootProject.ext.std_libs.androidx_core // A newer version gets pulled in with AOSP via core, so we include fragment here explicitly implementation rootProject.ext.std_libs.androidx_fragment + implementation rootProject.ext.std_libs.androidx_activity implementation rootProject.ext.std_libs.androidx_lifecycle_viewmodel_ktx implementation rootProject.ext.std_libs.androidx_lifecycle_livedata_ktx implementation rootProject.ext.std_libs.androidx_constraintlayout @@ -88,7 +93,7 @@ dependencies { testImplementation "io.mockk:mockk:$mockk_version" testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" - androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version" } diff --git a/storage/lib/build/outputs/aar/lib-release.aar b/storage/lib/build/outputs/aar/lib-release.aar index 974a8e1c..942397d3 100644 Binary files a/storage/lib/build/outputs/aar/lib-release.aar and b/storage/lib/build/outputs/aar/lib-release.aar differ diff --git a/storage/lib/libs/tink-android-1.5.0.jar b/storage/lib/libs/tink-android-1.5.0.jar deleted file mode 100644 index 626846e1..00000000 Binary files a/storage/lib/libs/tink-android-1.5.0.jar and /dev/null differ diff --git a/storage/lib/libs/tink-android-1.6.1.jar b/storage/lib/libs/tink-android-1.6.1.jar new file mode 100644 index 00000000..4929a0c7 Binary files /dev/null and b/storage/lib/libs/tink-android-1.6.1.jar differ