Fix SQL injection vulnerability in SMS/MMS providers

This patch prevents SQL injection attacks, by validating the bracketing in the selection string provided to
MmsProvider, SmsProvider, and MmsSmsProvider.

The SQLiteTokenizer is updated to detect unbalanced or improperly nested
parentheses, throwing an IllegalArgumentException if invalid structures
are found. This check is invoked early in the query method of
each provider.

Flag: EXEMPT bug fix
Bug: 388530367
Test: verify using SMSMMSProviderSelectionBug app
Test: atest MmsProviderTest SmsProviderTest MmsSmsProviderTest
Test: run live network sms/mms test for checking regression b/427137135
(cherry picked from commit 98ddf9fa1f937831cbb1af5ad41a12771bc5930b)
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:6da5eeabe962ffcea863def5de2eb8a39d41f8e1
Merged-In: I83078493870aab4d8cc31fb3afc83bb33746e8e9
Change-Id: I83078493870aab4d8cc31fb3afc83bb33746e8e9
9 files changed