From c8daa769256b039b6bc4c5acbe6b558cd776c00a Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Mon, 6 Jul 2009 19:04:57 -0700 Subject: BackupManager wrapper class improvements + Now rechecks the cached IBinder each time the wrapper is used, and if it's still null (i.e. the BackupManager was constructed before the system service came up) it's refetched. This lets even system code cache a single BackupManager instance and just keep making calls through it without worrying about interactions with the life cycle of the backup service. + Added a static dataChanged(packageName) method as a convenience for code that needs to indicate that some other package needs a backup pass. This is useful even for third party code in the case of multiple packages in a shared-uid situation. --- .../src/com/android/backuptest/BackupTestActivity.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'tests/backup') diff --git a/tests/backup/src/com/android/backuptest/BackupTestActivity.java b/tests/backup/src/com/android/backuptest/BackupTestActivity.java index 7f30c91..afbc703 100644 --- a/tests/backup/src/com/android/backuptest/BackupTestActivity.java +++ b/tests/backup/src/com/android/backuptest/BackupTestActivity.java @@ -52,6 +52,8 @@ public class BackupTestActivity extends ListActivity static final String PREF_KEY = "pref"; static final String FILE_NAME = "file.txt"; + BackupManager sBm = new BackupManager(this); + Test[] mTests = new Test[] { new Test("Show File") { void run() { @@ -85,8 +87,7 @@ public class BackupTestActivity extends ListActivity output.close(); } } - BackupManager bm = new BackupManager(BackupTestActivity.this); - bm.dataChanged(); + sBm.dataChanged(); } }, new Test("Clear File") { @@ -100,14 +101,12 @@ public class BackupTestActivity extends ListActivity output.close(); } } - BackupManager bm = new BackupManager(BackupTestActivity.this); - bm.dataChanged(); + sBm.dataChanged(); } }, new Test("Poke") { void run() { - BackupManager bm = new BackupManager(BackupTestActivity.this); - bm.dataChanged(); + sBm.dataChanged(); } }, new Test("Show Shared Pref") { @@ -126,8 +125,7 @@ public class BackupTestActivity extends ListActivity SharedPreferences.Editor editor = prefs.edit(); editor.putInt(PREF_KEY, val+1); editor.commit(); - BackupManager bm = new BackupManager(BackupTestActivity.this); - bm.dataChanged(); + sBm.dataChanged(); } }, new Test("Backup Helpers") { -- cgit v1.1