As most of you probably already know, Android 4.4 comes with a binary that allows you to record the display. It's nice to have this feature available but it's not the most convenient method to use. It would be a whole lot nicer if it were exposed to the user through the framework. I did just that and am here today to share it with the masses. I took the original screenrecord code and turned it into a native library with JNI bindings to allow using it in Java.
I've added hooks into PhoneWindowManager which allows the user to press power + volume up start/stop screen recording. Once recording is started there is an ongoing notification that can be pressed to stop recording as well. For those that don't have volume rockers or don't like pressing those two buttons together, I have a couple commits for you to pick which will add an option to the global actions menu that is displayed when you hold down the power button.
Now for the stuff you'll need to get this up and running in your own ROM.
For the core functionality you'll need one commit from frameworks/base and one from Settings as well as the ScreenRecorder app which contains the service that does the majority of the work.
frameworks/base
9a994be91c0cd262b7a28d19e8c2beaa48ba2bd9
Settings
671e2b98bd835e799003a3d13949e407f189b1a1
Screen Recorder app
https://github.com/ChameleonOS/android_packages_apps_ScreenRecorder
To get these built into your ROM you will need to add a couple products to PRODUCT_PACKAGES, you can decide where you want to add this.
If you want to add the option to the global actions menu, here are the two commits you will need.
frameworks/base
10cb81031549d33f2103fe5bc15d883c9aee50c9
Settings
a72dc8451cd21e133f9235297cb114ef2fc3d503
NEW - Audio recording
I currently have 3 patchesup for code review on github which add audio recording via the microphone. One for frameworks/base, one for Settings, and one for ScreenRecorder app. For those interested in trying out audio recording here are the links to the patches:
frameworks/base
f109bce6102931719e7baf778005da8748fa8d6b
Settings
64299a3556307354c6b4448cdcb8350d7ff2815b
ScreenRecorder
10866dcd8fc161cca55e6b3bc0470722722a2dc9
And if you want to test it out in the screenrecord binary, you can check out this patch.
And now I leave you with a couple of screenshots and a short video that was taken using this feature.
And a video showing off audio recording!
Note: I have no interest in working on back porting this to older versions of Android. If you want to give it a shot, knock yourself out but please don't reply to this thread or in PM about how to do it or how to overcome any obstacles you may face.
I've added hooks into PhoneWindowManager which allows the user to press power + volume up start/stop screen recording. Once recording is started there is an ongoing notification that can be pressed to stop recording as well. For those that don't have volume rockers or don't like pressing those two buttons together, I have a couple commits for you to pick which will add an option to the global actions menu that is displayed when you hold down the power button.
Now for the stuff you'll need to get this up and running in your own ROM.
For the core functionality you'll need one commit from frameworks/base and one from Settings as well as the ScreenRecorder app which contains the service that does the majority of the work.
frameworks/base
9a994be91c0cd262b7a28d19e8c2beaa48ba2bd9
Settings
671e2b98bd835e799003a3d13949e407f189b1a1
Screen Recorder app
https://github.com/ChameleonOS/android_packages_apps_ScreenRecorder
To get these built into your ROM you will need to add a couple products to PRODUCT_PACKAGES, you can decide where you want to add this.
Code:
# Screen recorder
PRODUCT_PACKAGES += \
ScreenRecorder \
libscreenrecorder
If you want to add the option to the global actions menu, here are the two commits you will need.
frameworks/base
10cb81031549d33f2103fe5bc15d883c9aee50c9
Settings
a72dc8451cd21e133f9235297cb114ef2fc3d503
NEW - Audio recording
I currently have 3 patches
frameworks/base
f109bce6102931719e7baf778005da8748fa8d6b
Settings
64299a3556307354c6b4448cdcb8350d7ff2815b
ScreenRecorder
10866dcd8fc161cca55e6b3bc0470722722a2dc9
And if you want to test it out in the screenrecord binary, you can check out this patch.
And now I leave you with a couple of screenshots and a short video that was taken using this feature.
And a video showing off audio recording!
Last edited: