Add single-package restore from an app's most-recent data

Renamed the RestoreSession performRestore() method to restoreAll(), and
added a new restorePackage() method that only restores the single
specified app.  In order to restore an app other than itself, the
caller must hold the android.permission.BACKUP permission.

This change also introduces dataset tracking:  the Backup Manager
persistently remembers both the current backup dataset's identity
and that of the "ancestral" dataset, i.e. the one most recently used
for a whole-device restore such as performed by SetupWizard.  When a
single package is restored via restorePackage(), the selection of
most-recent dataset to use is this:

1. The data from the currently-active backup dataset, if such exists.
   An app that has ever backed up data will therefore get its last-
   known-good data.

2. The app's data from the ancestral dataset, if such exists.  This
   covers the case of a factory reset followed by reinstallation of
   an app at a later time.  The app had not yet backed anything up
   post-wipe, but the old data is in the ancestral dataset and should
   be brought forward when the app reappears.

3. If neither 1. nor 2. exist, there is no data to restore, so just
   skip it and return failure.

Note that the infrastructure to automatically attempt a restore after
an application has been installed does not yet exist; that's coming.

Change-Id: I0ba170df9885128000c46ed28d3dddda3a63a143
4 files changed