aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHall Liu <hallliu@google.com>2020-01-27 15:34:04 -0800
committerHall Liu <hallliu@google.com>2020-03-09 16:31:27 -0700
commit1e54cb39bb76f5cc12526abca99b1af017d7d3d2 (patch)
treebd9b8c56ae2a3ce6072cc30b90ed2c77264ff52f /tests
parent9fe186b263e4d0ddcd2079e03838a8e55bdb62a3 (diff)
downloadContactsProvider-1e54cb39bb76f5cc12526abca99b1af017d7d3d2.tar.gz
Enforce strict grammar when querying the call log
Disallow subqueries and suspicious tokens when querying from the call log database. Also add a column to the projection so that the token detector doesn't throw a false positive. Bug: 143230980 Test: atest android.provider.cts.contacts.CallLogProviderTest Change-Id: I54d2d399f449ea47aa8fb4197c718f9038da25bf
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/providers/contacts/CallLogProviderTest.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/src/com/android/providers/contacts/CallLogProviderTest.java b/tests/src/com/android/providers/contacts/CallLogProviderTest.java
index 9efdfaa4..9baf1e41 100644
--- a/tests/src/com/android/providers/contacts/CallLogProviderTest.java
+++ b/tests/src/com/android/providers/contacts/CallLogProviderTest.java
@@ -18,6 +18,7 @@ package com.android.providers.contacts;
import android.telecom.CallerInfo;
import com.android.providers.contacts.testutil.CommonDatabaseUtils;
+import com.android.providers.contacts.util.ContactsPermissions;
import android.content.ComponentName;
import android.content.ContentProvider;
@@ -59,7 +60,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 = 34;
+ private static final int NUM_CALLLOG_FIELDS = 35;
private static final int MIN_MATCH = 7;
@@ -194,9 +195,12 @@ public class CallLogProviderTest extends BaseContactsProvider2Test {
PhoneAccountHandle subscription = new PhoneAccountHandle(
sComponentName, "sub0");
+ // Allow self-calls in order to add the call
+ 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);
+ ContactsPermissions.ALLOW_SELF_CALL = false;
assertNotNull(uri);
assertEquals("0@" + CallLog.AUTHORITY, uri.getAuthority());