Always log BackupMonitor and start stopped apps later in CI test

This commit is contained in:
Torsten Grote 2024-10-11 11:00:49 -03:00
parent 32d7f49d4c
commit b8c87a6928
No known key found for this signature in database
GPG key ID: 3E5F77D92CF891FF
2 changed files with 4 additions and 6 deletions

View file

@ -21,7 +21,6 @@ internal class BackupRestoreTest : SeedvaultLargeTest() {
@Test
fun `backup and restore applications`() {
launchStoppedApps()
launchBackupActivity()
if (!keyManager.hasBackupKey()) {
@ -34,6 +33,9 @@ internal class BackupRestoreTest : SeedvaultLargeTest() {
changeBackupLocation()
}
launchStoppedApps()
launchBackupActivity()
val backupResult = performBackup()
assertValidBackupMetadata(backupResult)

View file

@ -13,7 +13,6 @@ import android.app.backup.BackupManagerMonitor.LOG_EVENT_ID_ERROR_PREFLIGHT
import android.app.backup.IBackupManagerMonitor
import android.os.Bundle
import android.util.Log
import android.util.Log.DEBUG
private val TAG = BackupMonitor::class.java.name
@ -29,14 +28,11 @@ open class BackupMonitor : IBackupManagerMonitor.Stub() {
}
open fun onEvent(id: Int, category: Int, packageName: String?, bundle: Bundle) {
Log.d(TAG, "${packageName?.padEnd(64, ' ')} cat: $category id: $id")
if (id == LOG_EVENT_ID_ERROR_PREFLIGHT) {
val preflightResult = bundle.getLong(EXTRA_LOG_PREFLIGHT_ERROR, -1)
Log.w(TAG, "Pre-flight error from $packageName: $preflightResult")
}
if (!Log.isLoggable(TAG, DEBUG)) return
Log.d(TAG, "ID: $id")
Log.d(TAG, "CATEGORY: $category")
Log.d(TAG, "PACKAGE: $packageName")
}
}