Updating backup restore logic

> Adding DeviceProfile information in the backup
> Removing SharedPreference backup
> Adding helper methods to abort backup in the middle
> Comparing keys against the backup journal during restore
to avoid restoring corrupt/lost entries
> Old backups are still compatible, but lost keys verification
will be ignored in that case.

Bug: 17937935
Bug: 17951775
Bug: 17260941
Change-Id: Iad48646cfdd69abaff5c163b2055f3b8a9b39b19
diff --git a/protos/backup.proto b/protos/backup.proto
index 7ba2937..8ae1752 100644
--- a/protos/backup.proto
+++ b/protos/backup.proto
@@ -37,12 +37,36 @@
   required int64 checksum = 2;
 }
 
+message DeviceProfieData {
+  required float desktop_rows = 1;
+  required float desktop_cols = 2;
+  required float hotseat_count = 3;
+  required int32 allapps_rank = 4;
+}
+
 message Journal {
   required int32 app_version = 1;
+
+  // Time when the backup was created
   required int64 t = 2;
+
+  // Total bytes written during the last backup
+  // OBSOLETE: A state may contain entries which are already present in the backup
+  // and were not written in the last backup
   optional int64 bytes = 3;
+
+  // Total entries written during the last backup
+  // OBSOLETE: A state may contain entries which are already present in the backup
+  // and were not written in the last backup
   optional int32 rows = 4;
+
+  // Valid keys for this state
   repeated Key key = 5;
+
+  // Backup format version.
+  optional int32 backup_version = 6 [default = 1];
+
+  optional DeviceProfieData profile = 7;
 }
 
 message Favorite {