summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2009-06-04 15:00:33 -0700
committerChristopher Tate <ctate@google.com>2009-06-04 15:02:37 -0700
commit1885b37913181230c36d6485bdd389f89fa90f43 (patch)
tree285579b79592713e35b8137efe8da85fdf8d0c53
parentb640da8fcbc63821dfca1ab92f038771a2bf0ab9 (diff)
downloadframeworks_base-1885b37913181230c36d6485bdd389f89fa90f43.zip
frameworks_base-1885b37913181230c36d6485bdd389f89fa90f43.tar.gz
frameworks_base-1885b37913181230c36d6485bdd389f89fa90f43.tar.bz2
Fix backup agent unbind
The handwritten binder transaction passing wasn't propagating the agent-destroy transaction to the client side. Oops. Also, remove obsolete run-one-agent code from the backup manager service.
-rw-r--r--core/java/android/app/ApplicationThreadNative.java8
-rw-r--r--services/java/com/android/server/BackupManagerService.java41
2 files changed, 9 insertions, 40 deletions
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
index e28fd0f..6750d12 100644
--- a/core/java/android/app/ApplicationThreadNative.java
+++ b/core/java/android/app/ApplicationThreadNative.java
@@ -350,6 +350,14 @@ public abstract class ApplicationThreadNative extends Binder
scheduleCreateBackupAgent(appInfo, backupMode);
return true;
}
+
+ case SCHEDULE_DESTROY_BACKUP_AGENT_TRANSACTION:
+ {
+ data.enforceInterface(IApplicationThread.descriptor);
+ ApplicationInfo appInfo = ApplicationInfo.CREATOR.createFromParcel(data);
+ scheduleDestroyBackupAgent(appInfo);
+ return true;
+ }
}
return super.onTransact(code, data, reply, flags);
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index b003e76..5770a77 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -197,7 +197,6 @@ class BackupManagerService extends IBackupManager.Stub {
// WARNING: If we crash after this line, anything in mPendingBackups will
// be lost. FIX THIS.
}
- //startOneAgent();
(new PerformBackupThread(mTransportId, mBackupQueue)).run();
break;
@@ -207,45 +206,6 @@ class BackupManagerService extends IBackupManager.Stub {
}
}
- void startOneAgent() {
- // Loop until we find someone to start or the queue empties out.
- while (true) {
- BackupRequest request;
- synchronized (mQueueLock) {
- int queueSize = mBackupQueue.size();
- Log.d(TAG, "mBackupQueue.size=" + queueSize);
- if (queueSize == 0) {
- mBackupQueue = null;
- // if there are pending backups, start those after a short delay
- if (mPendingBackups.size() > 0) {
- mBackupHandler.sendEmptyMessageDelayed(MSG_RUN_BACKUP, COLLECTION_INTERVAL);
- }
- return;
- }
- request = mBackupQueue.get(0);
- // Take it off the queue when we're done.
- }
-
- Log.d(TAG, "starting agent for " + request);
- // !!! TODO: need to handle the restore case?
- int mode = (request.fullBackup)
- ? IApplicationThread.BACKUP_MODE_FULL
- : IApplicationThread.BACKUP_MODE_INCREMENTAL;
- try {
- if (mActivityManager.bindBackupAgent(request.appInfo, mode)) {
- Log.d(TAG, "awaiting agent for " + request);
- // success
- return;
- }
- } catch (RemoteException e) {
- // can't happen; activity manager is local
- } catch (SecurityException ex) {
- // Try for the next one.
- Log.d(TAG, "error in bind", ex);
- }
- }
- }
-
void processOneBackup(BackupRequest request, IBackupAgent agent, IBackupTransport transport) {
final String packageName = request.appInfo.packageName;
Log.d(TAG, "processOneBackup doBackup() on " + packageName);
@@ -290,6 +250,7 @@ class BackupManagerService extends IBackupManager.Stub {
// Now propagate the newly-backed-up data to the transport
if (success) {
+ if (DEBUG) Log.v(TAG, "doBackup() success; calling transport");
backupData =
ParcelFileDescriptor.open(backupDataName, ParcelFileDescriptor.MODE_READ_ONLY);
int error = transport.performBackup(packageName, backupData);