diff --git a/core/java/android/backup/BackupManager.java b/core/java/android/backup/BackupManager.java index 30f781e659e50..c3b6a02e75168 100644 --- a/core/java/android/backup/BackupManager.java +++ b/core/java/android/backup/BackupManager.java @@ -32,8 +32,9 @@ import android.os.ServiceManager; * until the backup operation actually occurs. * *
The backup operation itself begins with the system launching the
- * {@link BackupService} subclass declared in your manifest. See the documentation
- * for {@link BackupService} for a detailed description of how the backup then proceeds.
+ * {@link android.app.BackupAgent} subclass declared in your manifest. See the
+ * documentation for {@link android.app.BackupAgent} for a detailed description
+ * of how the backup then proceeds.
*
* @hide pending API solidification
*/
@@ -64,7 +65,7 @@ public class BackupManager {
/**
* Notifies the Android backup system that your application wishes to back up
* new changes to its data. A backup operation using your application's
- * {@link BackupService} subclass will be scheduled when you call this method.
+ * {@link android.app.BackupAgent} subclass will be scheduled when you call this method.
*/
public void dataChanged() {
try {
@@ -72,4 +73,20 @@ public class BackupManager {
} catch (RemoteException e) {
}
}
+
+ /**
+ * Begin the process of restoring system data from backup. This method requires
+ * that the application hold the "android.permission.BACKUP" permission, and is
+ * not public.
+ *
+ * {@hide}
+ */
+ public IRestoreSession beginRestoreSession(int transportID) {
+ IRestoreSession binder = null;
+ try {
+ binder = mService.beginRestoreSession(transportID);
+ } catch (RemoteException e) {
+ }
+ return binder;
+ }
}
diff --git a/core/java/android/backup/IRestoreSession.aidl b/core/java/android/backup/IRestoreSession.aidl
index 63b29a278309f..6bca865f51299 100644
--- a/core/java/android/backup/IRestoreSession.aidl
+++ b/core/java/android/backup/IRestoreSession.aidl
@@ -16,7 +16,7 @@
package android.backup;
-import android.os.Bundle;
+import android.backup.RestoreSet;
/**
* Binder interface used by clients who wish to manage a restore operation. Every
@@ -33,7 +33,7 @@ interface IRestoreSession {
* and a String array under the key "names" whose entries are the user-meaningful
* text corresponding to the backup sets at each index in the tokens array.
*/
- Bundle getAvailableRestoreSets();
+ RestoreSet[] getAvailableRestoreSets();
/**
* Restore the given set onto the device, replacing the current data of any app
diff --git a/core/java/android/backup/RestoreSet.aidl b/core/java/android/backup/RestoreSet.aidl
new file mode 100644
index 0000000000000..42e77bfe59901
--- /dev/null
+++ b/core/java/android/backup/RestoreSet.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.backup;
+
+parcelable RestoreSet;
\ No newline at end of file
diff --git a/core/java/android/backup/RestoreSet.java b/core/java/android/backup/RestoreSet.java
new file mode 100644
index 0000000000000..7f09af3957ffe
--- /dev/null
+++ b/core/java/android/backup/RestoreSet.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.backup;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * Descriptive information about a set of backed-up app data available for restore.
+ * Used by IRestoreSession clients.
+ *
+ * @hide
+ */
+public class RestoreSet implements Parcelable {
+ /**
+ * Name of this restore set. May be user generated, may simply be the name
+ * of the handset model, e.g. "T-Mobile G1".
+ */
+ public String name;
+
+ /**
+ * Identifier of the device whose data this is. This will be as unique as
+ * is practically possible; for example, it might be an IMEI.
+ */
+ public String device;
+
+ /**
+ * Token that identifies this backup set unambiguously to the backup/restore
+ * transport. This is guaranteed to be valid for the duration of a restore
+ * session, but is meaningless once the session has ended.
+ */
+ public int token;
+
+
+ RestoreSet() {
+ // Leave everything zero / null
+ }
+
+ RestoreSet(String _name, String _dev, int _token) {
+ name = _name;
+ device = _dev;
+ token = _token;
+ }
+
+
+ // Parcelable implementation
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel out, int flags) {
+ out.writeString(name);
+ out.writeString(device);
+ out.writeInt(token);
+ }
+
+ public static final Parcelable.Creator