diff options
author | Christopher Tate <ctate@google.com> | 2014-03-03 12:03:09 -0800 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2014-03-03 12:03:09 -0800 |
commit | 5c38516e83f772fe04176f72f2ab7a1094e17430 (patch) | |
tree | d80c1fbf54725e80a7e53ceaf72ea11890aa71fa /services/backup | |
parent | 3651cb7b4a0c3c731905301e868cca1c3af5aa21 (diff) | |
download | frameworks_base-5c38516e83f772fe04176f72f2ab7a1094e17430.zip frameworks_base-5c38516e83f772fe04176f72f2ab7a1094e17430.tar.gz frameworks_base-5c38516e83f772fe04176f72f2ab7a1094e17430.tar.bz2 |
Don't hang installs if the transport disappears
Bug 12991308
Change-Id: Ie5d3d27fe565dd4014976f5333e37b5707acb707
Diffstat (limited to 'services/backup')
-rw-r--r-- | services/backup/java/com/android/server/backup/BackupManagerService.java | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java index 186ae1b..8eaefef 100644 --- a/services/backup/java/com/android/server/backup/BackupManagerService.java +++ b/services/backup/java/com/android/server/backup/BackupManagerService.java @@ -5803,19 +5803,25 @@ public class BackupManagerService extends IBackupManager.Stub { return; } + boolean skip = false; + long restoreSet = getAvailableRestoreToken(packageName); if (DEBUG) Slog.v(TAG, "restoreAtInstall pkg=" + packageName + " token=" + Integer.toHexString(token) + " restoreSet=" + Long.toHexString(restoreSet)); + if (restoreSet == 0) { + if (MORE_DEBUG) Slog.i(TAG, "No restore set"); + skip = true; + } - if (mAutoRestore && mProvisioned && restoreSet != 0) { - // Do we have a transport to fetch data for us? - IBackupTransport transport = getTransport(mCurrentTransport); - if (transport == null) { - if (DEBUG) Slog.w(TAG, "No transport for install-time restore"); - return; - } + // Do we have a transport to fetch data for us? + IBackupTransport transport = getTransport(mCurrentTransport); + if (transport == null) { + if (DEBUG) Slog.w(TAG, "No transport"); + skip = true; + } + if (!skip && mAutoRestore && mProvisioned) { try { // okay, we're going to attempt a restore of this package from this restore set. // The eventual message back into the Package Manager to run the post-install @@ -5837,12 +5843,15 @@ public class BackupManagerService extends IBackupManager.Stub { mBackupHandler.sendMessage(msg); } catch (RemoteException e) { // Binding to the transport broke; back off and proceed with the installation. - Slog.e(TAG, "Unable to contact transport for install-time restore"); + Slog.e(TAG, "Unable to contact transport"); + skip = true; } - } else { + } + + if (skip) { // Auto-restore disabled or no way to attempt a restore; just tell the Package // Manager to proceed with the post-install handling for this package. - if (DEBUG) Slog.v(TAG, "No restore set -- skipping restore"); + if (DEBUG) Slog.v(TAG, "Skipping"); try { mPackageManagerBinder.finishPackageInstall(token); } catch (RemoteException e) { /* can't happen */ } |