diff options
author | Dan Egnor <egnor@google.com> | 2009-06-26 13:20:02 -0700 |
---|---|---|
committer | Dan Egnor <egnor@google.com> | 2009-06-26 13:25:27 -0700 |
commit | 156411df4627336b246db78cddca8248ed615b67 (patch) | |
tree | e0aab41ac43c870e5c464b297418034a50e47d93 | |
parent | 040441fa992bcfc11070d559bfceeb039667b382 (diff) | |
download | frameworks_base-156411df4627336b246db78cddca8248ed615b67.zip frameworks_base-156411df4627336b246db78cddca8248ed615b67.tar.gz frameworks_base-156411df4627336b246db78cddca8248ed615b67.tar.bz2 |
Use a long for restore token
-rw-r--r-- | cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java | 4 | ||||
-rw-r--r-- | core/java/android/backup/IRestoreSession.aidl | 2 | ||||
-rw-r--r-- | services/java/com/android/server/BackupManagerService.java | 20 |
3 files changed, 12 insertions, 14 deletions
diff --git a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java index 68caa26..c299bff 100644 --- a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java +++ b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java @@ -205,9 +205,9 @@ public final class Bmgr { } private void doRestore() { - int token; + long token; try { - token = Integer.parseInt(nextArg()); + token = Long.parseLong(nextArg()); } catch (NumberFormatException e) { showUsage(); return; diff --git a/core/java/android/backup/IRestoreSession.aidl b/core/java/android/backup/IRestoreSession.aidl index ac01c2d..2a1fbc1 100644 --- a/core/java/android/backup/IRestoreSession.aidl +++ b/core/java/android/backup/IRestoreSession.aidl @@ -45,7 +45,7 @@ interface IRestoreSession { * @param observer If non-null, this binder points to an object that will receive * progress callbacks during the restore operation. */ - int performRestore(int token, IRestoreObserver observer); + int performRestore(long token, IRestoreObserver observer); /** * End this restore session. After this method is called, the IRestoreSession binder diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java index bc2eaed..bbebba3 100644 --- a/services/java/com/android/server/BackupManagerService.java +++ b/services/java/com/android/server/BackupManagerService.java @@ -138,10 +138,12 @@ class BackupManagerService extends IBackupManager.Stub { private class RestoreParams { public IBackupTransport transport; public IRestoreObserver observer; + public long token; - RestoreParams(IBackupTransport _transport, IRestoreObserver _obs) { + RestoreParams(IBackupTransport _transport, IRestoreObserver _obs, long _token) { transport = _transport; observer = _obs; + token = _token; } } @@ -347,9 +349,8 @@ class BackupManagerService extends IBackupManager.Stub { case MSG_RUN_RESTORE: { - int token = msg.arg1; RestoreParams params = (RestoreParams)msg.obj; - (new PerformRestoreThread(params.transport, params.observer, token)).start(); + (new PerformRestoreThread(params.transport, params.observer, params.token)).start(); break; } } @@ -761,7 +762,7 @@ class BackupManagerService extends IBackupManager.Stub { class PerformRestoreThread extends Thread { private IBackupTransport mTransport; private IRestoreObserver mObserver; - private int mToken; + private long mToken; private RestoreSet mImage; private File mStateDir; @@ -776,7 +777,7 @@ class BackupManagerService extends IBackupManager.Stub { } PerformRestoreThread(IBackupTransport transport, IRestoreObserver observer, - int restoreSetToken) { + long restoreSetToken) { mTransport = transport; mObserver = observer; mToken = restoreSetToken; @@ -847,9 +848,7 @@ class BackupManagerService extends IBackupManager.Stub { } } - // STOPSHIP TODO: pick out the set for this token (instead of images[0]) - long token = images[0].token; - if (!mTransport.startRestore(token, restorePackages.toArray(new PackageInfo[0]))) { + if (!mTransport.startRestore(mToken, restorePackages.toArray(new PackageInfo[0]))) { // STOPSHIP TODO: Handle the failure somehow? Log.e(TAG, "Error starting restore operation"); return; @@ -1198,7 +1197,7 @@ class BackupManagerService extends IBackupManager.Stub { } } - public int performRestore(int token, IRestoreObserver observer) + public int performRestore(long token, IRestoreObserver observer) throws android.os.RemoteException { mContext.enforceCallingPermission("android.permission.BACKUP", "performRestore"); @@ -1206,8 +1205,7 @@ class BackupManagerService extends IBackupManager.Stub { for (int i = 0; i < mRestoreSets.length; i++) { if (token == mRestoreSets[i].token) { Message msg = mBackupHandler.obtainMessage(MSG_RUN_RESTORE); - msg.obj = new RestoreParams(mRestoreTransport, observer); - msg.arg1 = token; + msg.obj = new RestoreParams(mRestoreTransport, observer, token); mBackupHandler.sendMessage(msg); return 0; } |