am e9821bf2: Merge "DO NOT MERGE - Don\'t hang installs if the transport disappears" into klp-dev

* commit 'e9821bf2380bfa325e6398a6390a4083007d3006':
  DO NOT MERGE - Don't hang installs if the transport disappears
This commit is contained in:
Christopher Tate
2014-03-11 17:37:06 +00:00
committed by Android Git Automerger

View File

@ -5784,19 +5784,25 @@ class BackupManagerService extends IBackupManager.Stub {
return; return;
} }
boolean skip = false;
long restoreSet = getAvailableRestoreToken(packageName); long restoreSet = getAvailableRestoreToken(packageName);
if (DEBUG) Slog.v(TAG, "restoreAtInstall pkg=" + packageName if (DEBUG) Slog.v(TAG, "restoreAtInstall pkg=" + packageName
+ " token=" + Integer.toHexString(token) + " token=" + Integer.toHexString(token)
+ " restoreSet=" + Long.toHexString(restoreSet)); + " 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?
// Do we have a transport to fetch data for us? IBackupTransport transport = getTransport(mCurrentTransport);
IBackupTransport transport = getTransport(mCurrentTransport); if (transport == null) {
if (transport == null) { if (DEBUG) Slog.w(TAG, "No transport");
if (DEBUG) Slog.w(TAG, "No transport for install-time restore"); skip = true;
return; }
}
if (!skip && mAutoRestore && mProvisioned) {
try { try {
// okay, we're going to attempt a restore of this package from this restore set. // 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 // The eventual message back into the Package Manager to run the post-install
@ -5818,12 +5824,15 @@ class BackupManagerService extends IBackupManager.Stub {
mBackupHandler.sendMessage(msg); mBackupHandler.sendMessage(msg);
} catch (RemoteException e) { } catch (RemoteException e) {
// Binding to the transport broke; back off and proceed with the installation. // 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 // 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. // 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 { try {
mPackageManagerBinder.finishPackageInstall(token); mPackageManagerBinder.finishPackageInstall(token);
} catch (RemoteException e) { /* can't happen */ } } catch (RemoteException e) { /* can't happen */ }