Expect ApplicationInfo#splitSourceDirs to be null
Also handle errors like these a bit better
This commit is contained in:
parent
f5c58363ef
commit
848ed51de4
3 changed files with 10 additions and 2 deletions
|
@ -154,7 +154,8 @@ internal class ApkBackup(
|
||||||
streamGetter: suspend (name: String) -> OutputStream,
|
streamGetter: suspend (name: String) -> OutputStream,
|
||||||
): List<ApkSplit> {
|
): List<ApkSplit> {
|
||||||
check(packageInfo.splitNames != null)
|
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) {
|
check(packageInfo.splitNames.size == splitSourceDirs.size) {
|
||||||
"Size Mismatch! ${packageInfo.splitNames.size} != ${splitSourceDirs.size} " +
|
"Size Mismatch! ${packageInfo.splitNames.size} != ${splitSourceDirs.size} " +
|
||||||
"splitNames is ${packageInfo.splitNames.toList()}, " +
|
"splitNames is ${packageInfo.splitNames.toList()}, " +
|
||||||
|
|
|
@ -381,7 +381,13 @@ internal class BackupCoordinator(
|
||||||
}
|
}
|
||||||
// hook in here to back up APKs of apps that are otherwise not allowed for backup
|
// hook in here to back up APKs of apps that are otherwise not allowed for backup
|
||||||
if (isPmBackup && settingsManager.canDoBackupNow()) {
|
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
|
result
|
||||||
|
|
|
@ -209,6 +209,7 @@ internal class KVBackup(
|
||||||
else state.db.close()
|
else state.db.close()
|
||||||
TRANSPORT_OK
|
TRANSPORT_OK
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
|
Log.e(TAG, "Error uploading DB", e)
|
||||||
TRANSPORT_ERROR
|
TRANSPORT_ERROR
|
||||||
} finally {
|
} finally {
|
||||||
this.state = null
|
this.state = null
|
||||||
|
|
Loading…
Reference in a new issue