summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/BackupManagerService.java
Commit message (Collapse)AuthorAgeFilesLines
...
* Temporarily rollback a change that's causing SetupWizard failures during ↵Amith Yamasani2009-08-071-0/+4
| | | | | | | restore. #2042337 Don't kill the process of the package that's being restored. This is causing a chain reaction of killing a provider needed by the setup process.
* Clear app data via the Activity Manager, not Package ManagerChristopher Tate2009-08-061-1/+5
| | | | | | This is because doing it through the Activity Manager also makes sure that the app has been shut down first, which is quite a desirable invariant for restore handling.
* Correct the backup manager's identity around wakelock useChristopher Tate2009-08-051-0/+4
|
* Bootstrap the ever-backed-up bookkeeping properlyChristopher Tate2009-08-041-26/+32
|
* Allow zero-length lists in EventLog entries.Dan Egnor2009-07-291-29/+37
| | | | | (I'm verifying that the consumers of EventLog -- logcat, checkin -- are OK with this.) Improve the error handling in RestoreSession.
* clean up error recovery; log events tracking backup activityDan Egnor2009-07-271-146/+188
|
* Backup manager should default to not "provisioned" so backups don't start ↵Joe Onorato2009-07-271-1/+1
| | | | | | until the setup wizard is done.
* Don't leave restore data lying around after the operationChristopher Tate2009-07-241-0/+2
|
* Need to be able to call the backup manager from the system process.Joe Onorato2009-07-231-8/+8
|
* Clean up when an attempted restore throwsChristopher Tate2009-07-201-0/+4
| | | | | | When a restore agent throws an exception back into the framework, assume that it may have left the app's data in an inconsistent state and clear the data for that app (again -- it was cleared just prior to the attempted restore, too).
* The rest of ever-backed-up trackingChristopher Tate2009-07-151-5/+71
| | | | | | | | | | | | | When a package is uninstalled we now remove our notion of its having been backed up, thereby forcing a backup pass if it is reinstalled at some point in the future. Removal from the log means rewriting it and doing an atomic rename to the canonical version. The temporary existence used during the rewrite is *not* written synchronously; there's no need and it keeps the load on the flash part much lower. Because we might crash & reboot in the middle of the rewrite operation, there's now code during init that sanity-checks the contents of the ever-backed-up log and ensures that it's in a coherent state.
* Ensure that everything gets backed up at least onceChristopher Tate2009-07-151-38/+111
| | | | | | | | | | | We now schedule a backup pass for any new application we see (at boot or package-install time) for which we have never performed a backup. The bookkeeping is a log file with the names of all the packages we've successfully completed a backup pass on, maintained with synchronous journal-type behavior. Also, make a bunch of private fields package-scoped to permit cheaper access from the various worker / binder threads that run under the Backup Manager's aegis.
* Grant adb the BACKUP permissionChristopher Tate2009-07-141-4/+0
| | | | | | This also means we should no longer do explicit calling-identity fiddling in dump(), relying instead on the usual permission enforcement mechanism to handle things.
* Don't NPE if a restore session is requested for an invalid transportChristopher Tate2009-07-131-1/+3
|
* Don't invoke the transport if doBackup supplied no dataChristopher Tate2009-07-081-9/+17
| | | | | | | | | If there's no data to be backed up, we no longer invoke the transport. We *DO* still require that the agent have emitted a valid new state file, however. This change also finally uncomments the code that removes the backup data file after it has been sent to the transport, so there will be no more packagename.data files lying around in the staging area.
* Remove a lot of debug-log verbosityChristopher Tate2009-07-071-12/+9
| | | | | We now log in dataChanged() only when an app is added to the backup set (and *not* if it redundantly asks to be added after it's already there) and on error.
* Only write to the pending-backup journal when necessaryChristopher Tate2009-07-071-4/+6
| | | | | | | We now only commit to the pending-backup journal on disk the first time that a given package is added to the backup set. This avoids a lot of write thrashing of the disk, particularly since Settings tends to call dataChanged() a great many times during boot, while the Settings UI is in use, etc.
* Fix the metadata-available test during restoreChristopher Tate2009-07-071-2/+1
|
* Make enable/provisioning of the backup service a two-step processChristopher Tate2009-07-061-6/+43
| | | | | | | | | | | | | | | This CL adds the concept of 'provisioned' to the backup manager. No backups will be scheduled until the user has indicated that backups are to be enabled *and* has clicked all the way through the setup wizard. When the user first turns on the backup system, the delay before the initial backup pass is different from the periodic backup interval. Currently that initial delay is 12 hours. The intent here is to guess at a less-active time for performing that first backup pass. NOTE: currently the backup service defaults to 'provisioned'. Once the real code goes live in Setup Wizard, this will be changed to default to not-provisioned until the user has confirmed all the relevant UI.
* Fix up permissions for 'dumpsys backup'Christopher Tate2009-07-061-1/+6
|
* Hold a wakelock during backup/restore/clear operationsChristopher Tate2009-07-061-39/+78
| | | | | | | | | | | | | We need to make sure we stay alive for the duration of a backup or (especially) restore operation. The existing Handler-based timing system was simply not properly functional, so it's been retooled to use a repeating alarm delivering a broastcast PendingIntent to our registered receiver. We acquire a partial wake lock in the broadcast receiver [i.e. while the Alarm Manager is holding one for the duration of broadcast delivery] and pass the wakelock object to the backup thread, which eventually releases it when it's finsihed operations. A similar pattern is used for the threads handling restore and clear.
* If we can't get the restore set's metadata, don't continueChristopher Tate2009-07-021-0/+9
| | | | | | | Without the metadata we can't verify the version number or the signatures of the apps whose data we'd be trying to restore against the apps present on device. This is not acceptable; we need to refuse to give data to an unauthenticated app.
* Clean up the last two literal permission string usagesChristopher Tate2009-07-021-2/+3
|
* Add a "clear backed-up data" method to the backup mechanismChristopher Tate2009-07-021-0/+95
| | | | | | | | | | It's now possible to ask that the backup manager wipe the saved data for a given application from the backing store. LocalTransport implements this now but the Google backend does not yet. When the data is wiped, the on-device backup state is also wiped to ensure that the next backup pushes all necessary data. Bmgr has not yet been modified to actually call into this method, but it will be soon.
* Move backup state to settings, change permission checks to use symbol.Dianne Hackborn2009-07-011-29/+20
| | | | | | | | | | This changes the backup service to use the settings provider instead of system properties, correspondingly making it off by default and allowing specific devices to define the transport. Also tweaks the permission checks to use the permission symbol instead of raw strings. This requires some corresponding changes in the vendor projects.
* Less logging in some places. More in others.Joe Onorato2009-07-011-2/+13
|
* Revamp backup scheduling policyChristopher Tate2009-07-011-41/+56
| | | | | | | | | | | | We now schedule a periodic check of pending backups; if any apps have requested a backup since the last check, we perform all of the pending backups. The periodic backup scheduling matches the enable/disable state of the backup manager; while backups are disabled entirely there are no periodic wakeups. The period is set here to one hour. If an external caller (transport, the 'bmgr' command line tool, etc) requests an immediate backup pass, that is performed and then the periodic backup check is rescheduled using that pass as the starting point of a new interval.
* Use secure settings for backup enable / transport selectionChristopher Tate2009-07-011-10/+19
|
* Run backups at background priorityChristopher Tate2009-06-301-0/+3
|
* Implement persistent enable/disable of the backup managerChristopher Tate2009-06-291-14/+54
| | | | | | | | | Backup & restore is still enabled by default, but with the expectation that it will be enabled during the course of the Setup Wizard or some other privileged entity that has notified the user about the ramifications. While disabled, data-changed notices will still be collected, but no backup pass will be scheduled. When the backup manager is later enabled, any pending data-changed notices will then be processed and the apps invoked for backup.
* Use system properties to track the current transportChristopher Tate2009-06-261-35/+83
| | | | | | | | | | | | | | | This change retools the transport selection mechanism a fair bit. Transports are now specified by name rather than by numeric ID, and the name of the currently selected transport is stored in a persistent system property under the name "persist.service.bkup.trans". The name -> IBackupTransport translation is now handled by maintaining a map from the names to the live IBackupTransport objects that correspond. The Google transport service observer now registers and unregisters the transport as the service goes up and down. The bmgr command has been expanded to include real transport interrogation and selection by name, and some documentation has been written for it.
* Respect android:allowClearUserData=false during restoreChristopher Tate2009-06-261-0/+13
| | | | | | | Ordinarily we wipe the data of apps we are restoring. This is problematic for packages that expect that their data can never be wiped back to nothing, especially system packages, so we now respect the android:allowClearUserData manifest attribute.
* Trim some superfluous imports.Christopher Tate2009-06-261-3/+0
|
* Use a long for restore tokenDan Egnor2009-06-261-11/+9
|
* Add a new IRestoreObserver callback class to the restore processChristopher Tate2009-06-251-6/+58
| | | | | | | | The observer is told when restore begins how many packages are being restored. It then gets an onUpdate() call telling it that the Nth package is now undergoing restore. Ultimately, its restoreFinished() callback is invoked, passing a simple success/fail error code, to let it know that the restore operation has concluded.
* Keep track of backup state independently for each transportChristopher Tate2009-06-251-37/+35
| | | | | | | | | | | | | Backup transports now provide the Backup Manager with a suggested name with which it can disambiguate any transport-specific bookkeeping that it needs to maintain. The Manager keeps separate application backup 'state blobs' for each transport now, preventing things from getting out of step if the device is switched among multiple transports. Also, the metadata backup agent is always invoked now on each backup pass. This is cheap when there is nothing to do, but also strongly ensures that we never wind up in a situation where a given transport destination has not been given all of the metadata necessary for the backup set.
* Switch the default transport to GOOGLE.Dan Egnor2009-06-251-2/+1
|
* Start backing up wallpaperChristopher Tate2009-06-241-3/+3
| | | | | | | | | | | | | | | | | | This CL does the following: + adds an AbsoluteFileBackupHelper class for managing backup of files known by absolute path, not based off of the app's getFilesDir() root + bumps up the collection interval from its testing-only default of 1 second to 3 minutes + adds a SystemBackupAgent class to the main system package and names it as the android:backupAgent for the main OS package. Right now this agent only backs up & restores the wallpaper file. + amend the Wallpaper Service to inform the Backup Manager when the wallpaper changes. On the subject of the 3-minute collection interval before the backup actually occurs: this can be short-circuited from an adb shell. Running the command 'bmgr run' will cause the Backup Manager to kick off any pending backup operations immediately.
* Modify the IBackupTransport API to support bulk restore operations.Dan Egnor2009-06-241-205/+172
| | | | Change the BackupManagerService and LocalTransport to support the new API.
* Pass the originating app's versionCode along with a restore setChristopher Tate2009-06-221-8/+22
| | | | | | | This change amends the doRestore() / onRestore() interface to backup agents to provide the integer android:versionCode of the app that stored the backup set. This should help agents figure out how to handle whatever historical data set they're handed at restore time.
* Add some global metadata to the restore setChristopher Tate2009-06-221-9/+19
| | | | | | | | | | | In addition to the signatures of each participating application, we now also store the versionCode of each backed-up package, plus the OS version running on the device that contributed the backup set. We also refuse to process a backup from a later OS revision to an earlier one, or from a later app version to an earlier. LocalTransport has been modified as well to be more resilient to changes in the system's use of metadata pseudopackages.
* Helper API cleanup. Allows multiple helpers to function,Joe Onorato2009-06-221-2/+2
| | | | | because they'll always go in the same order, and this lets us not have to write headers to keep them paired.
* Add app version to the backup metadataChristopher Tate2009-06-191-21/+28
| | | | | | | | | | We now record the version number of the app (drawn from its manifest versionCode attribute) along with its signatures. At restore time, we compare the version associated with the restore set with the version present on the device. If the restore set is from a newer version of the app than is present on device, we do not perform the restore operation. Also fix the pending-backup iteration in 'dumpsys backup'.
* Make signature checks on restore work with unsigned appsChristopher Tate2009-06-181-11/+14
|
* backup stuffJoe Onorato2009-06-181-0/+1
|
* Use signatures on restoreChristopher Tate2009-06-181-3/+57
| | | | | | | | | | On restore now, the backup manager gets the signature blocks corresponding to the restore set from the transport. It then validates those signatures against the on-device app signatures, and refuses to restore data to an app whose on-device sig block does not match the backup image's. Also actually implement 'bmgr transport N' so that we can select the local transport easily during runtime.
* Store the app signatures as part of the backup setChristopher Tate2009-06-181-7/+54
| | | | | | | | | | | Under a pseudo-app for the Package Manager, we store the app signatures for all participating applications installed on the device. At restore time we will restore this first, then ensure that the current on-device signature chain is compatible with the one in the backup set. If there's a mismatch, this may be a spoof attempt and we will refuse to restore that app's data. The restore side of this is not implemented, but the Package Manager agent is here as well as the backup side theoretically pushing the data now.
* Replace the stub GoogleTransport with callout to theDan Egnor2009-06-171-29/+48
| | | | | | GoogleTransportService (which lives in vendor/google). Use the Google transport by default. Also, fix a bug: Thread.run() != Thread.start()
* Hold the current transport instantiated all the time.Christopher Tate2009-06-161-22/+26
| | | | | | | | | We no longer instantiate the transport just for the duration of handling a backup or restore operation. Instead, we hold the object forever (replacing it if instructed to do so). This makes it easier for transports to watch system state and help set backup timing policy. Also fixes up the IBackupTransport documentation a bit.
* Allow privileged callers to schedule a backup pass for any app.Christopher Tate2009-06-161-2/+20
|