TeamNewPipe / NewPipe

A libre lightweight streaming front-end for Android.
https://newpipe.net
GNU General Public License v3.0
31.29k stars 3.04k forks source link

Can't interact with app/screen below popup player on Android 12 #6770

Closed Joristdh closed 2 years ago

Joristdh commented 3 years ago

Checklist

Steps to reproduce the bug

  1. This is a bug on Android 12 beta 3
  2. Open a video in the popup player (it doesn't matter which video or how you open it)
  3. Make sure the popup uses the full width of the screen (when in portrait)
  4. Open another app below the popup player, go to the home screen or open recent apps
  5. Try to interact with the screen below the popup

Actual behavior

All touches to the app/screen below the popup are ignored, because of the following behavior change in Android 12: https://developer.android.com/about/versions/12/behavior-changes-all#untrusted-touch-events

Expected behavior

The app below the popup responds to the touches.

Workaround

For now this issues can be solved per device by running the following ADB command: adb shell settings put global block_untrusted_touches 0

Device info

chrstfer commented 3 years ago

Im seeing this sporadically on android 11 (samsung gs20 ultra with up to date stock firmware) with most recent release (0.21.7). It doesn't seem to matter about the fullwidth thing, though iwill start to pay attention if that is triggering it and then the issue is persisting after i make it smaller again.

Also, often the app beneath will respond to drags and swipes but no controls will send their events even though they animate.

This might be because certain apps are supporting new APIs? Or it might be a different but similar bug.

chrstfer commented 3 years ago

What needs to be done to fix this? Its real annoying to need to clear my queue (because of an unrelated issue) just to send a tweet.

Joristdh commented 3 years ago

@chrstfer I don't think it is the same bug. The behavior change is introduced in Android 12, as you can see in the link I provided in the description. If you encounter a similar bug in Android 11 it's probably caused by something else. Maybe Samsung implemented a similar restriction in One UI or those apps implemented some restrictions themselves (for while another app overlays them).

If your bug does have the same cause, the ADB shell command in the description should fix it. If it doesn't, or you can't execute the command at all (because you aren't on Android 12), you should probably file a new bug report detailing your specific issue.

hackel commented 3 years ago

I also (still) have this issue on Android 12 beta 4.1 and the width of the pop-up makes no difference. I believe I read that the native PIP mode will need to be used going forward for security.

Update: Still broken in Android 12 final, as expected (sadly).

captainhook commented 2 years ago

I am also seeing this on Pixel 5, Android 12.

I'm not keen on the security implications of the workaround, so I'll wait for PiP implementation, but I can confirm it works.

Joristdh commented 2 years ago

It is also possible to only exclude NewPipe from this new permission: adb shell am compat disable BLOCK_UNTRUSTED_TOUCHES org.schabi.newpipe

I haven't tested this myself, but this should allow you to only disable this restriction for the NewPipe overlay

captainhook commented 2 years ago

>adb shell am compat disable BLOCK_UNTRUSTED_TOUCHES org.schabi.newpipe Cannot override a change on a non-debuggable app and user build.

Seems to not work for this. It is documented here though so good thinking: https://developer.android.com/about/versions/12/behavior-changes-all?hl=ro#untrusted-touch-events

schnatzi commented 2 years ago

Same thing on Pixel 6 with Android 12.0. Oddly enough the problem wasn't an issue on the Pixel 3 with Android 12 at my end.

dbenjaminmiller commented 2 years ago

Can confirm this is an issue for me on Android 12. What I think would be the proper solution is to offer a native popup as the default for A12 users with the old-style popup available as an option (which would require ADB access to be useful).

asdf512 commented 2 years ago

2223 Is the current open issue for implementing PiP support. Others date back to 2017. Hopefully with the recent problems caused by android 12 this will be resolved.

Coderdude112 commented 2 years ago

@schnatzi You arn't having problems with it on your Pixel 3? I'm having problems on my Pixel 3...

schnatzi commented 2 years ago

@schnatzi You aren't having problems with it on your Pixel 3? I'm having problems on my Pixel 3...

Maybe it just didn't occur at my end, because I didn't use it in combination with other apps since the update.

codingicebear commented 2 years ago

Can confirm this. When in pop up player mode, screen below the player becomes unresponsive.

A12 latest build

PacoBell commented 2 years ago

adb shell am compat disable BLOCK_UNTRUSTED_TOUCHES org.schabi.newpipe Cannot override a change on a non-debuggable app and user build.

Seems to not work for this. It is documented here though so good thinking: https://developer.android.com/about/versions/12/behavior-changes-all?hl=ro#untrusted-touch-events

Yes, the specifically targeted app workaround doesn't work, but the global one does:

adb shell settings put global block_untrusted_touches 0

Just FYI πŸ˜‰

Coderdude112 commented 2 years ago

Thanks @PacoBell! Worked immediately

rawlife56 commented 2 years ago

The security measure exists for a reason. It is not smart enough to disable it globally.

Coderdude112 commented 2 years ago

@rawlife56 Yes, it does exist for a reason, I believe there is an application for it. It's new with Android 12 to my knowledge and not many apps have been updated to work with the new permissions. Pip is a useful feature and is something I use all the time, so this temporary fix is ok.

book000 commented 2 years ago

This issue also occurs on Pixel 3a, Android 12. Moreover, it seems to occur even when playing in the background... (There is a notification in the notification column that "NewPipe is displayed above other apps") If you stop NewPipe playing in the background from the notification column as it is, in the worst case you will not be able to operate Home or other applications.

captainhook commented 2 years ago

This issue also occurs on Pixel 3a, Android 12. Moreover, it seems to occur even when playing in the background... (There is a notification in the notification column that "NewPipe is displayed above other apps") If you stop NewPipe playing in the background from the notification column as it is, in the worst case you will not be able to operate Home or other applications.

I don't see this unless I have opened a popup player in the same session. Force stop Newpipe and try again. It does seem like a bug.. perhaps overlay not being ended properly.

eRaz3r commented 2 years ago

Same Problem here with Samsung Galaxy S21 Ultra (Android12/OneUI 4).

xelaseer commented 2 years ago

Can confirm this still occurs on 0.21.15 with the latest Graphene OS on a Pixel 4XL.

Makes the popup feature basically unusable, as not only does this not allow tapping on apps below during use, but also makes any app or interaction with the phone non-responsive after use, except for Newpipe, until phone restart.

captainhook commented 2 years ago

Can confirm this still occurs on 0.21.15 with the latest Graphene OS on a Pixel 4XL.

Makes the popup feature basically unusable, as not only does this not allow tapping on apps below during use, but also makes any app or interaction with the phone non-responsive after use, except for Newpipe, until phone restart.

Force stop Newpipe. No need to restart.

ebanDev commented 2 years ago

Same problem on my Pixel 4XL with latest GrapheneOS 😭

pyladus commented 2 years ago

Same for Samsung S10+

R136A2 commented 2 years ago

Any ideas, how it can work properly? πŸ€”

captainhook commented 2 years ago

It will be fixed when PIP is implemented.

Handrail9 commented 2 years ago

Just wanted to pop in and confirm that this is also an issue on CalyxOS' Beta of Android 12. Hoping it's updated ASAP because i heavily relied on the popup player

Inrumpo commented 2 years ago

+1 for CalyxOS 3.1.0 (Android 12) on Pixel 4a

triallax commented 2 years ago

To those who see this issue: PLEASE don't comment unless you can add some useful info. Thus, no +1's, and no "this affects my Android 12 device too," unless you're adding something useful. If you're not, just react with a thumbs-up to this issue.

zevoz commented 2 years ago

Similar issue here. Samsung s20fe , started after updating to A12.

App screen freezes after pop-up, even with Pip gone/switched off. Function and on screen bottom buttons & drag down drawer interaction works. Typing in app finder works, but can't click on the found app.

Closing Np doesn't fix this, only restart. Gets cumbersome πŸ€”

Thanks for the attention, and the awesome app. 🀟

hope this gets fixed.

Coderdude112 commented 2 years ago

Dude, @zevoz, come on.

This thread already has tons of comments describing this issue and 20+ people are subscribed to pings to this thread. The comment directly above yours was literally asking people NOT to comment with +1s or comments saying "this affects my device too". Just react with the thumbs up on his comment.

captainhook commented 2 years ago

@TobiGr @mhmdanas could you lock this issue, please? There's nothing else to add to this discussion, we know the issue is that PIP needs to be implemented. As and when someone has time to work on PIP implementation, I'm sure a PR will be raised.

zevoz commented 2 years ago

πŸ€·πŸ»β€β™‚οΈ @Coderdude112 I figure some specifics I've mentioned qualify as new information / symptoms not previously mentioned in this thread. It's being worked on, got it. No need to get testy 🧘🏻

Coderdude112 commented 2 years ago

@zevoz I understand. Sorry if I came off as rude. As someone above found, you can use adb and the command below to disable the new feature in Android 12 that causes this issue.

adb shell settings put global block_untrusted_touches 0

While not a great solution, as it allows any app to do what NewPipe is trying to do, it does work. Would prob turn this back on as soon as someone here fixes the issue tho.

AudricV commented 2 years ago

Like stated before, the issue will be fixed when Android Picture in Picture API is implemented in NewPipe.

But we don't really have the time to implement this (and I personally don't have the knowledge to do this) so we need help from someone else.

PacoBell commented 2 years ago

Dunno if this helps, but https://github.com/twireapp/Twire implemented PiP, but they seem to be having some issues with it at the moment.

Also, Google has some sample PiP code if anyone wants to study that:

https://github.com/android/media-samples/tree/main/PictureInPicture

They also posted a nice Medium article with specific suggestions on what the UI should look like:

https://medium.com/androiddevelopers/making-magic-moments-with-picture-in-picture-e02964bf75ae

The official guide:

https://developer.android.com/guide/topics/ui/picture-in-picture

UnixPhonez commented 2 years ago

Having same issue on pixel 6 pro android 12 grapheneos

SlidingHorn commented 2 years ago

I apologize ahead of time of this is unwelcome, but mpv-android seems to have a working implementation that has resizing, etc. Just figured that the suggestion could be helpful if any contributors are able to discern how they did it:

https://github.com/mpv-android/mpv-android

AudricV commented 2 years ago

If it's not done by the player and all its components rewrite, I suggest to work on this only after the player rewrite is done. This will probably decrease the work that needs to be done to add the PiP feature.

cyphar commented 2 years ago

Can confirm this still occurs on 0.21.15 with the latest Graphene OS on a Pixel 4XL. Makes the popup feature basically unusable, as not only does this not allow tapping on apps below during use, but also makes any app or interaction with the phone non-responsive after use, except for Newpipe, until phone restart.

Force stop Newpipe. No need to restart.

How do you force stop an app if touch events are not working on the screen outside of the newpipe app? You can't even use the task switcher to close the app normally, let alone open the settings app to force stop NewPipe. The only option is to restart your phone AFAICS (and I've now just removed permissions for overlaying in NewPipe given the feature is completely broken -- which sucks since this feature was one of the main features I liked about NewPipe). Hopefully the devs have time to fix it soon.

AudricV commented 2 years ago

Please test #8045. It's not the optimal solution at all, but should really help you until the player rewrite is done.

werjany commented 2 years ago

Please test #8045. It's not the optimal solution at all, but should really help you until the player rewrite is done.

After the newest update to MIUI 13 that solution doesn't work at all. Cannot use a popup window - the phone doesn't respond to touching anywhere else.

moneytoo commented 2 years ago

This must be just some fixable issue as other video players using overlay window API (not the PiP) work just fine on Android 12 (Samsung Galaxy S21 FE). For example Nova Video Player or (when configured to use overlay window instead of native PiP) MX Player and OPlayer. I will try debugging that when I have some time. EDIT: Could it be because of FLAG_NOT_TOUCHABLE in the overlay drop zone for closing the popup?

AudricV commented 2 years ago

I made some tests and the non interaction of the screen on Android 12 is definitively caused by the close popup view button! By preventing its construction on Android 12+, other apps can get touches made to the screen.

However, several things in the player are based on this button, and just prevent the creation of this button crashes the app when resizing or moving the view. So, if the solution to this issue is to disable this button, at least for Android 12+, code using the close popup button will need to be updated.

AudricV commented 2 years ago

So, if the solution to this issue is to disable this button, at least for Android 12+, code using the close popup button will need to be updated.

I did it and the issue seems to be gone, at least on my emulator (Pixel 5 running Android 12).

However, I can't test the resize gesture.

Could you test this gesture and everything else with the popup player, using the following APK to see if I didn't break something with my changes (you can find them here: https://github.com/TiA4f8R/NewPipe/tree/disable-close-popup-button-creation-android-12-and-higher)? Thank you in advance!

app-debug.zip

werjany commented 2 years ago

made some tests and the non interaction of the screen on Android 12 is definitively caused by the close popup view button! By preventing its construction on Android 12+, other apps can get touches made to the screen.

However, several things in the player are based on this button, and just prevent the creation of this button crashes the app when resizing or moving the view. So, if the solution to this issue is to disable this button, at least for Android 12+, code using the close popup button will need to be updated.

I tried using your update. Didn't solve the problem (Xiaomi Mi Note 10 Lite, MIUI 13.0.1, Android 12). It is still impossible to use the overlaying window outside the app, nothing except bottom buttons, notifications and control centre interacts.

moneytoo commented 2 years ago

I did it and the issue seems to be gone, at least on my emulator (Pixel 5 running Android 12).

However, I can't test the resize gesture.

FYI: It is possible to use pinch to zoom (using standard mouse) in the emulator. There's some "secret" key combination to se the wanted initial zones for the gesture (last time I needed this I found the answer on StackOverflow).

Could you test this gesture and everything else with the popup player, using the following APK to see if I didn't break something with my changes (you can find them here: https://github.com/TiA4f8R/NewPipe/tree/disable-close-popup-button-creation-android-12-and-higher)? Thank you in advance!

Works for me seemingly fine on Android 12 (Samsung Galaxy S21 FE) including the window resize.

vnckppl commented 2 years ago

Running the fix on my Samsung a53 stock without any issues. Watching a video in popup mode while typing this comment.

AudricV commented 2 years ago

@moneytoo @vnckppl Sorry to ping you, but could you also test this APK and see if the issue is gone too?

It seems when setting a lower opacity to the close button (up to 0.8), we can also use the popup player on Android 12 and higher.

Could you test the following changes to see if they work (the source code is available here)? Thank you!

app-debug.zip

moneytoo commented 2 years ago

@TiA4f8R The attached build works perfectly for me when using the popup player.