aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrace Jia <xiaotonj@google.com>2020-08-28 09:03:12 -0700
committerGrace Jia <xiaotonj@google.com>2020-11-02 15:20:22 -0800
commitce22e63dc9f65b13fb1d5532505b721aa9cba628 (patch)
tree882cae0de07fdb1b8a1b1559f389e3b832af9bd1
parent1dc2110ac22657605369d01049ed09d95abec475 (diff)
downloadContactsProvider-ce22e63dc9f65b13fb1d5532505b721aa9cba628.tar.gz
Add missed information relative field.
Test: atest ContactsProviderTests:CallLogProviderTest Bug: 144452099 Change-Id: I435c85700bb1bbb8953f680a5e5fe5e9a0515bb6
-rw-r--r--src/com/android/providers/contacts/CallLogDatabaseHelper.java11
-rw-r--r--src/com/android/providers/contacts/CallLogProvider.java1
-rw-r--r--tests/src/com/android/providers/contacts/CallLogProviderTest.java7
3 files changed, 16 insertions, 3 deletions
diff --git a/src/com/android/providers/contacts/CallLogDatabaseHelper.java b/src/com/android/providers/contacts/CallLogDatabaseHelper.java
index 39c3d5f1..06d3291b 100644
--- a/src/com/android/providers/contacts/CallLogDatabaseHelper.java
+++ b/src/com/android/providers/contacts/CallLogDatabaseHelper.java
@@ -39,7 +39,7 @@ import com.android.providers.contacts.util.PropertyUtils;
public class CallLogDatabaseHelper {
private static final String TAG = "CallLogDatabaseHelper";
- private static final int DATABASE_VERSION = 8;
+ private static final int DATABASE_VERSION = 9;
private static final boolean DEBUG = false; // DON'T SUBMIT WITH TRUE
@@ -152,6 +152,7 @@ public class CallLogDatabaseHelper {
Calls.CALL_SCREENING_COMPONENT_NAME + " TEXT," +
Calls.CALL_SCREENING_APP_NAME + " TEXT," +
Calls.BLOCK_REASON + " INTEGER NOT NULL DEFAULT 0," +
+ Calls.MISSED_REASON + " INTEGER NOT NULL DEFAULT 0," +
Voicemails._DATA + " TEXT," +
Voicemails.HAS_CONTENT + " INTEGER," +
@@ -220,6 +221,10 @@ public class CallLogDatabaseHelper {
if (oldVersion < 8) {
upgradetoVersion8(db);
}
+
+ if (oldVersion < 9) {
+ upgradeToVersion9(db);
+ }
}
}
@@ -450,6 +455,10 @@ public class CallLogDatabaseHelper {
}
}
+ private void upgradeToVersion9(SQLiteDatabase db) {
+ db.execSQL("ALTER TABLE calls ADD missed_reason INTEGER NOT NULL DEFAULT 0");
+ }
+
/**
* Perform the migration from the contacts2.db (of the latest version) to the current calllog/
* voicemail status tables.
diff --git a/src/com/android/providers/contacts/CallLogProvider.java b/src/com/android/providers/contacts/CallLogProvider.java
index f9aa4843..2f662e63 100644
--- a/src/com/android/providers/contacts/CallLogProvider.java
+++ b/src/com/android/providers/contacts/CallLogProvider.java
@@ -162,6 +162,7 @@ public class CallLogProvider extends ContentProvider {
.put(Calls.CALL_SCREENING_COMPONENT_NAME, Calls.CALL_SCREENING_COMPONENT_NAME);
sCallsProjectionMap.put(Calls.CALL_SCREENING_APP_NAME, Calls.CALL_SCREENING_APP_NAME);
sCallsProjectionMap.put(Calls.BLOCK_REASON, Calls.BLOCK_REASON);
+ sCallsProjectionMap.put(Calls.MISSED_REASON, Calls.MISSED_REASON);
}
private static final String ALLOWED_PACKAGE_FOR_TESTING = "com.android.providers.contacts";
diff --git a/tests/src/com/android/providers/contacts/CallLogProviderTest.java b/tests/src/com/android/providers/contacts/CallLogProviderTest.java
index 9baf1e41..c9d09635 100644
--- a/tests/src/com/android/providers/contacts/CallLogProviderTest.java
+++ b/tests/src/com/android/providers/contacts/CallLogProviderTest.java
@@ -16,6 +16,8 @@
package com.android.providers.contacts;
+import static android.provider.CallLog.Calls.MISSED_REASON_NOT_MISSED;
+
import android.telecom.CallerInfo;
import com.android.providers.contacts.testutil.CommonDatabaseUtils;
import com.android.providers.contacts.util.ContactsPermissions;
@@ -60,7 +62,7 @@ public class CallLogProviderTest extends BaseContactsProvider2Test {
Voicemails.DIRTY,
Voicemails.DELETED};
/** Total number of columns exposed by call_log provider. */
- private static final int NUM_CALLLOG_FIELDS = 35;
+ private static final int NUM_CALLLOG_FIELDS = 36;
private static final int MIN_MATCH = 7;
@@ -199,7 +201,7 @@ public class CallLogProviderTest extends BaseContactsProvider2Test {
ContactsPermissions.ALLOW_SELF_CALL = true;
Uri uri = Calls.addCall(ci, getMockContext(), "1-800-263-7643",
Calls.PRESENTATION_ALLOWED, Calls.OUTGOING_TYPE, 0, subscription, 2000,
- 40, null);
+ 40, null, MISSED_REASON_NOT_MISSED);
ContactsPermissions.ALLOW_SELF_CALL = false;
assertNotNull(uri);
assertEquals("0@" + CallLog.AUTHORITY, uri.getAuthority());
@@ -222,6 +224,7 @@ public class CallLogProviderTest extends BaseContactsProvider2Test {
// Casting null to Long as there are many forms of "put" which have nullable second
// parameters and the compiler needs a hint as to which form is correct.
values.put(Calls.DATA_USAGE, (Long) null);
+ values.put(Calls.MISSED_REASON, 0);
assertStoredValues(uri, values);
}