ContentProviderHelper
ContentProviderHelper copied to clipboard
Querying "content://settings/..." With filter Does Not Work under android-6 and newer
My phone is on Android 9 and is rooted, not that I think this should make any difference.
I had hoped this app would be more useful than the Content Provider viewer app I have been using for years - mostly due to the inclusion of filtering in the content provider queries. However, none of my attempts to use querying have succeeded. No matter what the query, I get something like this:

on my non-rooted android-10 i have the same issue:
provider "content://settings/global"
- without query filter works as expected.
- with query
_id = 22or_id = '22'error (see errorlog below)
Errorlog (enabled in Settings/copyErrormessageToClipboard)
LoadResultsTask.onPostExecute : LoadResultsTask.onPostExecute : 'content://settings/global':java.lang.IllegalArgumentException: Supported SQL: uri content://some_table/some_property with null where and where args uri content://some_table with query name=? and single name as arg uri content://some_table with query name=some_name and null args but got - uri:content://settings/global, where:_id = 22 whereArgs:null
"content://settings/..." does not suport "filtering by fieldname" .
Some content provider do not support "filtering by fieldname."
Among these are "content://settings/..." (since android-6)
On my android-10 filtering "content://sms/inbox" and "content://media/external/images/media" works as expected
I know you have closed this but...
- If I adb shell to my Android 9 phone and issue:
content query --uri content://settings/global --projection name:value --where "name='mobile_data0'" --sort "name ASC"
I get a single line result:
Row: 0 name=mobile_data0, value=1
So it would appear that, strictly speaking, the statement 'Some content provider do not support "filtering by fieldname."' may not be true in general. Clearly, using the content query command (via adb shell) does this just fine.
-
Now it IS TRUE that running the above content query command from a shell on the device itself (ie, not via adb shell), the entire command fails due to a permission failure ACCESS_CONTENT_PROVIDERS_EXTERNALLY. Indeed, any attempt to query this content provider uri in this way fails due to permission failure. But I do not think that is involved in your app (I have not yet looked at the code you employ) as the query seems to work fine as a simple, non-filtered query. But running the same command as root also works the same (seems that root bypasses this permission check or that root have been granted it).
-
If I use your app, do NOT supply a column name filter, BUT DO supply a sort criteria, the command runs without any error. BUT the displayed results are NOT SORTED. See attached.

Thanks
I certainly see here comments that agree with your statement above. And I see the exception being thrown around line 1595 here in the constructor of the internal Arguments class. However, I have not quite been able to decipher all of what is happening there.
But I have tested an equals (=) filter on content://settings/secure where name is 'missed_call_msg_alert' in your app and I get a single line result. So it seems like the class WILL accept some filtering but, at least at first glance of the REs I see, only equals (=) can be specified and the where can include only the name column. This MAY be due to the shift from SQL to XML for storage of this information after some point as described in the stackoverflow thread above. And this is confirmed using adb shell and executing:
content query --uri content://settings/global --projection name:value --where "name like 'mobile_data%'" --sort "name ASC"
which throws the exception.