summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/system-current.txt6
-rw-r--r--cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java14
-rw-r--r--core/java/android/app/backup/BackupManager.java36
-rw-r--r--core/java/android/app/backup/BackupManagerMonitor.java2
-rw-r--r--core/java/android/app/backup/IRestoreSession.aidl16
-rw-r--r--core/java/android/app/backup/RestoreSession.java119
-rw-r--r--services/backup/java/com/android/server/backup/BackupManagerService.java59
7 files changed, 214 insertions, 38 deletions
diff --git a/api/system-current.txt b/api/system-current.txt
index 63489a9c33f0..106564dda953 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -6897,6 +6897,7 @@ package android.app.backup {
method public int requestBackup(java.lang.String[], android.app.backup.BackupObserver);
method public int requestBackup(java.lang.String[], android.app.backup.BackupObserver, android.app.backup.BackupManagerMonitor, int);
method public int requestRestore(android.app.backup.RestoreObserver);
+ method public int requestRestore(android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor);
method public deprecated java.lang.String selectBackupTransport(java.lang.String);
method public void selectBackupTransport(android.content.ComponentName, android.app.backup.SelectBackupTransportCallback);
method public void setAutoRestore(boolean);
@@ -6925,7 +6926,9 @@ package android.app.backup {
field public static final int LOG_EVENT_CATEGORY_BACKUP_MANAGER_POLICY = 3; // 0x3
field public static final int LOG_EVENT_CATEGORY_TRANSPORT = 1; // 0x1
field public static final int LOG_EVENT_ID_FULL_BACKUP_TIMEOUT = 4; // 0x4
+ field public static final int LOG_EVENT_ID_FULL_RESTORE_TIMEOUT = 45; // 0x2d
field public static final int LOG_EVENT_ID_KEY_VALUE_BACKUP_TIMEOUT = 21; // 0x15
+ field public static final int LOG_EVENT_ID_KEY_VALUE_RESTORE_TIMEOUT = 31; // 0x1f
field public static final int LOG_EVENT_ID_NO_PACKAGES = 49; // 0x31
}
@@ -7022,8 +7025,11 @@ package android.app.backup {
public class RestoreSession {
method public void endRestoreSession();
+ method public int getAvailableRestoreSets(android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor);
method public int getAvailableRestoreSets(android.app.backup.RestoreObserver);
+ method public int restoreAll(long, android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor);
method public int restoreAll(long, android.app.backup.RestoreObserver);
+ method public int restorePackage(java.lang.String, android.app.backup.RestoreObserver, android.app.backup.BackupManagerMonitor);
method public int restorePackage(java.lang.String, android.app.backup.RestoreObserver);
}
diff --git a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
index 3e5c3e8efb88..a67e47f92017 100644
--- a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
+++ b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
@@ -506,7 +506,8 @@ public final class Bmgr {
private void doListRestoreSets() {
try {
RestoreObserver observer = new RestoreObserver();
- int err = mRestore.getAvailableRestoreSets(observer);
+ // TODO implement monitor here
+ int err = mRestore.getAvailableRestoreSets(observer, null);
if (err != 0) {
System.out.println("Unable to request restore sets");
} else {
@@ -609,7 +610,8 @@ public final class Bmgr {
}
RestoreObserver observer = new RestoreObserver();
- int err = mRestore.restorePackage(pkg, observer);
+ // TODO implement monitor here
+ int err = mRestore.restorePackage(pkg, observer, null );
if (err == 0) {
// Off and running -- wait for the restore to complete
observer.waitForCompletion();
@@ -636,7 +638,8 @@ public final class Bmgr {
return;
}
RestoreSet[] sets = null;
- int err = mRestore.getAvailableRestoreSets(observer);
+ // TODO implement monitor here
+ int err = mRestore.getAvailableRestoreSets(observer, null);
if (err == 0) {
observer.waitForCompletion();
sets = observer.sets;
@@ -645,11 +648,12 @@ public final class Bmgr {
if (s.token == token) {
System.out.println("Scheduling restore: " + s.name);
if (filter == null) {
- didRestore = (mRestore.restoreAll(token, observer) == 0);
+ didRestore = (mRestore.restoreAll(token, observer, null) == 0);
} else {
String[] names = new String[filter.size()];
filter.toArray(names);
- didRestore = (mRestore.restoreSome(token, observer, names) == 0);
+ didRestore = (mRestore.restoreSome(token, observer,
+ null, names) == 0);
}
break;
}
diff --git a/core/java/android/app/backup/BackupManager.java b/core/java/android/app/backup/BackupManager.java
index f5c223522213..59bd01f94592 100644
--- a/core/java/android/app/backup/BackupManager.java
+++ b/core/java/android/app/backup/BackupManager.java
@@ -258,16 +258,46 @@ public class BackupManager {
* @return Zero on success; nonzero on error.
*/
public int requestRestore(RestoreObserver observer) {
+ return requestRestore(observer, null);
+ }
+
+ // system APIs start here
+
+ /**
+ * Restore the calling application from backup. The data will be restored from the
+ * current backup dataset if the application has stored data there, or from
+ * the dataset used during the last full device setup operation if the current
+ * backup dataset has no matching data. If no backup data exists for this application
+ * in either source, a nonzero value will be returned.
+ *
+ * <p>If this method returns zero (meaning success), the OS will attempt to retrieve
+ * a backed-up dataset from the remote transport, instantiate the application's
+ * backup agent, and pass the dataset to the agent's
+ * {@link android.app.backup.BackupAgent#onRestore(BackupDataInput, int, android.os.ParcelFileDescriptor) onRestore()}
+ * method.
+ *
+ * @param observer The {@link RestoreObserver} to receive callbacks during the restore
+ * operation. This must not be null.
+ *
+ * @param monitor the {@link BackupManagerMonitor} to receive callbacks during the restore
+ * operation.
+ *
+ * @return Zero on success; nonzero on error.
+ *
+ * @hide
+ */
+ @SystemApi
+ public int requestRestore(RestoreObserver observer, BackupManagerMonitor monitor) {
int result = -1;
checkServiceBinder();
if (sService != null) {
RestoreSession session = null;
try {
IRestoreSession binder = sService.beginRestoreSession(mContext.getPackageName(),
- null);
+ null);
if (binder != null) {
session = new RestoreSession(mContext, binder);
- result = session.restorePackage(mContext.getPackageName(), observer);
+ result = session.restorePackage(mContext.getPackageName(), observer, monitor);
}
} catch (RemoteException e) {
Log.e(TAG, "restoreSelf() unable to contact service");
@@ -280,8 +310,6 @@ public class BackupManager {
return result;
}
- // system APIs start here
-
/**
* Begin the process of restoring data from backup. See the
* {@link android.app.backup.RestoreSession} class for documentation on that process.
diff --git a/core/java/android/app/backup/BackupManagerMonitor.java b/core/java/android/app/backup/BackupManagerMonitor.java
index b937886e2032..099878b310c5 100644
--- a/core/java/android/app/backup/BackupManagerMonitor.java
+++ b/core/java/android/app/backup/BackupManagerMonitor.java
@@ -57,6 +57,8 @@ public class BackupManagerMonitor {
// TODO complete this list with all log messages. And document properly.
public static final int LOG_EVENT_ID_FULL_BACKUP_TIMEOUT = 4;
public static final int LOG_EVENT_ID_KEY_VALUE_BACKUP_TIMEOUT = 21;
+ public static final int LOG_EVENT_ID_KEY_VALUE_RESTORE_TIMEOUT = 31;
+ public static final int LOG_EVENT_ID_FULL_RESTORE_TIMEOUT = 45;
public static final int LOG_EVENT_ID_NO_PACKAGES = 49;
diff --git a/core/java/android/app/backup/IRestoreSession.aidl b/core/java/android/app/backup/IRestoreSession.aidl
index 14731ee62cf0..b9e94856b69e 100644
--- a/core/java/android/app/backup/IRestoreSession.aidl
+++ b/core/java/android/app/backup/IRestoreSession.aidl
@@ -18,7 +18,7 @@ package android.app.backup;
import android.app.backup.RestoreSet;
import android.app.backup.IRestoreObserver;
-
+import android.app.backup.IBackupManagerMonitor;
/**
* Binder interface used by clients who wish to manage a restore operation. Every
* method in this interface requires the android.permission.BACKUP permission.
@@ -31,10 +31,11 @@ interface IRestoreSession {
*
* @param observer This binder points to an object whose onRestoreSetsAvailable()
* method will be called to supply the results of the transport's lookup.
+ * @param monitor If non null the binder will send important events to this monitor.
* @return Zero on success; nonzero on error. The observer will only receive a
* result callback if this method returned zero.
*/
- int getAvailableRestoreSets(IRestoreObserver observer);
+ int getAvailableRestoreSets(IRestoreObserver observer, IBackupManagerMonitor monitor);
/**
* Restore the given set onto the device, replacing the current data of any app
@@ -48,8 +49,9 @@ interface IRestoreSession {
* the restore set that should be used.
* @param observer If non-null, this binder points to an object that will receive
* progress callbacks during the restore operation.
+ * @param monitor If non null the binder will send important events to this monitor.
*/
- int restoreAll(long token, IRestoreObserver observer);
+ int restoreAll(long token, IRestoreObserver observer, IBackupManagerMonitor monitor);
/**
* Restore select packages from the given set onto the device, replacing the
@@ -67,8 +69,10 @@ interface IRestoreSession {
* @param packages The set of packages for which to attempt a restore. Regardless of
* the contents of the actual back-end dataset named by {@code token}, only
* applications mentioned in this list will have their data restored.
+ * @param monitor If non null the binder will send important events to this monitor.
*/
- int restoreSome(long token, IRestoreObserver observer, in String[] packages);
+ int restoreSome(long token, IRestoreObserver observer, IBackupManagerMonitor monitor,
+ in String[] packages);
/**
* Restore a single application from backup. The data will be restored from the
@@ -84,8 +88,10 @@ interface IRestoreSession {
* permission must be held.
* @param observer If non-null, this binder points to an object that will receive
* progress callbacks during the restore operation.
+ * @param monitor If non null the binder will send important events to this monitor.
*/
- int restorePackage(in String packageName, IRestoreObserver observer);
+ int restorePackage(in String packageName, IRestoreObserver observer,
+ IBackupManagerMonitor monitor);
/**
* End this restore session. After this method is called, the IRestoreSession binder
diff --git a/core/java/android/app/backup/RestoreSession.java b/core/java/android/app/backup/RestoreSession.java
index 0a885b6e720f..94fac17c99a3 100644
--- a/core/java/android/app/backup/RestoreSession.java
+++ b/core/java/android/app/backup/RestoreSession.java
@@ -22,6 +22,7 @@ import android.app.backup.RestoreSet;
import android.app.backup.IRestoreObserver;
import android.app.backup.IRestoreSession;
import android.content.Context;
+import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
@@ -46,14 +47,16 @@ public class RestoreSession {
* be called on the application's main thread in order to supply the results of
* the restore set lookup by the backup transport. This parameter must not be
* null.
+ * @param monitor a BackupManagerMonitor object will supply data about important events.
* @return Zero on success, nonzero on error. The observer's restoreSetsAvailable()
* method will only be called if this method returned zero.
*/
- public int getAvailableRestoreSets(RestoreObserver observer) {
+ public int getAvailableRestoreSets(RestoreObserver observer, BackupManagerMonitor monitor) {
int err = -1;
RestoreObserverWrapper obsWrapper = new RestoreObserverWrapper(mContext, observer);
+ BackupManagerMonitorWrapper monitorWrapper = new BackupManagerMonitorWrapper(monitor);
try {
- err = mBinder.getAvailableRestoreSets(obsWrapper);
+ err = mBinder.getAvailableRestoreSets(obsWrapper, monitorWrapper);
} catch (RemoteException e) {
Log.d(TAG, "Can't contact server to get available sets");
}
@@ -61,6 +64,20 @@ public class RestoreSession {
}
/**
+ * Ask the current transport what the available restore sets are.
+ *
+ * @param observer a RestoreObserver object whose restoreSetsAvailable() method will
+ * be called on the application's main thread in order to supply the results of
+ * the restore set lookup by the backup transport. This parameter must not be
+ * null.
+ * @return Zero on success, nonzero on error. The observer's restoreSetsAvailable()
+ * method will only be called if this method returned zero.
+ */
+ public int getAvailableRestoreSets(RestoreObserver observer) {
+ return getAvailableRestoreSets(observer, null);
+ }
+
+ /**
* Restore the given set onto the device, replacing the current data of any app
* contained in the restore set with the data previously backed up.
*
@@ -72,16 +89,19 @@ public class RestoreSession {
* the restore set that should be used.
* @param observer If non-null, this binder points to an object that will receive
* progress callbacks during the restore operation.
+ * @param monitor If non-null, this binder points to an object that will receive
+ * progress callbacks during the restore operation.
*/
- public int restoreAll(long token, RestoreObserver observer) {
+ public int restoreAll(long token, RestoreObserver observer, BackupManagerMonitor monitor) {
int err = -1;
if (mObserver != null) {
Log.d(TAG, "restoreAll() called during active restore");
return -1;
}
mObserver = new RestoreObserverWrapper(mContext, observer);
+ BackupManagerMonitorWrapper monitorWrapper = new BackupManagerMonitorWrapper(monitor);
try {
- err = mBinder.restoreAll(token, mObserver);
+ err = mBinder.restoreAll(token, mObserver, monitorWrapper);
} catch (RemoteException e) {
Log.d(TAG, "Can't contact server to restore");
}
@@ -89,6 +109,23 @@ public class RestoreSession {
}
/**
+ * Restore the given set onto the device, replacing the current data of any app
+ * contained in the restore set with the data previously backed up.
+ *
+ * <p>Callers must hold the android.permission.BACKUP permission to use this method.
+ *
+ * @return Zero on success; nonzero on error. The observer will only receive
+ * progress callbacks if this method returned zero.
+ * @param token The token from {@link #getAvailableRestoreSets()} corresponding to
+ * the restore set that should be used.
+ * @param observer If non-null, this binder points to an object that will receive
+ * progress callbacks during the restore operation.
+ */
+ public int restoreAll(long token, RestoreObserver observer) {
+ return restoreAll(token, observer, null);
+ }
+
+ /**
* Restore select packages from the given set onto the device, replacing the
* current data of any app contained in the set with the data previously
* backed up.
@@ -101,21 +138,25 @@ public class RestoreSession {
* the restore set that should be used.
* @param observer If non-null, this binder points to an object that will receive
* progress callbacks during the restore operation.
+ * @param monitor If non-null, this binder points to an object that will receive
+ * progress callbacks during the restore operation.
* @param packages The set of packages for which to attempt a restore. Regardless of
* the contents of the actual back-end dataset named by {@code token}, only
* applications mentioned in this list will have their data restored.
*
* @hide
*/
- public int restoreSome(long token, RestoreObserver observer, String[] packages) {
+ public int restoreSome(long token, RestoreObserver observer, BackupManagerMonitor monitor,
+ String[] packages) {
int err = -1;
if (mObserver != null) {
Log.d(TAG, "restoreAll() called during active restore");
return -1;
}
mObserver = new RestoreObserverWrapper(mContext, observer);
+ BackupManagerMonitorWrapper monitorWrapper = new BackupManagerMonitorWrapper(monitor);
try {
- err = mBinder.restoreSome(token, mObserver, packages);
+ err = mBinder.restoreSome(token, mObserver, monitorWrapper, packages);
} catch (RemoteException e) {
Log.d(TAG, "Can't contact server to restore packages");
}
@@ -123,6 +164,29 @@ public class RestoreSession {
}
/**
+ * Restore select packages from the given set onto the device, replacing the
+ * current data of any app contained in the set with the data previously
+ * backed up.
+ *
+ * <p>Callers must hold the android.permission.BACKUP permission to use this method.
+ *
+ * @return Zero on success, nonzero on error. The observer will only receive
+ * progress callbacks if this method returned zero.
+ * @param token The token from {@link getAvailableRestoreSets()} corresponding to
+ * the restore set that should be used.
+ * @param observer If non-null, this binder points to an object that will receive
+ * progress callbacks during the restore operation.
+ * @param packages The set of packages for which to attempt a restore. Regardless of
+ * the contents of the actual back-end dataset named by {@code token}, only
+ * applications mentioned in this list will have their data restored.
+ *
+ * @hide
+ */
+ public int restoreSome(long token, RestoreObserver observer, String[] packages) {
+ return restoreSome(token, observer, null, packages);
+ }
+
+ /**
* Restore a single application from backup. The data will be restored from the
* current backup dataset if the given package has stored data there, or from
* the dataset used during the last full device setup operation if the current
@@ -136,22 +200,48 @@ public class RestoreSession {
* permission must be held.
* @param observer If non-null, this binder points to an object that will receive
* progress callbacks during the restore operation.
+ *
+ * @param monitor If non-null, this binder points to an object that will receive
+ * event callbacks during the restore operation.
*/
- public int restorePackage(String packageName, RestoreObserver observer) {
+ public int restorePackage(String packageName, RestoreObserver observer,
+ BackupManagerMonitor monitor) {
int err = -1;
if (mObserver != null) {
Log.d(TAG, "restorePackage() called during active restore");
return -1;
}
mObserver = new RestoreObserverWrapper(mContext, observer);
+ BackupManagerMonitorWrapper monitorWrapper = new BackupManagerMonitorWrapper(monitor);
+
try {
- err = mBinder.restorePackage(packageName, mObserver);
+ err = mBinder.restorePackage(packageName, mObserver, monitorWrapper);
} catch (RemoteException e) {
Log.d(TAG, "Can't contact server to restore package");
}
return err;
}
+
+ /**
+ * Restore a single application from backup. The data will be restored from the
+ * current backup dataset if the given package has stored data there, or from
+ * the dataset used during the last full device setup operation if the current
+ * backup dataset has no matching data. If no backup data exists for this package
+ * in either source, a nonzero value will be returned.
+ *
+ * @return Zero on success; nonzero on error. The observer will only receive
+ * progress callbacks if this method returned zero.
+ * @param packageName The name of the package whose data to restore. If this is
+ * not the name of the caller's own package, then the android.permission.BACKUP
+ * permission must be held.
+ * @param observer If non-null, this binder points to an object that will receive
+ * progress callbacks during the restore operation.
+ */
+ public int restorePackage(String packageName, RestoreObserver observer) {
+ return restorePackage(packageName, observer, null);
+ }
+
/**
* End this restore session. After this method is called, the RestoreSession
* object is no longer valid.
@@ -236,4 +326,17 @@ public class RestoreSession {
mHandler.obtainMessage(MSG_RESTORE_FINISHED, error, 0));
}
}
+
+ private class BackupManagerMonitorWrapper extends IBackupManagerMonitor.Stub {
+ final BackupManagerMonitor mMonitor;
+
+ BackupManagerMonitorWrapper(BackupManagerMonitor monitor) {
+ mMonitor = monitor;
+ }
+
+ @Override
+ public void onEvent(final Bundle event) throws RemoteException {
+ mMonitor.onEvent(event);
+ }
+ }
}
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index 043c8ad91eb6..1592338158e6 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -416,12 +416,14 @@ public class BackupManagerService {
public IBackupTransport transport;
public ActiveRestoreSession session;
public IRestoreObserver observer;
+ public IBackupManagerMonitor monitor;
RestoreGetSetsParams(IBackupTransport _transport, ActiveRestoreSession _session,
- IRestoreObserver _observer) {
+ IRestoreObserver _observer, IBackupManagerMonitor _monitor) {
transport = _transport;
session = _session;
observer = _observer;
+ monitor = _monitor;
}
}
@@ -440,10 +442,11 @@ public class BackupManagerService {
* Restore a single package; no kill after restore
*/
RestoreParams(IBackupTransport _transport, String _dirName, IRestoreObserver _obs,
- long _token, PackageInfo _pkg) {
+ IBackupManagerMonitor _monitor, long _token, PackageInfo _pkg) {
transport = _transport;
dirName = _dirName;
observer = _obs;
+ monitor = _monitor;
token = _token;
pkgInfo = _pkg;
pmToken = 0;
@@ -455,10 +458,11 @@ public class BackupManagerService {
* Restore at install: PM token needed, kill after restore
*/
RestoreParams(IBackupTransport _transport, String _dirName, IRestoreObserver _obs,
- long _token, String _pkgName, int _pmToken) {
+ IBackupManagerMonitor _monitor, long _token, String _pkgName, int _pmToken) {
transport = _transport;
dirName = _dirName;
observer = _obs;
+ monitor = _monitor;
token = _token;
pkgInfo = null;
pmToken = _pmToken;
@@ -471,10 +475,11 @@ public class BackupManagerService {
* restore UXes use.
*/
RestoreParams(IBackupTransport _transport, String _dirName, IRestoreObserver _obs,
- long _token) {
+ IBackupManagerMonitor _monitor, long _token) {
transport = _transport;
dirName = _dirName;
observer = _obs;
+ monitor = _monitor;
token = _token;
pkgInfo = null;
pmToken = 0;
@@ -487,10 +492,12 @@ public class BackupManagerService {
* whether it's to be considered a system-level restore.
*/
RestoreParams(IBackupTransport _transport, String _dirName, IRestoreObserver _obs,
- long _token, String[] _filterSet, boolean _isSystemRestore) {
+ IBackupManagerMonitor _monitor, long _token,
+ String[] _filterSet, boolean _isSystemRestore) {
transport = _transport;
dirName = _dirName;
observer = _obs;
+ monitor = _monitor;
token = _token;
pkgInfo = null;
pmToken = 0;
@@ -7785,6 +7792,9 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
// Restore observer; may be null
private IRestoreObserver mObserver;
+ // BackuoManagerMonitor; may be null
+ private IBackupManagerMonitor mMonitor;
+
// Token identifying the dataset to the transport
private long mToken;
@@ -7856,6 +7866,7 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
mTransport = transport;
mObserver = observer;
+ mMonitor = monitor;
mToken = restoreSetToken;
mPmToken = pmToken;
mTargetPackage = targetPackage;
@@ -8582,6 +8593,8 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
if (DEBUG) {
Slog.w(TAG, "Full-data restore target timed out; shutting down");
}
+ mMonitor = monitorEvent(mMonitor, BackupManagerMonitor.LOG_EVENT_ID_FULL_RESTORE_TIMEOUT,
+ mCurrentPackage, BackupManagerMonitor.LOG_EVENT_CATEGORY_AGENT);
mEngineThread.handleTimeout();
IoUtils.closeQuietly(mEnginePipes[1]);
@@ -8825,6 +8838,8 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
@Override
public void handleTimeout() {
Slog.e(TAG, "Timeout restoring application " + mCurrentPackage.packageName);
+ mMonitor = monitorEvent(mMonitor, BackupManagerMonitor.LOG_EVENT_ID_KEY_VALUE_RESTORE_TIMEOUT,
+ mCurrentPackage, BackupManagerMonitor.LOG_EVENT_CATEGORY_AGENT);
EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE,
mCurrentPackage.packageName, "restore timeout");
// Handle like an agent that threw on invocation: wipe it and go on to the next
@@ -9832,7 +9847,7 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
Slog.d(TAG, "Restore at install of " + packageName);
}
Message msg = mBackupHandler.obtainMessage(MSG_RUN_RESTORE);
- msg.obj = new RestoreParams(transport, dirName, null,
+ msg.obj = new RestoreParams(transport, dirName, null, null,
restoreSet, packageName, token);
mBackupHandler.sendMessage(msg);
} catch (Exception e) {
@@ -9990,7 +10005,8 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
}
// --- Binder interface ---
- public synchronized int getAvailableRestoreSets(IRestoreObserver observer) {
+ public synchronized int getAvailableRestoreSets(IRestoreObserver observer,
+ IBackupManagerMonitor monitor) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"getAvailableRestoreSets");
if (observer == null) {
@@ -10021,7 +10037,8 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
// spin off the transport request to our service thread
mWakelock.acquire();
Message msg = mBackupHandler.obtainMessage(MSG_RUN_GET_RESTORE_SETS,
- new RestoreGetSetsParams(mRestoreTransport, this, observer));
+ new RestoreGetSetsParams(mRestoreTransport, this, observer,
+ monitor));
mBackupHandler.sendMessage(msg);
return 0;
} catch (Exception e) {
@@ -10032,7 +10049,8 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
}
}
- public synchronized int restoreAll(long token, IRestoreObserver observer) {
+ public synchronized int restoreAll(long token, IRestoreObserver observer,
+ IBackupManagerMonitor monitor) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"performRestore");
@@ -10080,7 +10098,7 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
}
Message msg = mBackupHandler.obtainMessage(MSG_RUN_RESTORE);
msg.obj = new RestoreParams(mRestoreTransport, dirName,
- observer, token);
+ observer, monitor, token);
mBackupHandler.sendMessage(msg);
Binder.restoreCallingIdentity(oldId);
return 0;
@@ -10094,7 +10112,7 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
// Restores of more than a single package are treated as 'system' restores
public synchronized int restoreSome(long token, IRestoreObserver observer,
- String[] packages) {
+ IBackupManagerMonitor monitor, String[] packages) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"performRestore");
@@ -10104,6 +10122,12 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
b.append(Long.toHexString(token));
b.append(" observer=");
b.append(observer.toString());
+ b.append(" monitor=");
+ if (monitor == null) {
+ b.append("null");
+ } else {
+ b.append(monitor.toString());
+ }
b.append(" packages=");
if (packages == null) {
b.append("null");
@@ -10161,8 +10185,8 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
Slog.d(TAG, "restoreSome() of " + packages.length + " packages");
}
Message msg = mBackupHandler.obtainMessage(MSG_RUN_RESTORE);
- msg.obj = new RestoreParams(mRestoreTransport, dirName, observer, token,
- packages, packages.length > 1);
+ msg.obj = new RestoreParams(mRestoreTransport, dirName, observer, monitor,
+ token, packages, packages.length > 1);
mBackupHandler.sendMessage(msg);
Binder.restoreCallingIdentity(oldId);
return 0;
@@ -10174,8 +10198,10 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
return -1;
}
- public synchronized int restorePackage(String packageName, IRestoreObserver observer) {
- if (DEBUG) Slog.v(TAG, "restorePackage pkg=" + packageName + " obs=" + observer);
+ public synchronized int restorePackage(String packageName, IRestoreObserver observer,
+ IBackupManagerMonitor monitor) {
+ if (DEBUG) Slog.v(TAG, "restorePackage pkg=" + packageName + " obs=" + observer
+ + "monitor=" + monitor);
if (mEnded) {
throw new IllegalStateException("Restore session already ended");
@@ -10248,7 +10274,8 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
Slog.d(TAG, "restorePackage() : " + packageName);
}
Message msg = mBackupHandler.obtainMessage(MSG_RUN_RESTORE);
- msg.obj = new RestoreParams(mRestoreTransport, dirName, observer, token, app);
+ msg.obj = new RestoreParams(mRestoreTransport, dirName, observer, monitor,
+ token, app);
mBackupHandler.sendMessage(msg);
} finally {
Binder.restoreCallingIdentity(oldId);