Loading services/backup/java/com/android/server/backup/keyvalue/KeyValueBackupReporter.java +24 −10 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.pm.PackageInfo; import android.util.EventLog; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; import com.android.server.EventLogTags; import com.android.server.backup.BackupManagerService; import com.android.server.backup.DataChangedJournal; Loading @@ -49,10 +50,19 @@ import java.util.List; */ // TODO: In KeyValueBackupTaskTest, remove direct assertions on logcat, observer or monitor and // verify calls to this object. Add these and more assertions to the test of this class. class KeyValueBackupReporter { private static final String TAG = "KeyValueBackupTask"; @VisibleForTesting public class KeyValueBackupReporter { @VisibleForTesting static final String TAG = "KeyValueBackupTask"; private static final boolean DEBUG = BackupManagerService.DEBUG; private static final boolean MORE_DEBUG = BackupManagerService.MORE_DEBUG || true; @VisibleForTesting static final boolean MORE_DEBUG = BackupManagerService.MORE_DEBUG || true; static void onNewThread(String threadName) { if (DEBUG) { Slog.d(TAG, "Spinning thread " + threadName); } } private final BackupManagerService mBackupManagerService; private final IBackupObserver mObserver; Loading @@ -61,7 +71,7 @@ class KeyValueBackupReporter { KeyValueBackupReporter( BackupManagerService backupManagerService, IBackupObserver observer, IBackupManagerMonitor monitor) { @Nullable IBackupManagerMonitor monitor) { mBackupManagerService = backupManagerService; mObserver = observer; mMonitor = monitor; Loading @@ -73,6 +83,10 @@ class KeyValueBackupReporter { return mMonitor; } IBackupObserver getObserver() { return mObserver; } void onSkipBackup() { if (DEBUG) { Slog.d(TAG, "Skipping backup since one is already in progress"); Loading Loading @@ -237,10 +251,6 @@ class KeyValueBackupReporter { } } void onTruncateDataError() { Slog.w(TAG, "Unable to roll back"); } void onSendDataToTransport(String packageName) { if (MORE_DEBUG) { Slog.v(TAG, "Sending non-empty data to transport for " + packageName); Loading Loading @@ -357,7 +367,7 @@ class KeyValueBackupReporter { return (packageInfo != null) ? packageInfo.packageName : "no_package_yet"; } void onRevertBackup() { void onRevertTask() { if (MORE_DEBUG) { Slog.i(TAG, "Reverting backup queue, re-staging everything"); } Loading Loading @@ -391,6 +401,10 @@ class KeyValueBackupReporter { Slog.w(TAG, "Failed to query transport name for pending init: " + e); } /** * This is a bit different from {@link #onTaskFinished()}, it's only called if there is no * full-backup requests associated with the key-value task. */ void onBackupFinished(int status) { BackupObserverUtils.sendBackupFinished(mObserver, status); } Loading @@ -399,7 +413,7 @@ class KeyValueBackupReporter { Slog.d(TAG, "Starting full backups for: " + pendingFullBackups); } void onKeyValueBackupFinished() { void onTaskFinished() { Slog.i(TAG, "K/V backup pass finished"); } } Loading
services/backup/java/com/android/server/backup/keyvalue/KeyValueBackupReporter.java +24 −10 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.pm.PackageInfo; import android.util.EventLog; import android.util.Slog; import com.android.internal.annotations.VisibleForTesting; import com.android.server.EventLogTags; import com.android.server.backup.BackupManagerService; import com.android.server.backup.DataChangedJournal; Loading @@ -49,10 +50,19 @@ import java.util.List; */ // TODO: In KeyValueBackupTaskTest, remove direct assertions on logcat, observer or monitor and // verify calls to this object. Add these and more assertions to the test of this class. class KeyValueBackupReporter { private static final String TAG = "KeyValueBackupTask"; @VisibleForTesting public class KeyValueBackupReporter { @VisibleForTesting static final String TAG = "KeyValueBackupTask"; private static final boolean DEBUG = BackupManagerService.DEBUG; private static final boolean MORE_DEBUG = BackupManagerService.MORE_DEBUG || true; @VisibleForTesting static final boolean MORE_DEBUG = BackupManagerService.MORE_DEBUG || true; static void onNewThread(String threadName) { if (DEBUG) { Slog.d(TAG, "Spinning thread " + threadName); } } private final BackupManagerService mBackupManagerService; private final IBackupObserver mObserver; Loading @@ -61,7 +71,7 @@ class KeyValueBackupReporter { KeyValueBackupReporter( BackupManagerService backupManagerService, IBackupObserver observer, IBackupManagerMonitor monitor) { @Nullable IBackupManagerMonitor monitor) { mBackupManagerService = backupManagerService; mObserver = observer; mMonitor = monitor; Loading @@ -73,6 +83,10 @@ class KeyValueBackupReporter { return mMonitor; } IBackupObserver getObserver() { return mObserver; } void onSkipBackup() { if (DEBUG) { Slog.d(TAG, "Skipping backup since one is already in progress"); Loading Loading @@ -237,10 +251,6 @@ class KeyValueBackupReporter { } } void onTruncateDataError() { Slog.w(TAG, "Unable to roll back"); } void onSendDataToTransport(String packageName) { if (MORE_DEBUG) { Slog.v(TAG, "Sending non-empty data to transport for " + packageName); Loading Loading @@ -357,7 +367,7 @@ class KeyValueBackupReporter { return (packageInfo != null) ? packageInfo.packageName : "no_package_yet"; } void onRevertBackup() { void onRevertTask() { if (MORE_DEBUG) { Slog.i(TAG, "Reverting backup queue, re-staging everything"); } Loading Loading @@ -391,6 +401,10 @@ class KeyValueBackupReporter { Slog.w(TAG, "Failed to query transport name for pending init: " + e); } /** * This is a bit different from {@link #onTaskFinished()}, it's only called if there is no * full-backup requests associated with the key-value task. */ void onBackupFinished(int status) { BackupObserverUtils.sendBackupFinished(mObserver, status); } Loading @@ -399,7 +413,7 @@ class KeyValueBackupReporter { Slog.d(TAG, "Starting full backups for: " + pendingFullBackups); } void onKeyValueBackupFinished() { void onTaskFinished() { Slog.i(TAG, "K/V backup pass finished"); } }