aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Zhu <tonyzhu@google.com>2018-11-08 17:22:43 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-11-08 17:22:43 +0000
commit1e6ac864ef568879e4e2e2c9046d48d41f1a5561 (patch)
tree1dc8828d228aaca88a0d2a2525f9c65162fdc929
parent9d97e4faf433d8b8fbadb44986d10595010ced7a (diff)
parent51a3712e2a54da95245e596b7d63f9de7949f7b8 (diff)
downloadContactsProvider-nougat-iot-release.tar.gz
-rw-r--r--src/com/android/providers/contacts/CallLogDatabaseHelper.java20
-rw-r--r--src/com/android/providers/contacts/CallLogProvider.java4
-rw-r--r--tests/src/com/android/providers/contacts/CallLogProviderTest.java2
3 files changed, 24 insertions, 2 deletions
diff --git a/src/com/android/providers/contacts/CallLogDatabaseHelper.java b/src/com/android/providers/contacts/CallLogDatabaseHelper.java
index 736d6657..9aed6d0a 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 = 5;
+ private static final int DATABASE_VERSION = 6;
private static final boolean DEBUG = false; // DON'T SUBMIT WITH TRUE
@@ -149,6 +149,9 @@ public class CallLogDatabaseHelper {
Calls.CACHED_FORMATTED_NUMBER + " TEXT," +
Calls.ADD_FOR_ALL_USERS + " INTEGER NOT NULL DEFAULT 1," +
Calls.LAST_MODIFIED + " INTEGER DEFAULT 0," +
+ Calls.CALL_SCREENING_COMPONENT_NAME + " TEXT," +
+ Calls.CALL_SCREENING_APP_NAME + " TEXT," +
+ Calls.BLOCK_REASON + " INTEGER NOT NULL DEFAULT 0," +
Voicemails._DATA + " TEXT," +
Voicemails.HAS_CONTENT + " INTEGER," +
Voicemails.MIME_TYPE + " TEXT," +
@@ -204,6 +207,10 @@ public class CallLogDatabaseHelper {
if (oldVersion < 5) {
upgradeToVersion5(db);
}
+
+ if (oldVersion < 6) {
+ upgradeToVersion6(db);
+ }
}
}
@@ -280,6 +287,17 @@ public class CallLogDatabaseHelper {
}
/**
+ * Add {@link CallLog.Calls#CALL_SCREENING_COMPONENT_NAME}
+ * {@link CallLog.Calls#CALL_SCREENING_APP_NAME}
+ * {@link CallLog.Calls#BLOCK_REASON} column to the CallLog database.
+ */
+ private void upgradeToVersion6(SQLiteDatabase db) {
+ db.execSQL("ALTER TABLE calls ADD call_screening_component_name TEXT");
+ db.execSQL("ALTER TABLE calls ADD call_screening_app_name TEXT");
+ db.execSQL("ALTER TABLE calls ADD block_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 f71a7503..ff3e65c6 100644
--- a/src/com/android/providers/contacts/CallLogProvider.java
+++ b/src/com/android/providers/contacts/CallLogProvider.java
@@ -157,6 +157,10 @@ public class CallLogProvider extends ContentProvider {
sCallsProjectionMap.put(Calls.CACHED_FORMATTED_NUMBER, Calls.CACHED_FORMATTED_NUMBER);
sCallsProjectionMap.put(Calls.ADD_FOR_ALL_USERS, Calls.ADD_FOR_ALL_USERS);
sCallsProjectionMap.put(Calls.LAST_MODIFIED, Calls.LAST_MODIFIED);
+ sCallsProjectionMap
+ .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);
}
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 f6078464..babfaff7 100644
--- a/tests/src/com/android/providers/contacts/CallLogProviderTest.java
+++ b/tests/src/com/android/providers/contacts/CallLogProviderTest.java
@@ -61,7 +61,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 = 31;
+ private static final int NUM_CALLLOG_FIELDS = 34;
private CallLogProviderTestable mCallLogProvider;