summaryrefslogtreecommitdiffstats
path: root/tests/backup
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2009-05-14 11:12:14 -0700
committerChristopher Tate <ctate@google.com>2009-05-31 13:10:03 -0700
commit181fafaf48208978b8ba2022683ffa78aaeddde1 (patch)
tree7c062847d418415e28813e70aac53c8c47e4ff69 /tests/backup
parentc01159bb00f7273f9b051dfbbe6bc10d54d3a846 (diff)
downloadframeworks_base-181fafaf48208978b8ba2022683ffa78aaeddde1.zip
frameworks_base-181fafaf48208978b8ba2022683ffa78aaeddde1.tar.gz
frameworks_base-181fafaf48208978b8ba2022683ffa78aaeddde1.tar.bz2
Retool the backup process to use a new 'BackupAgent' class
Backups will be handled by launching the application in a special mode under which no activities or services will be started, only the BackupAgent subclass named in the app's android:backupAgent manifest property. This takes the place of the BackupService class used earlier during development. In the cases of *full* backup or restore, an application that does not supply its own BackupAgent will be launched in a restricted manner; in particular, it will be using the default Application class rather than any manifest-declared one. This ensures that the app is not running any code that may try to manipulate its data while the backup system reads/writes its data set.
Diffstat (limited to 'tests/backup')
-rw-r--r--tests/backup/AndroidManifest.xml7
-rw-r--r--tests/backup/src/com/android/backuptest/BackupTestAgent.java (renamed from tests/backup/src/com/android/backuptest/BackupTestService.java)6
2 files changed, 4 insertions, 9 deletions
diff --git a/tests/backup/AndroidManifest.xml b/tests/backup/AndroidManifest.xml
index eaeb5b7..3778742 100644
--- a/tests/backup/AndroidManifest.xml
+++ b/tests/backup/AndroidManifest.xml
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.backuptest">
- <application>
+ <application android:backupAgent="BackupTestAgent">
<activity android:name="BackupTestActivity" android:label="_BackupTest">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -8,10 +8,5 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- <service android:name="BackupTestService">
- <intent-filter>
- <action android:name="android.backup.BackupService.SERVICE" />
- </intent-filter>
- </service>
</application>
</manifest>
diff --git a/tests/backup/src/com/android/backuptest/BackupTestService.java b/tests/backup/src/com/android/backuptest/BackupTestAgent.java
index 00eb86e..11e520e 100644
--- a/tests/backup/src/com/android/backuptest/BackupTestService.java
+++ b/tests/backup/src/com/android/backuptest/BackupTestAgent.java
@@ -16,15 +16,15 @@
package com.android.backuptest;
-import android.backup.BackupService;
+import android.app.BackupAgent;
import android.backup.BackupDataOutput;
import android.backup.FileBackupHelper;
import android.os.ParcelFileDescriptor;
import android.util.Log;
-public class BackupTestService extends BackupService
+public class BackupTestAgent extends BackupAgent
{
- static final String TAG = "BackupTestService";
+ static final String TAG = "BackupTestAgent";
@Override
public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data,