Android O’s Picture-in-Picture Mode can be Enabled Right Now, Here’s How
Feature image: Picture-in-picture mode on an Android TV
Picture-in-picture mode (PiP) is a feature of some television receivers allowing the device to display one program in an inset window while another program is running. This feature made its way to Android TV devices starting in Android 7.0 Nougat, but Google recently announced that the feature will be making its way to Android phones running Android O. With Android O, developers that update their apps to support PiP mode can now also specify the aspect ratio as well as custom interactions with the window such as toggling play/pause.
Users on devices that are a part of the Android O Developer Preview have been able to try out the revamped notifications and other tweaks, but thus far have been unable to try out picture-in-picture mode on their devices. However, it’s actually possible to enable PiP on any device running Android O right now!
As you can see in the video above, we open up YouTube and navigated to a video. The video is paused, and then we press a navigation key which collapses the YouTube app and displays the video in an inset window on top of all other activities (such as Google Play Music and the Pixel Launcher). The window can be moved around the user interface, too.
We then press the window which restores the YouTube app to the video we opened, and then we start playback. Pressing the button to launch PiP mode now minimizes the YouTube app while the video is still playing! Currently, it appears to be a bit buggy with the YouTube app since the video doesn’t take up the entire window while playing, but we figured that PiP mode for phones is probably mostly useful for listening to audio while doing something else given the relatively small screens of smartphones compared to Android TV devices. Furthermore, this bug will probably be fixed in later versions of Android O or with an update to the YouTube app, but we’ll have to wait and see for that.
How to Enable Picture-in-Picture Mode
Okay, okay, we know what you’re really here for. How do I enable this myself? It’s actually quite simple. You need to send a certain key to trigger picture-in-picture mode on your Android phone. The KeyEvent is called “KEYCODE_WINDOW” and it is used by Android TV device remotes to toggle picture-in-picture mode. Fortunately, it works for phones on Android O as well!
In order to send this key from a tap on a navigation bar button, you need to use the hidden navigation bar tuner in SystemUI Tuner. Add a navigation button and select the button type to be “keycode” and look for keycode #171. Once you’ve done that, your navigation bar will now have a button that, when pressed inside of a supported app, will toggle PiP.
You might be already thinking: doesn’t this mean I have to have this key permanently on my navigation bar to use picture-in-picture mode? Not true! Stay tuned to the XDA Portal, as we’ll next be showing you how to display this key only in certain apps!
Thanks to Eli Irvin for discovering this!