abrenoch / hyperion-android-grabber

Screen grabber for hyperion
MIT License
194 stars 33 forks source link

buildNotification with intent null on android tv #88

Closed DarkAnakin closed 6 years ago

DarkAnakin commented 6 years ago

https://github.com/abrenoch/hyperion-android-grabber/blob/978a84f1925a9706a4eae883df2f1055142298eb/common/src/main/java/com/abrenoch/hyperiongrabber/common/HyperionNotification.java#L59

crash on android tv emulator Oreo 8.0 and Mi Box 3 Oreo 8.0 when call intent.migrateExtraStreamToClipData(); PendingItent.java line 340

I don't set setContentIntent for the builder when isTv UiModeManager uiModeManager = (UiModeManager) mContext.getSystemService(UI_MODE_SERVICE); if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) { isTv = true; }

abrenoch commented 6 years ago

Interesting, the setContentIntent call was added in a recent commit, I thought I tested it on an android TV oreo build (my shield is running that), but maybe I failed to.

Will look into this later tonight!

DarkAnakin commented 6 years ago

To be exact it's the calling on the PendingIntent.getActivity() that cause the crash. Disabling the creation of the pending intent have not any side effect . Beside I am not sure that create a notification is recommended on android tv.

abrenoch commented 6 years ago

Yea if the launcher intent is not returned for the android tv build, I can see where that would fail then.

The notification (specifically a foreground one) is required however to prevent the application from being removed from memory. I believe some android tv builds do have a notification pane (I remember seeing one on some device emulator but I can't remember what), but I think majority simply hide it.

abrenoch commented 6 years ago

Just pushed a fix for this into the master branch