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

Selecting image from BrowseProviderFragment only sets the wallpaper once #673

Closed
hossain-khan opened this issue Jul 7, 2020 · 4 comments

Comments

@hossain-khan
Copy link

Env

  • Muzei Version: v3.3.0
  • Device: One Plus 5 (API 28), Pixel 4 XL (API 30)

Issue

When I tap on the wallpaper from the BrowseProviderFragment, the wallpaper is set the first time, after that tapping on different items does not change the wallpaper. However, toast is shown about a successful image set.

Screen Cast

NOTE: A longer HD screencast video available at an external file host.


Other observations

When setting an image by tapping >> icon on ArtDetailFragment.nextArtwork#L228 successfully sets the wallpaper on new image load every time.

I have tried to debug the issue, however, I was not able to identify the actual issue as to why it doesn't work from BrowseProviderFragment. Tried calling METHOD_REQUEST_LOAD, that didn't help much.

itemView.setOnClickListener {
    owner.lifecycleScope.launch(Dispatchers.Main) {

        MuzeiDatabase.getInstance(context).artworkDao().insert(artwork)
       
        // ... added code
        val client = ContentProviderClientCompat.getClient(context, artwork.contentUri)
        client?.call(ProtocolConstants.METHOD_REQUEST_LOAD)
@ianhanniballake
Copy link
Collaborator

It seems to be working fine for me in the latest Muzei 3.4.0 Alpha 3 (available as part of the public beta). Is that not working for you?

@hossain-khan
Copy link
Author

Strange! Just to be on the same page, here is the flow:

  1. Open Muzei App
  2. Select 'Sources' tab, and tap on "Unsplash (Example)" to select as source (Should show checkmark on top right of source item card)
  3. Tap on "Browse" on "Unsplash (Example)" tile to see available pictures on next screen as grid view
  4. From grid of pictures, tapping on any picture should set the wallpaper

I joined the beta program and gathered some additional devices to make sure I am not doing something wrong, or not missing something. Here are the test result.

Device API Level Muzei Version Storage Permission Source Result
Pixel 4 XL 30 v3.4.0 Alpha 3 ✔️ Unsplash
Pixel 2 XL 29 v3.4.0 Alpha 3 ✔️ Unsplash
OnePlus 5 28 v3.4.0 Alpha 3 Unsplash
Nexus 5 23 v3.3.3 Unsplash
Pixel 2 Emulator 29 v3.4.0 Debug Unsplash

The "Result" column X means, even though it works the first time, any consecutive selection from the grid fails.


Here are some logs collected from the Pixel 2 emulator using local Muzei build (I don't see anything obvious here)

Section - Click on >> next to set wallpaper

Successfully sets the wallpaper every time.

// Click on next from ArtDetailFragment
2020-07-07 13:40:35.748 D/ArtworkLoad: Artwork Load for com.example.muzei.exampleunsplash
2020-07-07 13:40:35.751 D/ContentProviderClient: ContentProviderClientCompat.call(method=[com.google.android.apps.muzei.api.GET_LOAD_INFO], arg=[null], extras=[null])
2020-07-07 13:40:35.968 D/ArtworkLoad: Loaded content://com.example.muzei.exampleunsplash/3 into id 8
2020-07-07 13:40:35.968 D/ContentProviderClient: ContentProviderClientCompat.call(method=[com.google.android.apps.muzei.api.MARK_ARTWORK_LOADED], arg=[content://com.example.muzei.exampleunsplash/3], extras=[content://com.example.muzei.exampleunsplash/3])
2020-07-07 13:40:35.976 I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=e2ca298b-368d-4a07-b813-b014fa592bb4, tags={ com.google.android.apps.muzei.sync.ArtworkLoadWorker } ]
2020-07-07 13:40:35.980 D/ContentProviderClient: ContentProviderClientCompat.call(method=[com.google.android.apps.muzei.api.GET_COMMANDS], arg=[content://com.example.muzei.exampleunsplash/3], extras=[content://com.example.muzei.exampleunsplash/3])
2020-07-07 13:40:36.091 W/System: A resource failed to call end.
2020-07-07 13:40:36.093 I/chatty: uid=10139(net.nurik.roman.muzei) FinalizerDaemon identical 6 lines
2020-07-07 13:40:36.093 W/System: A resource failed to call end.


// Click on next again
2020-07-07 13:41:36.308 D/ArtworkLoad: Artwork Load for com.example.muzei.exampleunsplash
2020-07-07 13:41:36.310 D/ContentProviderClient: ContentProviderClientCompat.call(method=[com.google.android.apps.muzei.api.GET_LOAD_INFO], arg=[null], extras=[null])
2020-07-07 13:41:36.921 D/ArtworkLoad: Loaded content://com.example.muzei.exampleunsplash/5 into id 10
2020-07-07 13:41:36.921 D/ContentProviderClient: ContentProviderClientCompat.call(method=[com.google.android.apps.muzei.api.MARK_ARTWORK_LOADED], arg=[content://com.example.muzei.exampleunsplash/5], extras=[content://com.example.muzei.exampleunsplash/5])
2020-07-07 13:41:36.936 D/ContentProviderClient: ContentProviderClientCompat.call(method=[com.google.android.apps.muzei.api.GET_COMMANDS], arg=[content://com.example.muzei.exampleunsplash/5], extras=[content://com.example.muzei.exampleunsplash/5])
2020-07-07 13:41:36.940 I/WM-WorkerWrapper: Worker result SUCCESS for Work [ id=13753e56-c073-4fef-bf1a-be607edc74b1, tags={ com.google.android.apps.muzei.sync.ArtworkLoadWorker } ]
2020-07-07 13:41:51.986 D/DirectBootCache: Successfully wrote artwork to Direct Boot cache

Section - Set from Grid

Only when screen is loaded, first time wallpaper is set.

// Select item from grid first time
2020-07-07 13:42:28.962 D/BrowseProviderFragment: Loaded content://com.example.muzei.exampleunsplash/29 into id 11
2020-07-07 13:42:28.962 D/FA: Event not sent since app measurement is disabled
2020-07-07 13:42:29.748 D/ContentProviderClient: ContentProviderClientCompat.call(method=[com.google.android.apps.muzei.api.GET_COMMANDS], arg=[content://com.example.muzei.exampleunsplash/29], extras=[content://com.example.muzei.exampleunsplash/29])
2020-07-07 13:42:44.009 D/DirectBootCache: Successfully wrote artwork to Direct Boot cache


// Second time
2020-07-07 13:43:16.895 D/BrowseProviderFragment: Loaded content://com.example.muzei.exampleunsplash/30 into id 12
2020-07-07 13:43:17.691 D/ContentProviderClient: ContentProviderClientCompat.call(method=[com.google.android.apps.muzei.api.GET_COMMANDS], arg=[content://com.example.muzei.exampleunsplash/29], extras=[content://com.example.muzei.exampleunsplash/29])
2020-07-07 13:43:17.722 W/System: A resource failed to call end.
2020-07-07 13:43:17.722 I/chatty: uid=10139(net.nurik.roman.muzei) FinalizerDaemon identical 2 lines
2020-07-07 13:43:17.722 W/System: A resource failed to call end.
2020-07-07 13:43:31.926 D/DirectBootCache: Successfully wrote artwork to Direct Boot cache


// Third time
2020-07-07 13:44:37.735 D/FA: Event not sent since app measurement is disabled
2020-07-07 13:44:37.736 D/BrowseProviderFragment: Loaded content://com.example.muzei.exampleunsplash/22 into id 14
2020-07-07 13:44:38.324 D/ContentProviderClient: ContentProviderClientCompat.call(method=[com.google.android.apps.muzei.api.GET_COMMANDS], arg=[content://com.example.muzei.exampleunsplash/29], extras=[content://com.example.muzei.exampleunsplash/29])
2020-07-07 13:44:52.784 D/DirectBootCache: Successfully wrote artwork to Direct Boot cache

NOTE: Some extra logcat statement has been added in BrowseProviderFragment and ContentProviderClientCompat

@ianhanniballake
Copy link
Collaborator

Ah, I think the title threw me off as that made it sound like setting the wallpaper from the Browse screen never worked, rather than only the first tap working. I was able to reproduce it when tapping multiple times.

@ianhanniballake ianhanniballake changed the title Selecting image from BrowseProviderFragment does not set the wallpaper (however ArtDetailViewModel#nextArtwork works) Selecting image from BrowseProviderFragment only sets the wallpaper once Jul 9, 2020
@ianhanniballake
Copy link
Collaborator

The fix will be included in the next Muzei 3.4 build, thanks for bringing this to our attention!

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

No branches or pull requests

2 participants