diff --git a/app/src/main/java/com/stevesoltys/seedvault/BackupMonitor.kt b/app/src/main/java/com/stevesoltys/seedvault/BackupMonitor.kt index 0049fcef..8e961916 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/BackupMonitor.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/BackupMonitor.kt @@ -1,6 +1,8 @@ package com.stevesoltys.seedvault -import android.app.backup.BackupManagerMonitor.* +import android.app.backup.BackupManagerMonitor.EXTRA_LOG_EVENT_CATEGORY +import android.app.backup.BackupManagerMonitor.EXTRA_LOG_EVENT_ID +import android.app.backup.BackupManagerMonitor.EXTRA_LOG_EVENT_PACKAGE_NAME import android.app.backup.IBackupManagerMonitor import android.os.Bundle import android.util.Log diff --git a/app/src/main/java/com/stevesoltys/seedvault/BackupNotificationManager.kt b/app/src/main/java/com/stevesoltys/seedvault/BackupNotificationManager.kt index 561f44cb..d5cc7297 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/BackupNotificationManager.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/BackupNotificationManager.kt @@ -2,14 +2,20 @@ package com.stevesoltys.seedvault import android.app.NotificationChannel import android.app.NotificationManager -import android.app.NotificationManager.* +import android.app.NotificationManager.IMPORTANCE_DEFAULT +import android.app.NotificationManager.IMPORTANCE_HIGH +import android.app.NotificationManager.IMPORTANCE_LOW import android.app.PendingIntent import android.app.PendingIntent.FLAG_UPDATE_CURRENT import android.app.backup.BackupTransport.TRANSPORT_PACKAGE_REJECTED import android.content.Context import android.content.Intent import android.content.pm.PackageManager.NameNotFoundException -import androidx.core.app.NotificationCompat.* +import androidx.core.app.NotificationCompat.Action +import androidx.core.app.NotificationCompat.Builder +import androidx.core.app.NotificationCompat.PRIORITY_DEFAULT +import androidx.core.app.NotificationCompat.PRIORITY_HIGH +import androidx.core.app.NotificationCompat.PRIORITY_LOW import com.stevesoltys.seedvault.restore.ACTION_RESTORE_ERROR_UNINSTALL import com.stevesoltys.seedvault.restore.EXTRA_PACKAGE_NAME import com.stevesoltys.seedvault.restore.REQUEST_CODE_UNINSTALL diff --git a/app/src/main/java/com/stevesoltys/seedvault/UsbIntentReceiver.kt b/app/src/main/java/com/stevesoltys/seedvault/UsbIntentReceiver.kt index 8642a2e2..5cd5e940 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/UsbIntentReceiver.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/UsbIntentReceiver.kt @@ -6,7 +6,9 @@ import android.content.Intent import android.database.ContentObserver import android.hardware.usb.UsbDevice import android.hardware.usb.UsbInterface -import android.hardware.usb.UsbManager.* +import android.hardware.usb.UsbManager.ACTION_USB_DEVICE_ATTACHED +import android.hardware.usb.UsbManager.ACTION_USB_DEVICE_DETACHED +import android.hardware.usb.UsbManager.EXTRA_DEVICE import android.net.Uri import android.os.Handler import android.provider.DocumentsContract diff --git a/app/src/main/java/com/stevesoltys/seedvault/crypto/Crypto.kt b/app/src/main/java/com/stevesoltys/seedvault/crypto/Crypto.kt index 9494178d..7d2415af 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/crypto/Crypto.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/crypto/Crypto.kt @@ -1,6 +1,12 @@ package com.stevesoltys.seedvault.crypto -import com.stevesoltys.seedvault.header.* +import com.stevesoltys.seedvault.header.HeaderReader +import com.stevesoltys.seedvault.header.HeaderWriter +import com.stevesoltys.seedvault.header.MAX_SEGMENT_CLEARTEXT_LENGTH +import com.stevesoltys.seedvault.header.MAX_SEGMENT_LENGTH +import com.stevesoltys.seedvault.header.MAX_VERSION_HEADER_SIZE +import com.stevesoltys.seedvault.header.SegmentHeader +import com.stevesoltys.seedvault.header.VersionHeader import java.io.EOFException import java.io.IOException import java.io.InputStream diff --git a/app/src/main/java/com/stevesoltys/seedvault/crypto/KeyManager.kt b/app/src/main/java/com/stevesoltys/seedvault/crypto/KeyManager.kt index 157c7e65..9785857e 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/crypto/KeyManager.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/crypto/KeyManager.kt @@ -1,7 +1,10 @@ package com.stevesoltys.seedvault.crypto import android.os.Build.VERSION.SDK_INT -import android.security.keystore.KeyProperties.* +import android.security.keystore.KeyProperties.BLOCK_MODE_GCM +import android.security.keystore.KeyProperties.ENCRYPTION_PADDING_NONE +import android.security.keystore.KeyProperties.PURPOSE_DECRYPT +import android.security.keystore.KeyProperties.PURPOSE_ENCRYPT import android.security.keystore.KeyProtection import java.security.KeyStore import java.security.KeyStore.SecretKeyEntry diff --git a/app/src/main/java/com/stevesoltys/seedvault/metadata/MetadataReader.kt b/app/src/main/java/com/stevesoltys/seedvault/metadata/MetadataReader.kt index 9ee4f0b0..7fd90a04 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/metadata/MetadataReader.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/metadata/MetadataReader.kt @@ -4,7 +4,11 @@ import com.stevesoltys.seedvault.Utf8 import com.stevesoltys.seedvault.crypto.Crypto import com.stevesoltys.seedvault.header.UnsupportedVersionException import com.stevesoltys.seedvault.header.VERSION -import com.stevesoltys.seedvault.metadata.PackageState.* +import com.stevesoltys.seedvault.metadata.PackageState.APK_AND_DATA +import com.stevesoltys.seedvault.metadata.PackageState.NOT_ALLOWED +import com.stevesoltys.seedvault.metadata.PackageState.NO_DATA +import com.stevesoltys.seedvault.metadata.PackageState.QUOTA_EXCEEDED +import com.stevesoltys.seedvault.metadata.PackageState.UNKNOWN_ERROR import org.json.JSONException import org.json.JSONObject import java.io.IOException diff --git a/app/src/main/java/com/stevesoltys/seedvault/plugins/saf/DocumentsStorage.kt b/app/src/main/java/com/stevesoltys/seedvault/plugins/saf/DocumentsStorage.kt index 28c83435..ff91fa9d 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/plugins/saf/DocumentsStorage.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/plugins/saf/DocumentsStorage.kt @@ -5,8 +5,14 @@ import android.content.Context import android.content.pm.PackageInfo import android.database.ContentObserver import android.net.Uri -import android.provider.DocumentsContract.* -import android.provider.DocumentsContract.Document.* +import android.provider.DocumentsContract.Document.COLUMN_DOCUMENT_ID +import android.provider.DocumentsContract.Document.COLUMN_MIME_TYPE +import android.provider.DocumentsContract.Document.MIME_TYPE_DIR +import android.provider.DocumentsContract.EXTRA_LOADING +import android.provider.DocumentsContract.buildChildDocumentsUriUsingTree +import android.provider.DocumentsContract.buildDocumentUriUsingTree +import android.provider.DocumentsContract.buildTreeDocumentUri +import android.provider.DocumentsContract.getDocumentId import android.util.Log import androidx.documentfile.provider.DocumentFile import com.stevesoltys.seedvault.metadata.MetadataManager diff --git a/app/src/main/java/com/stevesoltys/seedvault/restore/InstallProgressAdapter.kt b/app/src/main/java/com/stevesoltys/seedvault/restore/InstallProgressAdapter.kt index 3e4b6c45..0b576fb7 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/restore/InstallProgressAdapter.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/restore/InstallProgressAdapter.kt @@ -14,7 +14,10 @@ import androidx.recyclerview.widget.SortedList import androidx.recyclerview.widget.SortedListAdapterCallback import com.stevesoltys.seedvault.R import com.stevesoltys.seedvault.transport.restore.ApkRestoreResult -import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.* +import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.FAILED +import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.IN_PROGRESS +import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.QUEUED +import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.SUCCEEDED internal class InstallProgressAdapter : Adapter() { diff --git a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreProgressAdapter.kt b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreProgressAdapter.kt index c1a1d575..6e8e0711 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreProgressAdapter.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreProgressAdapter.kt @@ -3,7 +3,9 @@ package com.stevesoltys.seedvault.restore import android.content.pm.PackageManager.NameNotFoundException import android.view.LayoutInflater import android.view.View -import android.view.View.* +import android.view.View.GONE +import android.view.View.INVISIBLE +import android.view.View.VISIBLE import android.view.ViewGroup import android.widget.ImageView import android.widget.ProgressBar @@ -13,7 +15,13 @@ import androidx.recyclerview.widget.RecyclerView.Adapter import androidx.recyclerview.widget.RecyclerView.ViewHolder import com.stevesoltys.seedvault.MAGIC_PACKAGE_MANAGER import com.stevesoltys.seedvault.R -import com.stevesoltys.seedvault.restore.AppRestoreStatus.* +import com.stevesoltys.seedvault.restore.AppRestoreStatus.FAILED +import com.stevesoltys.seedvault.restore.AppRestoreStatus.FAILED_NOT_ALLOWED +import com.stevesoltys.seedvault.restore.AppRestoreStatus.FAILED_NOT_INSTALLED +import com.stevesoltys.seedvault.restore.AppRestoreStatus.FAILED_NO_DATA +import com.stevesoltys.seedvault.restore.AppRestoreStatus.FAILED_QUOTA_EXCEEDED +import com.stevesoltys.seedvault.restore.AppRestoreStatus.IN_PROGRESS +import com.stevesoltys.seedvault.restore.AppRestoreStatus.SUCCEEDED import com.stevesoltys.seedvault.restore.RestoreProgressAdapter.PackageViewHolder import java.util.* diff --git a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreSetAdapter.kt b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreSetAdapter.kt index f31ab1e1..8acb0eef 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreSetAdapter.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreSetAdapter.kt @@ -1,6 +1,8 @@ package com.stevesoltys.seedvault.restore -import android.text.format.DateUtils.* +import android.text.format.DateUtils.FORMAT_ABBREV_RELATIVE +import android.text.format.DateUtils.HOUR_IN_MILLIS +import android.text.format.DateUtils.getRelativeTimeSpanString import android.view.LayoutInflater import android.view.View import android.view.ViewGroup diff --git a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreViewModel.kt b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreViewModel.kt index 0dffd8fd..fbc414ca 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreViewModel.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/restore/RestoreViewModel.kt @@ -20,8 +20,18 @@ import com.stevesoltys.seedvault.MAGIC_PACKAGE_MANAGER import com.stevesoltys.seedvault.R import com.stevesoltys.seedvault.crypto.KeyManager import com.stevesoltys.seedvault.getAppName -import com.stevesoltys.seedvault.metadata.PackageState.* -import com.stevesoltys.seedvault.restore.AppRestoreStatus.* +import com.stevesoltys.seedvault.metadata.PackageState.APK_AND_DATA +import com.stevesoltys.seedvault.metadata.PackageState.NOT_ALLOWED +import com.stevesoltys.seedvault.metadata.PackageState.NO_DATA +import com.stevesoltys.seedvault.metadata.PackageState.QUOTA_EXCEEDED +import com.stevesoltys.seedvault.metadata.PackageState.UNKNOWN_ERROR +import com.stevesoltys.seedvault.restore.AppRestoreStatus.FAILED +import com.stevesoltys.seedvault.restore.AppRestoreStatus.FAILED_NOT_ALLOWED +import com.stevesoltys.seedvault.restore.AppRestoreStatus.FAILED_NOT_INSTALLED +import com.stevesoltys.seedvault.restore.AppRestoreStatus.FAILED_NO_DATA +import com.stevesoltys.seedvault.restore.AppRestoreStatus.FAILED_QUOTA_EXCEEDED +import com.stevesoltys.seedvault.restore.AppRestoreStatus.IN_PROGRESS +import com.stevesoltys.seedvault.restore.AppRestoreStatus.SUCCEEDED import com.stevesoltys.seedvault.restore.DisplayFragment.RESTORE_APPS import com.stevesoltys.seedvault.restore.DisplayFragment.RESTORE_BACKUP import com.stevesoltys.seedvault.settings.SettingsManager diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/backup/ApkBackup.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/backup/ApkBackup.kt index f5711f49..4ab5f396 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/backup/ApkBackup.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/backup/ApkBackup.kt @@ -8,7 +8,11 @@ import android.util.Log import android.util.PackageUtils.computeSha256DigestBytes import com.stevesoltys.seedvault.MAGIC_PACKAGE_MANAGER import com.stevesoltys.seedvault.encodeBase64 -import com.stevesoltys.seedvault.metadata.* +import com.stevesoltys.seedvault.metadata.MetadataManager +import com.stevesoltys.seedvault.metadata.PackageMetadata +import com.stevesoltys.seedvault.metadata.PackageState +import com.stevesoltys.seedvault.metadata.isSystemApp +import com.stevesoltys.seedvault.metadata.isUpdatedSystemApp import com.stevesoltys.seedvault.settings.SettingsManager import java.io.File import java.io.FileNotFoundException diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/backup/BackupCoordinator.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/backup/BackupCoordinator.kt index 12f1ee11..03f5f3d5 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/backup/BackupCoordinator.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/backup/BackupCoordinator.kt @@ -1,6 +1,9 @@ package com.stevesoltys.seedvault.transport.backup -import android.app.backup.BackupTransport.* +import android.app.backup.BackupTransport.TRANSPORT_ERROR +import android.app.backup.BackupTransport.TRANSPORT_OK +import android.app.backup.BackupTransport.TRANSPORT_PACKAGE_REJECTED +import android.app.backup.BackupTransport.TRANSPORT_QUOTA_EXCEEDED import android.content.Context import android.content.pm.PackageInfo import android.os.ParcelFileDescriptor @@ -10,7 +13,10 @@ import com.stevesoltys.seedvault.Clock import com.stevesoltys.seedvault.MAGIC_PACKAGE_MANAGER import com.stevesoltys.seedvault.metadata.MetadataManager import com.stevesoltys.seedvault.metadata.PackageState -import com.stevesoltys.seedvault.metadata.PackageState.* +import com.stevesoltys.seedvault.metadata.PackageState.NOT_ALLOWED +import com.stevesoltys.seedvault.metadata.PackageState.NO_DATA +import com.stevesoltys.seedvault.metadata.PackageState.QUOTA_EXCEEDED +import com.stevesoltys.seedvault.metadata.PackageState.UNKNOWN_ERROR import com.stevesoltys.seedvault.metadata.isSystemApp import com.stevesoltys.seedvault.settings.SettingsManager import java.io.IOException diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/backup/FullBackup.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/backup/FullBackup.kt index 198e7bb5..0782bcbe 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/backup/FullBackup.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/backup/FullBackup.kt @@ -1,6 +1,10 @@ package com.stevesoltys.seedvault.transport.backup -import android.app.backup.BackupTransport.* +import android.app.backup.BackupTransport.FLAG_USER_INITIATED +import android.app.backup.BackupTransport.TRANSPORT_ERROR +import android.app.backup.BackupTransport.TRANSPORT_OK +import android.app.backup.BackupTransport.TRANSPORT_PACKAGE_REJECTED +import android.app.backup.BackupTransport.TRANSPORT_QUOTA_EXCEEDED import android.content.pm.PackageInfo import android.os.ParcelFileDescriptor import android.util.Log diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/backup/KVBackup.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/backup/KVBackup.kt index fc43701f..8c1dceff 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/backup/KVBackup.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/backup/KVBackup.kt @@ -1,6 +1,10 @@ package com.stevesoltys.seedvault.transport.backup -import android.app.backup.BackupTransport.* +import android.app.backup.BackupTransport.FLAG_INCREMENTAL +import android.app.backup.BackupTransport.FLAG_NON_INCREMENTAL +import android.app.backup.BackupTransport.TRANSPORT_ERROR +import android.app.backup.BackupTransport.TRANSPORT_NON_INCREMENTAL_BACKUP_REQUIRED +import android.app.backup.BackupTransport.TRANSPORT_OK import android.content.pm.PackageInfo import android.os.ParcelFileDescriptor import android.util.Log diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/restore/ApkInstaller.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/restore/ApkInstaller.kt index b32e13b5..cd8662c2 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/restore/ApkInstaller.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/restore/ApkInstaller.kt @@ -2,10 +2,18 @@ package com.stevesoltys.seedvault.transport.restore import android.app.PendingIntent import android.app.PendingIntent.FLAG_UPDATE_CURRENT -import android.content.* +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent import android.content.Intent.FLAG_RECEIVER_FOREGROUND +import android.content.IntentFilter +import android.content.IntentSender import android.content.pm.PackageInstaller -import android.content.pm.PackageInstaller.* +import android.content.pm.PackageInstaller.EXTRA_PACKAGE_NAME +import android.content.pm.PackageInstaller.EXTRA_STATUS +import android.content.pm.PackageInstaller.EXTRA_STATUS_MESSAGE +import android.content.pm.PackageInstaller.STATUS_SUCCESS +import android.content.pm.PackageInstaller.SessionParams import android.content.pm.PackageInstaller.SessionParams.MODE_FULL_INSTALL import android.content.pm.PackageManager import android.util.Log diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/restore/ApkRestore.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/restore/ApkRestore.kt index bf090c70..8a1ff785 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/restore/ApkRestore.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/restore/ApkRestore.kt @@ -1,7 +1,9 @@ package com.stevesoltys.seedvault.transport.restore import android.content.Context -import android.content.pm.PackageManager.* +import android.content.pm.PackageManager.GET_SIGNATURES +import android.content.pm.PackageManager.GET_SIGNING_CERTIFICATES +import android.content.pm.PackageManager.NameNotFoundException import android.graphics.drawable.Drawable import android.util.Log import com.stevesoltys.seedvault.encodeBase64 @@ -9,7 +11,9 @@ import com.stevesoltys.seedvault.metadata.PackageMetadata import com.stevesoltys.seedvault.metadata.PackageMetadataMap import com.stevesoltys.seedvault.metadata.isSystemApp import com.stevesoltys.seedvault.transport.backup.getSignatures -import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.* +import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.FAILED +import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.IN_PROGRESS +import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.QUEUED import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.TimeoutCancellationException import kotlinx.coroutines.flow.collect diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/restore/FullRestore.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/restore/FullRestore.kt index 3cc7fc6c..a233a490 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/restore/FullRestore.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/restore/FullRestore.kt @@ -1,6 +1,9 @@ package com.stevesoltys.seedvault.transport.restore -import android.app.backup.BackupTransport.* +import android.app.backup.BackupTransport.NO_MORE_DATA +import android.app.backup.BackupTransport.TRANSPORT_ERROR +import android.app.backup.BackupTransport.TRANSPORT_OK +import android.app.backup.BackupTransport.TRANSPORT_PACKAGE_REJECTED import android.content.pm.PackageInfo import android.os.ParcelFileDescriptor import android.util.Log diff --git a/app/src/main/java/com/stevesoltys/seedvault/transport/restore/RestoreCoordinator.kt b/app/src/main/java/com/stevesoltys/seedvault/transport/restore/RestoreCoordinator.kt index 29cbebf8..a13a6822 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/transport/restore/RestoreCoordinator.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/transport/restore/RestoreCoordinator.kt @@ -4,7 +4,9 @@ import android.app.backup.BackupTransport.TRANSPORT_ERROR import android.app.backup.BackupTransport.TRANSPORT_OK import android.app.backup.IBackupManager import android.app.backup.RestoreDescription -import android.app.backup.RestoreDescription.* +import android.app.backup.RestoreDescription.NO_MORE_PACKAGES +import android.app.backup.RestoreDescription.TYPE_FULL_STREAM +import android.app.backup.RestoreDescription.TYPE_KEY_VALUE import android.app.backup.RestoreSet import android.content.Context import android.content.pm.PackageInfo diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeViewModel.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeViewModel.kt index 146dbab3..aa27f64e 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeViewModel.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/recoverycode/RecoveryCodeViewModel.kt @@ -5,11 +5,15 @@ import com.stevesoltys.seedvault.App import com.stevesoltys.seedvault.crypto.KeyManager import com.stevesoltys.seedvault.ui.LiveEvent import com.stevesoltys.seedvault.ui.MutableLiveEvent -import io.github.novacrypto.bip39.* +import io.github.novacrypto.bip39.JavaxPBKDF2WithHmacSHA512 +import io.github.novacrypto.bip39.MnemonicGenerator +import io.github.novacrypto.bip39.MnemonicValidator +import io.github.novacrypto.bip39.SeedCalculator import io.github.novacrypto.bip39.Validation.InvalidChecksumException import io.github.novacrypto.bip39.Validation.InvalidWordCountException import io.github.novacrypto.bip39.Validation.UnexpectedWhiteSpaceException import io.github.novacrypto.bip39.Validation.WordNotFoundException +import io.github.novacrypto.bip39.Words import io.github.novacrypto.bip39.wordlists.English import java.security.SecureRandom import java.util.* diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootFetcher.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootFetcher.kt index 6617f4cf..ef6431b2 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootFetcher.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootFetcher.kt @@ -14,7 +14,16 @@ import android.net.Uri import android.os.Handler import android.provider.DocumentsContract import android.provider.DocumentsContract.PROVIDER_INTERFACE -import android.provider.DocumentsContract.Root.* +import android.provider.DocumentsContract.Root.COLUMN_AVAILABLE_BYTES +import android.provider.DocumentsContract.Root.COLUMN_DOCUMENT_ID +import android.provider.DocumentsContract.Root.COLUMN_FLAGS +import android.provider.DocumentsContract.Root.COLUMN_ICON +import android.provider.DocumentsContract.Root.COLUMN_ROOT_ID +import android.provider.DocumentsContract.Root.COLUMN_SUMMARY +import android.provider.DocumentsContract.Root.COLUMN_TITLE +import android.provider.DocumentsContract.Root.FLAG_REMOVABLE_USB +import android.provider.DocumentsContract.Root.FLAG_SUPPORTS_CREATE +import android.provider.DocumentsContract.Root.FLAG_SUPPORTS_IS_CHILD import android.util.Log import com.stevesoltys.seedvault.R import java.lang.Long.parseLong diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootsFragment.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootsFragment.kt index 299df5a3..a7de2dcd 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootsFragment.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootsFragment.kt @@ -1,7 +1,9 @@ package com.stevesoltys.seedvault.ui.storage import android.content.Intent -import android.content.Intent.* +import android.content.Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION +import android.content.Intent.FLAG_GRANT_READ_URI_PERMISSION +import android.content.Intent.FLAG_GRANT_WRITE_URI_PERMISSION import android.os.Bundle import android.view.LayoutInflater import android.view.View diff --git a/app/src/test/java/com/stevesoltys/seedvault/crypto/CryptoTest.kt b/app/src/test/java/com/stevesoltys/seedvault/crypto/CryptoTest.kt index 2b27d675..cf25f040 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/crypto/CryptoTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/crypto/CryptoTest.kt @@ -3,13 +3,33 @@ package com.stevesoltys.seedvault.crypto import com.stevesoltys.seedvault.assertContains import com.stevesoltys.seedvault.getRandomByteArray import com.stevesoltys.seedvault.getRandomString -import com.stevesoltys.seedvault.header.* -import io.mockk.* -import org.junit.jupiter.api.Assertions.* +import com.stevesoltys.seedvault.header.HeaderReader +import com.stevesoltys.seedvault.header.HeaderWriter +import com.stevesoltys.seedvault.header.IV_SIZE +import com.stevesoltys.seedvault.header.MAX_KEY_LENGTH_SIZE +import com.stevesoltys.seedvault.header.MAX_PACKAGE_LENGTH_SIZE +import com.stevesoltys.seedvault.header.MAX_SEGMENT_LENGTH +import com.stevesoltys.seedvault.header.MAX_VERSION_HEADER_SIZE +import com.stevesoltys.seedvault.header.SegmentHeader +import com.stevesoltys.seedvault.header.VERSION +import com.stevesoltys.seedvault.header.VersionHeader +import io.mockk.CapturingSlot +import io.mockk.Runs +import io.mockk.every +import io.mockk.just +import io.mockk.mockk +import org.junit.jupiter.api.Assertions.assertArrayEquals +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertThrows +import org.junit.jupiter.api.Assertions.fail import org.junit.jupiter.api.Test import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance.Lifecycle.PER_METHOD -import java.io.* +import java.io.ByteArrayInputStream +import java.io.ByteArrayOutputStream +import java.io.EOFException +import java.io.IOException +import java.io.InputStream import javax.crypto.Cipher import kotlin.random.Random diff --git a/app/src/test/java/com/stevesoltys/seedvault/header/HeaderReaderTest.kt b/app/src/test/java/com/stevesoltys/seedvault/header/HeaderReaderTest.kt index 6c06e0f3..ab83b885 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/header/HeaderReaderTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/header/HeaderReaderTest.kt @@ -3,7 +3,9 @@ package com.stevesoltys.seedvault.header import com.stevesoltys.seedvault.Utf8 import com.stevesoltys.seedvault.assertContains import com.stevesoltys.seedvault.getRandomString -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertArrayEquals +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS diff --git a/app/src/test/java/com/stevesoltys/seedvault/header/HeaderWriterReaderTest.kt b/app/src/test/java/com/stevesoltys/seedvault/header/HeaderWriterReaderTest.kt index b47dfc66..03b4cd26 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/header/HeaderWriterReaderTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/header/HeaderWriterReaderTest.kt @@ -2,7 +2,9 @@ package com.stevesoltys.seedvault.header import com.stevesoltys.seedvault.getRandomByteArray import com.stevesoltys.seedvault.getRandomString -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertArrayEquals +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS diff --git a/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataManagerTest.kt b/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataManagerTest.kt index c1595818..694cc2bb 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataManagerTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataManagerTest.kt @@ -10,7 +10,11 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import com.stevesoltys.seedvault.Clock import com.stevesoltys.seedvault.getRandomByteArray import com.stevesoltys.seedvault.getRandomString -import com.stevesoltys.seedvault.metadata.PackageState.* +import com.stevesoltys.seedvault.metadata.PackageState.APK_AND_DATA +import com.stevesoltys.seedvault.metadata.PackageState.NOT_ALLOWED +import com.stevesoltys.seedvault.metadata.PackageState.NO_DATA +import com.stevesoltys.seedvault.metadata.PackageState.QUOTA_EXCEEDED +import com.stevesoltys.seedvault.metadata.PackageState.UNKNOWN_ERROR import io.mockk.Runs import io.mockk.every import io.mockk.just @@ -21,7 +25,11 @@ import org.junit.Assert.fail import org.junit.Test import org.junit.runner.RunWith import org.koin.core.context.stopKoin -import java.io.* +import java.io.ByteArrayOutputStream +import java.io.FileInputStream +import java.io.FileNotFoundException +import java.io.FileOutputStream +import java.io.IOException import kotlin.random.Random @RunWith(AndroidJUnit4::class) diff --git a/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataReaderTest.kt b/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataReaderTest.kt index b12aa2d8..6dba62f6 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataReaderTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataReaderTest.kt @@ -8,7 +8,11 @@ import com.stevesoltys.seedvault.metadata.PackageState.UNKNOWN_ERROR import io.mockk.mockk import org.json.JSONArray import org.json.JSONObject -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertNull +import org.junit.jupiter.api.Assertions.assertThrows +import org.junit.jupiter.api.Assertions.fail import org.junit.jupiter.api.Test import org.junit.jupiter.api.TestInstance import org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS diff --git a/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataWriterDecoderTest.kt b/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataWriterDecoderTest.kt index 6778e8c9..adaa8e96 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataWriterDecoderTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/metadata/MetadataWriterDecoderTest.kt @@ -2,7 +2,10 @@ package com.stevesoltys.seedvault.metadata import com.stevesoltys.seedvault.crypto.Crypto import com.stevesoltys.seedvault.getRandomString -import com.stevesoltys.seedvault.metadata.PackageState.* +import com.stevesoltys.seedvault.metadata.PackageState.APK_AND_DATA +import com.stevesoltys.seedvault.metadata.PackageState.NOT_ALLOWED +import com.stevesoltys.seedvault.metadata.PackageState.NO_DATA +import com.stevesoltys.seedvault.metadata.PackageState.QUOTA_EXCEEDED import io.mockk.mockk import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test diff --git a/app/src/test/java/com/stevesoltys/seedvault/transport/CoordinatorIntegrationTest.kt b/app/src/test/java/com/stevesoltys/seedvault/transport/CoordinatorIntegrationTest.kt index 112ae974..577dbd76 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/transport/CoordinatorIntegrationTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/transport/CoordinatorIntegrationTest.kt @@ -18,10 +18,31 @@ import com.stevesoltys.seedvault.header.MAX_SEGMENT_CLEARTEXT_LENGTH import com.stevesoltys.seedvault.metadata.MetadataReaderImpl import com.stevesoltys.seedvault.metadata.PackageMetadata import com.stevesoltys.seedvault.metadata.PackageState.UNKNOWN_ERROR -import com.stevesoltys.seedvault.transport.backup.* -import com.stevesoltys.seedvault.transport.restore.* -import io.mockk.* -import org.junit.jupiter.api.Assertions.* +import com.stevesoltys.seedvault.transport.backup.ApkBackup +import com.stevesoltys.seedvault.transport.backup.BackupCoordinator +import com.stevesoltys.seedvault.transport.backup.BackupPlugin +import com.stevesoltys.seedvault.transport.backup.DEFAULT_QUOTA_FULL_BACKUP +import com.stevesoltys.seedvault.transport.backup.FullBackup +import com.stevesoltys.seedvault.transport.backup.FullBackupPlugin +import com.stevesoltys.seedvault.transport.backup.InputFactory +import com.stevesoltys.seedvault.transport.backup.KVBackup +import com.stevesoltys.seedvault.transport.backup.KVBackupPlugin +import com.stevesoltys.seedvault.transport.backup.PackageService +import com.stevesoltys.seedvault.transport.restore.FullRestore +import com.stevesoltys.seedvault.transport.restore.FullRestorePlugin +import com.stevesoltys.seedvault.transport.restore.KVRestore +import com.stevesoltys.seedvault.transport.restore.KVRestorePlugin +import com.stevesoltys.seedvault.transport.restore.OutputFactory +import com.stevesoltys.seedvault.transport.restore.RestoreCoordinator +import com.stevesoltys.seedvault.transport.restore.RestorePlugin +import io.mockk.CapturingSlot +import io.mockk.Runs +import io.mockk.every +import io.mockk.just +import io.mockk.mockk +import org.junit.jupiter.api.Assertions.assertArrayEquals +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.fail import org.junit.jupiter.api.Test import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream diff --git a/app/src/test/java/com/stevesoltys/seedvault/transport/backup/ApkBackupTest.kt b/app/src/test/java/com/stevesoltys/seedvault/transport/backup/ApkBackupTest.kt index dc99353a..7a4168de 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/transport/backup/ApkBackupTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/transport/backup/ApkBackupTest.kt @@ -10,8 +10,16 @@ import com.stevesoltys.seedvault.MAGIC_PACKAGE_MANAGER import com.stevesoltys.seedvault.getRandomString import com.stevesoltys.seedvault.metadata.PackageMetadata import com.stevesoltys.seedvault.metadata.PackageState.UNKNOWN_ERROR -import io.mockk.* -import org.junit.jupiter.api.Assertions.* +import io.mockk.Runs +import io.mockk.every +import io.mockk.just +import io.mockk.mockk +import io.mockk.mockkStatic +import org.junit.jupiter.api.Assertions.assertArrayEquals +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertNull +import org.junit.jupiter.api.Assertions.assertThrows +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import org.junit.jupiter.api.io.TempDir import java.io.ByteArrayOutputStream diff --git a/app/src/test/java/com/stevesoltys/seedvault/transport/backup/BackupCoordinatorTest.kt b/app/src/test/java/com/stevesoltys/seedvault/transport/backup/BackupCoordinatorTest.kt index 96524896..2bb51378 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/transport/backup/BackupCoordinatorTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/transport/backup/BackupCoordinatorTest.kt @@ -1,6 +1,9 @@ package com.stevesoltys.seedvault.transport.backup -import android.app.backup.BackupTransport.* +import android.app.backup.BackupTransport.TRANSPORT_ERROR +import android.app.backup.BackupTransport.TRANSPORT_OK +import android.app.backup.BackupTransport.TRANSPORT_PACKAGE_REJECTED +import android.app.backup.BackupTransport.TRANSPORT_QUOTA_EXCEEDED import android.content.pm.PackageInfo import android.net.Uri import android.os.ParcelFileDescriptor @@ -9,9 +12,16 @@ import com.stevesoltys.seedvault.BackupNotificationManager import com.stevesoltys.seedvault.MAGIC_PACKAGE_MANAGER import com.stevesoltys.seedvault.getRandomString import com.stevesoltys.seedvault.metadata.PackageMetadata -import com.stevesoltys.seedvault.metadata.PackageState.* +import com.stevesoltys.seedvault.metadata.PackageState.NOT_ALLOWED +import com.stevesoltys.seedvault.metadata.PackageState.NO_DATA +import com.stevesoltys.seedvault.metadata.PackageState.QUOTA_EXCEEDED +import com.stevesoltys.seedvault.metadata.PackageState.UNKNOWN_ERROR import com.stevesoltys.seedvault.settings.Storage -import io.mockk.* +import io.mockk.Runs +import io.mockk.every +import io.mockk.just +import io.mockk.mockk +import io.mockk.verify import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test diff --git a/app/src/test/java/com/stevesoltys/seedvault/transport/backup/FullBackupTest.kt b/app/src/test/java/com/stevesoltys/seedvault/transport/backup/FullBackupTest.kt index 80cf7f51..91f3d1aa 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/transport/backup/FullBackupTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/transport/backup/FullBackupTest.kt @@ -1,11 +1,16 @@ package com.stevesoltys.seedvault.transport.backup -import android.app.backup.BackupTransport.* +import android.app.backup.BackupTransport.TRANSPORT_ERROR +import android.app.backup.BackupTransport.TRANSPORT_OK +import android.app.backup.BackupTransport.TRANSPORT_PACKAGE_REJECTED +import android.app.backup.BackupTransport.TRANSPORT_QUOTA_EXCEEDED import io.mockk.Runs import io.mockk.every import io.mockk.just import io.mockk.mockk -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import java.io.FileInputStream import java.io.IOException diff --git a/app/src/test/java/com/stevesoltys/seedvault/transport/backup/KVBackupTest.kt b/app/src/test/java/com/stevesoltys/seedvault/transport/backup/KVBackupTest.kt index 69775e67..66956d92 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/transport/backup/KVBackupTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/transport/backup/KVBackupTest.kt @@ -1,7 +1,11 @@ package com.stevesoltys.seedvault.transport.backup import android.app.backup.BackupDataInput -import android.app.backup.BackupTransport.* +import android.app.backup.BackupTransport.FLAG_INCREMENTAL +import android.app.backup.BackupTransport.FLAG_NON_INCREMENTAL +import android.app.backup.BackupTransport.TRANSPORT_ERROR +import android.app.backup.BackupTransport.TRANSPORT_NON_INCREMENTAL_BACKUP_REQUIRED +import android.app.backup.BackupTransport.TRANSPORT_OK import com.stevesoltys.seedvault.Utf8 import com.stevesoltys.seedvault.getRandomString import com.stevesoltys.seedvault.header.MAX_KEY_LENGTH_SIZE @@ -10,7 +14,9 @@ import io.mockk.Runs import io.mockk.every import io.mockk.just import io.mockk.mockk -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import java.io.IOException import java.util.* diff --git a/app/src/test/java/com/stevesoltys/seedvault/transport/restore/ApkRestoreTest.kt b/app/src/test/java/com/stevesoltys/seedvault/transport/restore/ApkRestoreTest.kt index d5c3c81f..c8a823ab 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/transport/restore/ApkRestoreTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/transport/restore/ApkRestoreTest.kt @@ -2,14 +2,19 @@ package com.stevesoltys.seedvault.transport.restore import android.content.Context import android.content.pm.ApplicationInfo -import android.content.pm.ApplicationInfo.* +import android.content.pm.ApplicationInfo.FLAG_INSTALLED +import android.content.pm.ApplicationInfo.FLAG_SYSTEM +import android.content.pm.ApplicationInfo.FLAG_UPDATED_SYSTEM_APP import android.content.pm.PackageInfo import android.content.pm.PackageManager import android.graphics.drawable.Drawable import com.stevesoltys.seedvault.getRandomString import com.stevesoltys.seedvault.metadata.PackageMetadata import com.stevesoltys.seedvault.metadata.PackageMetadataMap -import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.* +import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.FAILED +import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.IN_PROGRESS +import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.QUEUED +import com.stevesoltys.seedvault.transport.restore.ApkRestoreStatus.SUCCEEDED import io.mockk.every import io.mockk.mockk import kotlinx.coroutines.ExperimentalCoroutinesApi @@ -24,7 +29,6 @@ import org.junit.jupiter.api.io.TempDir import java.io.ByteArrayInputStream import java.io.File import java.nio.file.Path -import java.util.logging.Logger.getLogger import kotlin.random.Random @ExperimentalCoroutinesApi diff --git a/app/src/test/java/com/stevesoltys/seedvault/transport/restore/FullRestoreTest.kt b/app/src/test/java/com/stevesoltys/seedvault/transport/restore/FullRestoreTest.kt index 65f62727..46f5532e 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/transport/restore/FullRestoreTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/transport/restore/FullRestoreTest.kt @@ -1,6 +1,9 @@ package com.stevesoltys.seedvault.transport.restore -import android.app.backup.BackupTransport.* +import android.app.backup.BackupTransport.NO_MORE_DATA +import android.app.backup.BackupTransport.TRANSPORT_ERROR +import android.app.backup.BackupTransport.TRANSPORT_OK +import android.app.backup.BackupTransport.TRANSPORT_PACKAGE_REJECTED import com.stevesoltys.seedvault.getRandomByteArray import com.stevesoltys.seedvault.header.UnsupportedVersionException import com.stevesoltys.seedvault.header.VERSION @@ -9,7 +12,11 @@ import io.mockk.Runs import io.mockk.every import io.mockk.just import io.mockk.mockk -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertArrayEquals +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertFalse +import org.junit.jupiter.api.Assertions.assertThrows +import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import java.io.ByteArrayOutputStream import java.io.EOFException diff --git a/app/src/test/java/com/stevesoltys/seedvault/transport/restore/KVRestoreTest.kt b/app/src/test/java/com/stevesoltys/seedvault/transport/restore/KVRestoreTest.kt index 304f471f..db0c29a3 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/transport/restore/KVRestoreTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/transport/restore/KVRestoreTest.kt @@ -8,7 +8,11 @@ import com.stevesoltys.seedvault.getRandomByteArray import com.stevesoltys.seedvault.header.UnsupportedVersionException import com.stevesoltys.seedvault.header.VERSION import com.stevesoltys.seedvault.header.VersionHeader -import io.mockk.* +import io.mockk.Runs +import io.mockk.every +import io.mockk.just +import io.mockk.mockk +import io.mockk.verifyAll import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertThrows import org.junit.jupiter.api.Test diff --git a/app/src/test/java/com/stevesoltys/seedvault/transport/restore/RestoreCoordinatorTest.kt b/app/src/test/java/com/stevesoltys/seedvault/transport/restore/RestoreCoordinatorTest.kt index 09594e46..fd8b5ca5 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/transport/restore/RestoreCoordinatorTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/transport/restore/RestoreCoordinatorTest.kt @@ -3,7 +3,9 @@ package com.stevesoltys.seedvault.transport.restore import android.app.backup.BackupTransport.TRANSPORT_ERROR import android.app.backup.BackupTransport.TRANSPORT_OK import android.app.backup.RestoreDescription -import android.app.backup.RestoreDescription.* +import android.app.backup.RestoreDescription.NO_MORE_PACKAGES +import android.app.backup.RestoreDescription.TYPE_FULL_STREAM +import android.app.backup.RestoreDescription.TYPE_KEY_VALUE import android.content.pm.PackageInfo import android.os.ParcelFileDescriptor import androidx.documentfile.provider.DocumentFile @@ -15,8 +17,16 @@ import com.stevesoltys.seedvault.metadata.MetadataReader import com.stevesoltys.seedvault.metadata.PackageMetadata import com.stevesoltys.seedvault.settings.Storage import com.stevesoltys.seedvault.transport.TransportTest -import io.mockk.* -import org.junit.jupiter.api.Assertions.* +import io.mockk.Runs +import io.mockk.every +import io.mockk.just +import io.mockk.mockk +import io.mockk.verify +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertNotNull +import org.junit.jupiter.api.Assertions.assertNull +import org.junit.jupiter.api.Assertions.assertThrows +import org.junit.jupiter.api.Assertions.fail import org.junit.jupiter.api.Test import java.io.IOException import java.io.InputStream diff --git a/app/src/test/java/com/stevesoltys/seedvault/transport/restore/RestoreTest.kt b/app/src/test/java/com/stevesoltys/seedvault/transport/restore/RestoreTest.kt index b240dbc8..417cb940 100644 --- a/app/src/test/java/com/stevesoltys/seedvault/transport/restore/RestoreTest.kt +++ b/app/src/test/java/com/stevesoltys/seedvault/transport/restore/RestoreTest.kt @@ -2,9 +2,9 @@ package com.stevesoltys.seedvault.transport.restore import android.os.ParcelFileDescriptor import com.stevesoltys.seedvault.getRandomByteArray -import com.stevesoltys.seedvault.transport.TransportTest import com.stevesoltys.seedvault.header.HeaderReader import com.stevesoltys.seedvault.header.VERSION +import com.stevesoltys.seedvault.transport.TransportTest import io.mockk.mockk import java.io.InputStream import kotlin.random.Random