Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Querying "content://settings/..." With filter Does Not Work under android-6 and newer #7

Open
whitedavidp opened this issue Oct 20, 2022 · 4 comments
Labels

Comments

@whitedavidp
Copy link

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:

Screenshot_20221020-082015

@k3b
Copy link
Owner

k3b commented Oct 24, 2022

on my non-rooted android-10 i have the same issue:

provider "content://settings/global"

  • without query filter works as expected.
  • with query _id = 22 or _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

@k3b k3b changed the title Querying With filter Does Not Seem to Work Querying With filter Does Not Seem to Work under android-9 Oct 24, 2022
@k3b k3b added the bug label Oct 24, 2022
@k3b k3b changed the title Querying With filter Does Not Seem to Work under android-9 Querying "content://settings/..." With filter Does Not Work under android-6 and newer Oct 25, 2022
@k3b k3b added wontfix and removed bug labels Oct 25, 2022
@k3b
Copy link
Owner

k3b commented Oct 25, 2022

"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

@k3b k3b closed this as completed Oct 25, 2022
@whitedavidp
Copy link
Author

I know you have closed this but...

  1. 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.

  1. 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).

  2. 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.

Screenshot_20221025-105927

Thanks

@k3b k3b reopened this Oct 25, 2022
@whitedavidp
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants