Home | History | Annotate | Download | only in backup

Lines Matching full:restore

228     // Timeout intervals for agent backup & restore operations
235 // User confirmation timeout for a full backup/restore operation. It's this long in
298 // A similar synchronization mechanism around clearing apps' data for restore
400 public int pmToken; // in post-install restore, the PM's token for this transaction
405 * Restore a single package; no kill after restore
420 * Restore at install: PM token needed, kill after restore
435 * Restore everything possible. This is the form that Setup Wizard or similar
436 * restore UXes use.
451 * Restore some set of packages. Leave this one up to the caller to specify
452 * whether it's to be considered a system-level restore.
662 // ----- Asynchronous backup/restore handler thread -----
767 // similar to normal backup/restore.
800 // TODO: refactor full restore to be a looper-based state machine
801 // similar to normal backup/restore.
806 (new Thread(task, "adb-restore")).start();
870 Slog.e(TAG, "Restore observer threw", e);
893 // Client app left the restore session dangling. We know that it
894 // can't be in the middle of an actual restore operation because
895 // the timeout is suspended while a restore is in progress. Clean
897 Slog.w(TAG, "Restore session timed out; aborting");
911 Slog.i(TAG, "Full backup/restore timed out waiting for user confirmation");
975 // spin up the backup/restore handler thread
2104 // the Activity Manager to launch the app for backup/restore purposes.
2306 // Get the restore-set token for the best-available restore set for this package:
2326 // Interface and methods used by the asynchronous-with-timeout backup/restore operations
3136 // ----- Full backup/restore to a file/socket -----
3195 Slog.w(TAG, "Unable to restore OBBs for " + pkgName, e);
4560 // ----- Restore infrastructure -----
4602 // TODO: abstract restore state and APIs
4605 // ----- Full restore from a file/socket -----
4607 // Description of a file in the restore datastream
4637 // Full restore engine, used by both adb restore and transport-based full restore
4660 // possible handling states for a given package in the restore dataset
4687 // invocations of the full restore API asynchronously
4704 // before proceeding to do the restore.
4736 Slog.w(TAG, "Restore engine used after halting");
4835 // one file not-okay without changing the restore
4843 // the restore policy from the manifest. Ignore the
4872 // restore.
4874 if (DEBUG) Slog.d(TAG, "Clearing app data preparatory to full restore");
4915 // restore data as well as a pipe for sending data to
4931 if (MORE_DEBUG) Slog.d(TAG, "Invoking agent to restore file "
4941 new Thread(runner, "restore-sys-runner").start();
4949 // couldn't dup the socket for a process-local restore
4950 Slog.d(TAG, "Couldn't establish restore");
4956 Slog.e(TAG, "Agent crashed during full restore");
4964 Slog.v(TAG, " copying to restore agent: "
4984 Slog.e(TAG, "Failed to write to restore pipe", e);
5000 // it by ignoring the rest of the restore on it
5002 Slog.w(TAG, "Agent failure; ending restore");
5009 // If this was a single-package restore, we halt immediately
5037 if (DEBUG) Slog.w(TAG, "io exception on restore socket read", e);
5194 Slog.w(TAG, "Restore stream claimed to include apk for "
5205 Slog.w(TAG, "Restore stream contains apk of package "
5206 + info.packageName + " but it disallows backup/restore");
5213 // don't restore any of the file data.
5222 + " signatures do not match restore manifest");
5337 throw new IOException("Restore manifest too big; corrupt? size=" + info.size);
5388 // Restore system-uid-space packages only if they have
5420 Slog.w(TAG, "Restore manifest signatures do not match "
5428 if (DEBUG) Slog.i(TAG, "Restore manifest from "
5433 // the restore properly only if the dataset provides the
5445 restore package " + info.packageName
5454 + " but restore manifest claims " + manifestPackage);
5457 Slog.i(TAG, "Unknown restore manifest version " + version
5461 Slog.w(TAG, "Corrupt restore manifest for package " + info.packageName);
5790 Slog.w(TAG, "full restore observer went away: startRestore");
5802 Slog.w(TAG, "full restore observer went away: restorePackage");
5813 Slog.w(TAG, "full restore observer went away: endRestore");
5837 // possible handling states for a given package in the restore dataset
5885 // before proceeding to do the restore.
5903 Slog.i(TAG, "--- Performing full-dataset restore ---");
5907 // Are we able to restore shared-storage data?
5961 Slog.w(TAG, "Invalid restore data; aborting.");
5975 Slog.e(TAG, "Unable to read restore input");
5985 Slog.w(TAG, "Close of restore data pipe threw", e);
5997 Slog.d(TAG, "Full restore pass complete.");
6101 Slog.w(TAG, "Can't parse restore data header");
6190 // one file not-okay without changing the restore
6198 // the restore policy from the manifest. Ignore the
6230 // restore.
6232 if (DEBUG) Slog.d(TAG, "Clearing app data preparatory to full restore");
6271 // restore data as well as a pipe for sending data to
6287 if (DEBUG) Slog.d(TAG, "Invoking agent to restore file "
6297 new Thread(runner, "restore-sys-runner").start();
6305 // couldn't dup the socket for a process-local restore
6306 Slog.d(TAG, "Couldn't establish restore");
6312 Slog.e(TAG, "Agent crashed during full restore");
6336 Slog.e(TAG, "Failed to write to restore pipe", e);
6352 // it by ignoring the rest of the restore on it
6380 if (DEBUG) Slog.w(TAG, "io exception on restore socket read", e);
6420 if (DEBUG) Slog.d(TAG, "Not killing after full restore");
6542 Slog.w(TAG, "Restore stream claimed to include apk for "
6553 Slog.w(TAG, "Restore stream contains apk of package "
6554 + info.packageName + " but it disallows backup/restore");
6561 // don't restore any of the file data.
6570 + " signatures do not match restore manifest");
6682 throw new IOException("Restore manifest too big; corrupt? size=" + info.size);
6729 // Restore system-uid-space packages only if they have
6754 Slog.w(TAG, "Restore manifest signatures do not match "
6762 if (DEBUG) Slog.i(TAG, "Restore manifest from "
6767 // the restore properly only if the dataset provides the
6775 Slog.i(TAG, "Cannot restore package " + info.packageName
6784 + " but restore manifest claims " + manifestPackage);
6787 Slog.i(TAG, "Unknown restore manifest version " + version
6791 Slog.w(TAG, "Corrupt restore manifest for package " + info.packageName);
7079 Slog.w(TAG, "full restore observer went away: startRestore");
7091 Slog.w(TAG, "full restore observer went away: restorePackage");
7102 Slog.w(TAG, "full restore observer went away: endRestore");
7109 // ----- Restore handling -----
7117 // If the target resides on the system partition, we allow it to restore
7118 // data from the like-named package in a restore set even if the signatures
7188 // If the target resides on the system partition, we allow it to restore
7189 // data from the like-named package in a restore set even if the signatures
7232 // Used by both incremental and full restore
7239 // NEW UNIFIED RESTORE IMPLEMENTATION
7242 // states of the unified-restore state machine
7253 // Transport we're working with to do the restore
7259 // Restore observer; may be null
7265 // When this is a restore-during-install, this is the token identifying the
7270 // Is this a whole-system restore, i.e. are we establishing a new ancestral
7271 // dataset to base future restore-at-install operations from?
7274 // If this is a single-package restore, what package are we interested in?
7277 // In all cases, the calculated list of packages that we are trying to restore
7283 // Currently-bound backup agent for restore + restoreFinished purposes
7286 // What sort of restore we're doing now
7292 // Widget-related data handled as part of this restore operation
7319 // releasing it at the end of the restore operation.
7335 // Single package restore
7346 Slog.i(TAG, "Full restore; asking about " + filterSet.length + " apps");
7393 Slog.v(TAG, "Restore; accept set size is " + mAcceptSet.size());
7412 if (MORE_DEBUG) Slog.v(TAG, "*** Executing restore step " + mState);
7448 * dataset & transport to address, and then parameters within the restore
7454 * 1a [if we needed @pm@ then nextRestorePackage() and restore the PMBA inline]
7461 * 4. does the metadata for this package allow us to restore it?
7462 * does the on-disk app permit us to restore it? [re-check allowBackup etc]
7463 * 5. is this a key/value dataset? => key/value agent restore
7467 * 5c. call into agent to perform restore
7473 * 6a. instantiate the engine for a stream restore: engine handles agent lifecycles
7486 // state INITIAL : set up for the restore and read the metadata if necessary
7490 // If we're starting a full-system restore, set up to begin widget ID remapping
7507 Slog.e(TAG, "Transport error " + mStatus + "; no restore possible");
7515 Slog.e(TAG, "No restore metadata available; halting");
7527 // Pull the Package Manager metadata from the restore set first
7533 Slog.v(TAG, "initiating restore for PMBA");
7547 // the restore operation.
7549 Slog.e(TAG, "No restore metadata available, so not restoring");
7552 "Package manager restore metadata missing");
7564 Slog.e(TAG, "Unable to contact transport for restore");
7588 Slog.v(TAG, "No more packages; finishing restore");
7597 Slog.i(TAG, "Next restore package: " + mRestoreDescription);
7614 // Whoops, we thought we could restore this package but it
7626 // handle this case, we do not attempt the restore.
7644 + " restore version [" + metaInfo.versionCode
7656 // Unknown restore type; ignore this package and move on
7657 Slog.e(TAG, "Unrecognized restore type " + type);
7662 Slog.e(TAG, "Can't get next target from transport; ending restore");
7671 // state RESTORE_KEYVALUE : restore one package via key/value API set
7673 // Initiating the restore will pass responsibility for the state machine's
7678 // only to the key/value restore API flow
7707 "Restore agent missing");
7712 // And then finally start the restore on this agent
7717 Slog.e(TAG, "Error when attempting restore: " + e.toString());
7723 // Guts of a key/value restore operation
7730 mBackupDataName = new File(mDataDir, packageName + ".restore");
7745 // Run the transport's restore pass
7757 // terminate the restore operation.
7758 Slog.e(TAG, "Error getting restore data for " + packageName);
7806 // Okay, we have the data. Now have the agent do the restore.
7816 // Kick off the restore, checking for hung agents. The timeout or
7823 Slog.e(TAG, "Unable to call app for restore: " + packageName, e);
7828 // After a restore failure we go back to running the queue. If there
7835 // state RESTORE_FULL : restore one package via streaming engine
7845 // backup looper, and the overall unified restore task resumes
7849 Slog.i(TAG, "Spinning threads for stream restore of "
7854 // At this point the feeder is responsible for advancing the restore
7859 // so we can do that simply by going back to running the restore queue.
7860 Slog.e(TAG, "Unable to construct pipes for stream restore!");
7872 // next restore state, so we're done
7875 Slog.e(TAG, "Unable to finalize restore of " + packageName);
7920 new Thread(eThread, "unified-restore-engine").start();
7927 // The transport wrote this many bytes of restore data to the
7948 Slog.i(TAG, "Got clean full-restore EOF for "
7956 Slog.e(TAG, "Error " + result + " streaming restore for "
7965 // but potentially recoverable; abandon this package's restore but
7966 // carry on with the next restore target.
7967 Slog.e(TAG, "Unable to route data for restore");
7975 Slog.e(TAG, "Transport failed during restore");
7999 // Clean finish means we issue the restore-finished callback
8063 if (MORE_DEBUG) Slog.d(TAG, "finishing restore mObserver=" + mObserver);
8068 Slog.e(TAG, "Error finishing restore", e);
8076 Slog.d(TAG, "Restore observer died at restoreFinished");
8091 // We were invoked via an active restore session, not by the Package
8100 // If this was a full-system restore, record the ancestral
8109 Slog.i(TAG, "Restore complete.");
8114 // If the agent fails restore, it might have put the app's data
8155 // full-system restores: when a single app has requested a restore,
8159 // 1. the app did not request its own restore (mTargetPackage == null), and either
8168 if (DEBUG) Slog.d(TAG, "Restore complete, killing host process of "
8190 Slog.i(TAG, "operationComplete() during restore: target="
8199 // additional restore-finished callback so we bypass that and go
8207 // the restore itself. We now have to send the same agent its
8220 // Just go back to running the restore queue
8225 // the app as part of the restore-time work.
8237 Slog.e(TAG, "Unexpected restore callback into state " + mState);
8252 mCurrentPackage.packageName, "restore timeout");
8266 // restore observer support
8272 Slog.w(TAG, "Restore observer went away: startRestore");
8284 Slog.d(TAG, "Restore observer died in onUpdate");
8296 Slog.w(TAG, "Restore observer went away: endRestore");
8680 throw new IllegalStateException("Restore supported only for the device owner");
8720 throw new IllegalStateException("Restore supported only for the device owner");
8729 Slog.i(TAG, "Full restore not permitted before setup");
8733 Slog.i(TAG, "Beginning full restore...");
8742 if (DEBUG) Slog.d(TAG, "Starting restore confirmation UI, token=" + token);
8744 Slog.e(TAG, "Unable to launch full restore confirmation");
8757 // wait for the restore to be performed
8758 if (DEBUG) Slog.d(TAG, "Waiting for full restore completion...");
8764 Slog.w(TAG, "Error trying to close fd after full restore: " + e);
8767 Slog.i(TAG, "Full restore processing complete.");
8810 // Confirm that the previously-requested full backup/restore operation can proceed. This
8846 Slog.w(TAG, "User rejected full backup/restore operation");
8851 Slog.w(TAG, "Attempted to ack full backup/restore with invalid token");
8910 // Enable/disable automatic restore of app data at install time
8915 Slog.i(TAG, "Auto restore => " + doAutoRestore);
9119 // An application being installed will need a restore pass, then the Package Manager
9120 // will need to be told when the restore is finished.
9124 + " attemping install-time restore");
9135 if (MORE_DEBUG) Slog.i(TAG, "No restore set");
9155 // okay, we're going to attempt a restore of this package from this restore set.
9157 // steps for 'token' will be issued from the restore handling code.
9164 Slog.d(TAG, "Restore at install of " + packageName);
9178 // Auto-restore disabled or no way to attempt a restore; just tell the Package
9187 // Hand off a restore session
9201 Slog.w(TAG, "Asked to restore nonexistent pkg " + packageName);
9223 Slog.d(TAG, "Restore session requested but one already active");
9235 Slog.e(TAG, "ending non-current restore session");
9237 if (DEBUG) Slog.v(TAG, "Clearing restore session and halting timeout");
9245 // completed the given outstanding asynchronous backup/restore operation.
9268 // ----- Restore session -----
9297 throw new IllegalStateException("Restore session already ended");
9308 Slog.w(TAG, "Null transport getting restore sets");
9339 throw new IllegalStateException("Restore session already ended");
9348 Slog.e(TAG, "Ignoring restoreAll() with no restore set");
9362 Slog.e(TAG, "Unable to contact transport for restore");
9369 // Real work, so stop the session timeout until we finalize the restore
9387 Slog.w(TAG, "Restore token " + Long.toHexString(token) + " not found");
9421 throw new IllegalStateException("Restore session already ended");
9430 Slog.e(TAG, "Ignoring restoreAll() with no restore set");
9444 Slog.e(TAG, "Unable to contact transport for restore");
9451 // Stop the session timeout until we finalize the restore
9469 Slog.w(TAG, "Restore token " + Long.toHexString(token) + " not found");
9477 throw new IllegalStateException("Restore session already ended");
9487 Slog.e(TAG, "Ignoring attempt to restore pkg=" + packageName
9497 Slog.w(TAG, "Asked to restore nonexistent pkg " + packageName);
9509 throw new SecurityException("No permission to restore other packages");
9512 // So far so good; we're allowed to try to restore this package.
9534 Slog.e(TAG, "Unable to contact transport for restore");
9538 // Stop the session timeout until we finalize the restore
9541 // Ready to go: enqueue the restore request and claim success
9555 // Posted to the handler to tear down a restore session in a cleanly synchronized way
9587 throw new IllegalStateException("Restore session already ended");
9633 pw.println("Auto-restore is " + (mAutoRestore ? "enabled" : "disabled"));