Increment version number and add check for presence of post-dial

Increment the version number to 1004 and only load the post-dial digits
from backup if the version number is >= 1004.

Bug: 25861157
Change-Id: I7ccbc3bd50ba07382714528a4a7fc01e47234716
diff --git a/src/com/android/calllogbackup/CallLogBackupAgent.java b/src/com/android/calllogbackup/CallLogBackupAgent.java
index bcd3c82..9aa20ea 100644
--- a/src/com/android/calllogbackup/CallLogBackupAgent.java
+++ b/src/com/android/calllogbackup/CallLogBackupAgent.java
@@ -67,7 +67,7 @@
         long date;
         long duration;
         String number;
-        String postDialDigits;
+        String postDialDigits = "";
         int type;
         int numberPresentation;
         String accountComponentName;
@@ -103,7 +103,7 @@
 
     /** Current version of CallLogBackup. Used to track the backup format. */
     @VisibleForTesting
-    static final int VERSION = 1003;
+    static final int VERSION = 1004;
     /** Version indicating that there exists no previous backup entry. */
     @VisibleForTesting
     static final int VERSION_NO_PREVIOUS_STATE = 0;
@@ -331,7 +331,6 @@
                 call.date = dataInput.readLong();
                 call.duration = dataInput.readLong();
                 call.number = readString(dataInput);
-                call.postDialDigits = readString(dataInput);
                 call.type = dataInput.readInt();
                 call.numberPresentation = dataInput.readInt();
                 call.accountComponentName = readString(dataInput);
@@ -341,10 +340,6 @@
                 call.features = dataInput.readInt();
             }
 
-            if (version >= 1003) {
-                call.addForAllUsers = dataInput.readInt();
-            }
-
             if (version >= 1002) {
                 String namespace = dataInput.readUTF();
                 int length = dataInput.readInt();
@@ -360,6 +355,14 @@
                 }
             }
 
+            if (version >= 1003) {
+                call.addForAllUsers = dataInput.readInt();
+            }
+
+            if (version >= 1004) {
+                call.postDialDigits = readString(dataInput);
+            }
+
             return call;
         } catch (IOException e) {
             Log.e(TAG, "Error reading call data for " + callId, e);
@@ -399,7 +402,6 @@
             data.writeLong(call.date);
             data.writeLong(call.duration);
             writeString(data, call.number);
-            writeString(data, call.postDialDigits);
             data.writeInt(call.type);
             data.writeInt(call.numberPresentation);
             writeString(data, call.accountComponentName);
@@ -407,7 +409,6 @@
             writeString(data, call.accountAddress);
             data.writeLong(call.dataUsage == null ? 0 : call.dataUsage);
             data.writeInt(call.features);
-            data.writeInt(call.addForAllUsers);
 
             OEMData oemData = getOEMDataForCall(call);
             data.writeUTF(oemData.namespace);
@@ -415,6 +416,10 @@
             data.write(oemData.bytes);
             data.writeInt(END_OEM_DATA_MARKER);
 
+            data.writeInt(call.addForAllUsers);
+
+            writeString(data, call.postDialDigits);
+
             data.flush();
 
             output.writeEntityHeader(Integer.toString(call.id), baos.size());