abrenoch / hyperion-android-grabber

Screen grabber for hyperion
MIT License
188 stars 31 forks source link

Grab on boot not working anymore on Shield w. Android 11 #180

Open Muegic opened 2 years ago

Muegic commented 2 years ago

Hi, it seems the "grab on boot" feature, does not work anymore on my Shield TV with Android 11.

When I open the grabber app, press start and grant access for screen recording, it works fine until I power off the Shield. The next time I start the shield, the grabber is not working until I start it manually.

IMG_5128 IMG_5127

abrenoch commented 2 years ago

Hey @Muegic, I can confirm this seems to be the case. Spent some time looking into it yesterday, but am feeling a bit stumped at the exact moment... It appears HyperionGrabberBootReceiver does receive the boot event, but the startActivity call from here doesnt seem to actually launch the BootActivity. On mobile, the quick tile button uses this same method to initialize the grabber service, and that appears to work as expected (after a couple misc fixes).

I'm wondering if something about the context supplied to HyperionGrabberBootReceiver.onReceive has something about it that is disallowing BootActivity to be started here. Maybe something in the manifest file... Not sure yet, but can confirm this seems to be an issue.

Muegic commented 2 years ago

Thanks for looking into it.

I installed the 9.0.1 shield update yesterday.

It didn‘t auto boot on the first start (4 hours after the update), but since then the auto boot worked every time (even full power cyrcles). So it seems the upddate fixed the problem. Will close the issue tomorrow if it‘s still working.

abrenoch commented 2 years ago

Thanks for following up... Interesting. I was only testing on my phone for the time, but I was able to reproduce this kind of behavior there.

abrenoch commented 2 years ago

Unfortunately I'm seeing this now - issue isn't immediately clear. I have a feeling some of the security around the screen record functionality was tightened up.

Muegic commented 2 years ago

Hi! Grab on boot is still working for me. Had to manually start the grabber 1 (maybe 2) times in April.

But I noticed that the permissions section for Hyperion Grabber is empty (not sure if there was "screen recording" in there before the Android 11 upgrade though).

Maby this is the reason for the empty permission section: (And I hope you better understand the technical things behind this text, more than I do :-)

(https://developer.android.com/about/versions/11/privacy/permissions)

System alert window changes

Android 11 makes several changes to how apps are granted the SYSTEM_ALERT_WINDOW permission. The changes are intended to protect users by making the permission grant more intentional. Certain apps are automatically granted SYSTEM_ALERT_WINDOW permission upon request

Certain classes of apps are automatically granted the SYSTEM_ALERT_WINDOW permission upon request:

Any app that has [ROLE_CALL_SCREENING](https://developer.android.com/reference/android/app/role/RoleManager#ROLE_CALL_SCREENING) and requests SYSTEM_ALERT_WINDOW is automatically granted the permission. If the app loses ROLE_CALL_SCREENING, it loses the permission.

Any app that is capturing the screen via a MediaProjection and requests SYSTEM_ALERT_WINDOW is automatically granted the permission unless the user has explicitly denied the permission to the app. When the app stops capturing the screen, it loses the permission. This use case is primarily intended for game livestreaming apps.

These apps do not need to send ACTION_MANAGE_OVERLAY_PERMISSION to get the SYSTEM_ALERT_WINDOW permission; the apps can simply request SYSTEM_ALERT_WINDOW directly.