diff options
author | Joe Onorato <joeo@android.com> | 2009-05-13 18:57:29 -0400 |
---|---|---|
committer | Joe Onorato <joeo@android.com> | 2009-05-14 09:39:32 -0400 |
commit | 290bb011c5c1a9ba1f2116810b06cf52a9c36b3e (patch) | |
tree | cfb9ce077d79021e86c1b8d7951f3655520f368d /tests/backup/src | |
parent | ec2d74d40f9b7a8bf96feeb45a5d054d8b0ce0dd (diff) | |
download | frameworks_base-290bb011c5c1a9ba1f2116810b06cf52a9c36b3e.zip frameworks_base-290bb011c5c1a9ba1f2116810b06cf52a9c36b3e.tar.gz frameworks_base-290bb011c5c1a9ba1f2116810b06cf52a9c36b3e.tar.bz2 |
Get the backup calling through to the file backup helper.
This includes some cleanup to make the parameters match
between BackupService.onBackup and FileBackupHelper.performBackup.
Diffstat (limited to 'tests/backup/src')
-rw-r--r-- | tests/backup/src/com/android/backuptest/BackupTestActivity.java | 21 | ||||
-rw-r--r-- | tests/backup/src/com/android/backuptest/BackupTestService.java | 10 |
2 files changed, 28 insertions, 3 deletions
diff --git a/tests/backup/src/com/android/backuptest/BackupTestActivity.java b/tests/backup/src/com/android/backuptest/BackupTestActivity.java index de68cb7..af7dfd4 100644 --- a/tests/backup/src/com/android/backuptest/BackupTestActivity.java +++ b/tests/backup/src/com/android/backuptest/BackupTestActivity.java @@ -83,6 +83,27 @@ public class BackupTestActivity extends ListActivity bm.dataChanged(); } }, + new Test("Clear File") { + void run() { + PrintStream output = null; + try { + output = new PrintStream(openFileOutput(FILE_NAME, MODE_PRIVATE)); + output.close(); + } catch (IOException ex) { + if (output != null) { + output.close(); + } + } + BackupManager bm = new BackupManager(BackupTestActivity.this); + bm.dataChanged(); + } + }, + new Test("Poke") { + void run() { + BackupManager bm = new BackupManager(BackupTestActivity.this); + bm.dataChanged(); + } + }, new Test("Show Shared Pref") { void run() { SharedPreferences prefs = getSharedPreferences(PREF_GROUP_SETTINGS, MODE_PRIVATE); diff --git a/tests/backup/src/com/android/backuptest/BackupTestService.java b/tests/backup/src/com/android/backuptest/BackupTestService.java index c58c98b..00eb86e 100644 --- a/tests/backup/src/com/android/backuptest/BackupTestService.java +++ b/tests/backup/src/com/android/backuptest/BackupTestService.java @@ -17,6 +17,8 @@ package com.android.backuptest; import android.backup.BackupService; +import android.backup.BackupDataOutput; +import android.backup.FileBackupHelper; import android.os.ParcelFileDescriptor; import android.util.Log; @@ -25,10 +27,12 @@ public class BackupTestService extends BackupService static final String TAG = "BackupTestService"; @Override - public void onBackup(ParcelFileDescriptor oldState, - ParcelFileDescriptor data, - ParcelFileDescriptor newState) { + public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data, + ParcelFileDescriptor newState) { Log.d(TAG, "onBackup"); + FileBackupHelper.performBackup(this, oldState, data, newState, new String[] { + BackupTestActivity.FILE_NAME + }); } @Override |