diff options
author | Hall Liu <hallliu@google.com> | 2015-12-01 16:30:02 -0800 |
---|---|---|
committer | Hall Liu <hallliu@google.com> | 2015-12-04 14:11:34 -0800 |
commit | a111fff1b5cba3b562b393d2e85e2de93ae29cf5 (patch) | |
tree | f4901424c9ab04864f2375c5d2549c85d6268cb2 | |
parent | 3c5cccac20055a5081a9e9f8e331ed8915a94993 (diff) | |
download | android_packages_providers_CallLogProvider-a111fff1b5cba3b562b393d2e85e2de93ae29cf5.tar.gz android_packages_providers_CallLogProvider-a111fff1b5cba3b562b393d2e85e2de93ae29cf5.tar.bz2 android_packages_providers_CallLogProvider-a111fff1b5cba3b562b393d2e85e2de93ae29cf5.zip |
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
-rw-r--r-- | src/com/android/calllogbackup/CallLogBackupAgent.java | 23 |
1 files changed, 14 insertions, 9 deletions
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 @@ public class CallLogBackupAgent extends BackupAgent { long date; long duration; String number; - String postDialDigits; + String postDialDigits = ""; int type; int numberPresentation; String accountComponentName; @@ -103,7 +103,7 @@ public class CallLogBackupAgent extends BackupAgent { /** 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 @@ public class CallLogBackupAgent extends BackupAgent { 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 @@ public class CallLogBackupAgent extends BackupAgent { 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 @@ public class CallLogBackupAgent extends BackupAgent { } } + 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 @@ public class CallLogBackupAgent extends BackupAgent { 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 @@ public class CallLogBackupAgent extends BackupAgent { 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 @@ public class CallLogBackupAgent extends BackupAgent { 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()); |