Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83b607a3 authored by Christopher Tate's avatar Christopher Tate Committed by Android (Google) Code Review
Browse files

Merge "Don't hang installs if the transport disappears"

parents 8bc1868a 5c38516e
Loading
Loading
Loading
Loading
+19 −10
Original line number Diff line number Diff line
@@ -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;
            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 */ }