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

Android q #665

Merged
merged 4 commits into from
Oct 18, 2019
Merged

Android q #665

merged 4 commits into from
Oct 18, 2019

Conversation

yccheok
Copy link
Contributor

@yccheok yccheok commented Sep 11, 2019

同志好!

我尝试修复 Android Q 的臭虫。因为我对 CursorLoader 并不了解。如果你能找出更好的方案,请修正。

谢谢同志们!

Support Android Q.

  1. "COUNT(*) AS " + COLUMN_COUNT is not working in Android Q anymore (Not sure why)
  2. There are no official document specific how GROUP BY should work in CursorLoader. The unofficial workaround seem no longer work in Android Q - https://stackoverflow.com/a/33367564/72437

Due to the above 2 limitations, we need to perform manual calculation on "count per directory".

Merge to upstream master
1) "COUNT(*) AS " + COLUMN_COUNT is not working in Android Q anymore (Not sure why)
2) There are no official document specific how GROUP BY should work in CursorLoader. The unofficial workaround seem no longer work in Android Q - https://stackoverflow.com/a/33367564/72437

Due to the above 2 limitations, we need to perform manual calculation on "count per directory".
… self generated Uri. However, I'm not sure whether there might be conversion failed (Uri.toString and Uri.parse) in certain edge cases.
@REBOOTERS REBOOTERS merged commit 4856c98 into zhihu:master Oct 18, 2019
@bhargavsavasani
Copy link

E/AndroidRuntime: FATAL EXCEPTION: ModernAsyncTask #1
Process: com.CCS.WeCards, PID: 5336
java.lang.RuntimeException: An error occurred while executing doInBackground()
at androidx.loader.content.ModernAsyncTask$3.done(ModernAsyncTask.java:164)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
at java.util.concurrent.FutureTask.run(FutureTask.java:271)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.IllegalArgumentException: Invalid column COUNT(*) AS count
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:170)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:423)
at android.content.ContentResolver.query(ContentResolver.java:944)
at android.content.ContentResolver.query(ContentResolver.java:880)
at androidx.core.content.ContentResolverCompat.query(ContentResolverCompat.java:81)
at androidx.loader.content.CursorLoader.loadInBackground(CursorLoader.java:63)
at com.zhihu.matisse.internal.loader.AlbumLoader.loadInBackground(AlbumLoader.java:97)
at com.zhihu.matisse.internal.loader.AlbumLoader.loadInBackground(AlbumLoader.java:33)
at androidx.loader.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:307)
at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:60)
at androidx.loader.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:48)
at androidx.loader.content.ModernAsyncTask$2.call(ModernAsyncTask.java:141)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:919) 

Getting the Same issue on Android Q

@yccheok
Copy link
Contributor Author

yccheok commented Nov 11, 2019

@bhargavsavasani

at com.zhihu.matisse.internal.loader.AlbumLoader.loadInBackground(AlbumLoader.java:97)

doesn't seem like latest code base.

Providing crash log alone wouldn't help much. You need to provide more detail on how we can reproduce the problem. Only then we can resolve the problem.

I had tested the following :

I tried to browse the gallery and select an 2 images. No issue found so far. Please see my screenshots.

0

1

@bhargavsavasani
Copy link

@yccheok
ok, Now it's Working
Thanks

hansemannn pushed a commit to hansemannn/Matisse that referenced this pull request Dec 9, 2019
* Support Android Q.

1) "COUNT(*) AS " + COLUMN_COUNT is not working in Android Q anymore (Not sure why)
2) There are no official document specific how GROUP BY should work in CursorLoader. The unofficial workaround seem no longer work in Android Q - https://stackoverflow.com/a/33367564/72437

Due to the above 2 limitations, we need to perform manual calculation on "count per directory".

* Eliminate deprecated MediaStore.MediaColumns.DATA. We replace it with self generated Uri. However, I'm not sure whether there might be conversion failed (Uri.toString and Uri.parse) in certain edge cases.

# Conflicts:
#	matisse/build.gradle
#	matisse/src/main/java/com/zhihu/matisse/internal/loader/AlbumLoader.java
@erichyx
Copy link

erichyx commented Feb 27, 2020

@yccheok 项目里配置混淆之后,在Android Q上显示不了图片。
image

moodcal pushed a commit to moodcal/Matisse that referenced this pull request Mar 7, 2020
* Support Android Q.

1) "COUNT(*) AS " + COLUMN_COUNT is not working in Android Q anymore (Not sure why)
2) There are no official document specific how GROUP BY should work in CursorLoader. The unofficial workaround seem no longer work in Android Q - https://stackoverflow.com/a/33367564/72437

Due to the above 2 limitations, we need to perform manual calculation on "count per directory".

* Eliminate deprecated MediaStore.MediaColumns.DATA. We replace it with self generated Uri. However, I'm not sure whether there might be conversion failed (Uri.toString and Uri.parse) in certain edge cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants