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

Fix retrieval of media player image in widget #1483

Merged
merged 1 commit into from Apr 6, 2021

Conversation

dshokouhi
Copy link
Member

Summary

I noticed that the media player widget image never updated, turns out it never would because the URL we were using was never correct, now we load the actual URL and if on debug build we will print more logging errors to help out.

2021-04-05 16:28:49.534 12796-12796/io.homeassistant.companion.android.debug D/Picasso: Main        errored      [R0]+336ms Unrecognized type of request: Request{/api/media_player_proxy/media_player.den_shield_tv?token=TOKEN&cache=CACHE

I also had to add a hard resize as my shield is in 4k and the image was too big, so sticking to 1920x1080 as it will load.

2021-04-05 16:16:54.628 7665-7665/io.homeassistant.companion.android.debug E/AndroidRuntime: FATAL EXCEPTION: main
    Process: io.homeassistant.companion.android.debug, PID: 7665
    java.lang.IllegalArgumentException: RemoteViews for widget update exceeds maximum bitmap memory usage (used: 33177600, max: 26265600)
        at android.os.Parcel.createExceptionOrNull(Parcel.java:2377)
        at android.os.Parcel.createException(Parcel.java:2357)
        at android.os.Parcel.readException(Parcel.java:2340)
        at android.os.Parcel.readException(Parcel.java:2282)
        at com.android.internal.appwidget.IAppWidgetService$Stub$Proxy.updateAppWidgetIds(IAppWidgetService.java:977)
        at android.appwidget.AppWidgetManager.updateAppWidget(AppWidgetManager.java:531)
        at com.squareup.picasso.RemoteViewsAction$AppWidgetAction.update(RemoteViewsAction.java:116)
        at com.squareup.picasso.RemoteViewsAction.complete(RemoteViewsAction.java:45)
        at com.squareup.picasso.Picasso.deliverAction(Picasso.java:576)
        at com.squareup.picasso.Picasso.complete(Picasso.java:528)
        at com.squareup.picasso.Picasso$1.handleMessage(Picasso.java:122)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7660)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
     Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.appwidget.AppWidgetServiceImpl.updateAppWidgetInstanceLocked(AppWidgetServiceImpl.java:1961)
        at com.android.server.appwidget.AppWidgetServiceImpl.updateAppWidgetIds(AppWidgetServiceImpl.java:1780)
        at com.android.server.appwidget.AppWidgetServiceImpl.updateAppWidgetIds(AppWidgetServiceImpl.java:1530)
        at com.android.internal.appwidget.IAppWidgetService$Stub.onTransact(IAppWidgetService.java:420)
        at android.os.Binder.execTransactInternal(Binder.java:1154)

I had also opted not to change the scaleType because it either looks the way it does today or its very tiny, here is an example when we use centerInside

image

and what it looks like today obviously not ideal but a larger image looks better lol, also need to consider music players:

image

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

@JBassett JBassett merged commit 8f3d6ab into home-assistant:master Apr 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants