ContentResolver.query() 方法抛出“无效的令牌限制”错误

问题描述

在版本号为 RQ1A.201205.003 或更高版本的 Pixel 设备上发生以下错误
我想知道错误的原因以及如何处理。
这是错误还是规范更改?

代码

      ContentResolver resolver = getContentResolver();
      String order = "date ASC limit 100";
      Cursor cursor = resolver.query(
          CallLog.Calls.CONTENT_URI,null,order);

错误

"Invalid token limit,LINE:142,Method:readExceptionFromParcel Exception:Invalid token limit"

■发生错误的版本号

https://support.google.com/pixelphone/thread/87641266
・RQ1A.201205.003
・RQ1A.201205.008
・RQ1A.201205.011

https://support.google.com/pixelphone/thread/93232095
・RQ1A.210105.002
・RQ1A.210105.003

https://support.google.com/pixelphone/thread/96244000
・RQ1A.210205.004

■如果换成下面的代码,就不会出错。

buildUpon().appendQueryParameter("limit","100")

■附加信息 使用官方文档方法实现时,没有出现错误,但是LIMIT子句不起作用(检索到所有记录)。

ContentProvider - query

 // Request 20 records starting at row index 30.
 Bundle queryArgs = new Bundle();
 queryArgs.putInt(ContentResolver.QUERY_ARG_OFFSET,30);
 queryArgs.putInt(ContentResolver.QUERY_ARG_LIMIT,20);
 
 Cursor cursor = getContentResolver().query(
       contentUri,// Content Uri is specific to individual content providers.
       projection,// String[] describing which columns to return.
       queryArgs,// Query arguments.
       null);         // Cancellation signal.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)