Expect ApplicationInfo#splitSourceDirs to be null
Also handle errors like these a bit better
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 60c9c9a..02208eb 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
@@ -154,7 +154,8 @@
streamGetter: suspend (name: String) -> OutputStream,
): List<ApkSplit> {
check(packageInfo.splitNames != null)
- val splitSourceDirs = packageInfo.applicationInfo.splitSourceDirs
+ // attention: though not documented, splitSourceDirs can be null
+ val splitSourceDirs = packageInfo.applicationInfo.splitSourceDirs ?: emptyArray()
check(packageInfo.splitNames.size == splitSourceDirs.size) {
"Size Mismatch! ${packageInfo.splitNames.size} != ${splitSourceDirs.size} " +
"splitNames is ${packageInfo.splitNames.toList()}, " +
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 ac77983..5d791fc 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
@@ -381,7 +381,13 @@
}
// hook in here to back up APKs of apps that are otherwise not allowed for backup
if (isPmBackup && settingsManager.canDoBackupNow()) {
- backUpApksOfNotBackedUpPackages()
+ try {
+ backUpApksOfNotBackedUpPackages()
+ } catch (e: Exception) {
+ Log.e(TAG, "Error backing up APKs of opt-out apps: ", e)
+ // We are re-throwing this, because we want to know about problems here
+ throw e
+ }
}
}
result
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 dd89cad..060f543 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
@@ -209,6 +209,7 @@
else state.db.close()
TRANSPORT_OK
} catch (e: IOException) {
+ Log.e(TAG, "Error uploading DB", e)
TRANSPORT_ERROR
} finally {
this.state = null