Iterate old recordings properly when migrating call recording data.
SparseArray.get() expects a key, not an index.
Change-Id: I0ba40180dc9df9f8a8f4036ccbe47cc59a50cfbb
diff --git a/java/com/android/dialer/callrecord/CallRecordingAutoMigrator.java b/java/com/android/dialer/callrecord/CallRecordingAutoMigrator.java
index bc29d22..20df88e 100644
--- a/java/com/android/dialer/callrecord/CallRecordingAutoMigrator.java
+++ b/java/com/android/dialer/callrecord/CallRecordingAutoMigrator.java
@@ -84,8 +84,8 @@
int id = -1;
long creationTime = System.currentTimeMillis();
for (int i = 0; i < oldRecordingData.size(); i++) {
- if (TextUtils.equals(recording.getName(), oldRecordingData.get(i).fileName)) {
- creationTime = oldRecordingData.get(i).creationTime;
+ if (TextUtils.equals(recording.getName(), oldRecordingData.valueAt(i).fileName)) {
+ creationTime = oldRecordingData.valueAt(i).creationTime;
id = oldRecordingData.keyAt(i);
break;
}