A special camera app for the Samsung Galaxy S4!

Recently I was fortunate enough to compile a working version of AOKP Nougat for the Samsung Galaxy S4 JFLTETMO/JFLTEXX phones (Praise God!). For the most part, it seems to work great. The only big issue is a problem with the camera.

It’s not that the camera doesn’t work. In fact it still takes wonderful pictures. What doesn’t work, however, is creating a video recording. Actually, it causes the camera app to crash just attempting to select video mode from the app. I tried several different apps, and they all produce the same results. So, I decided to do something about it.

I tried looking over the crash logs, and it just didn’t make enough sense for me to make changes to the device trees for the camera. But, I didn’t want to give up. Instead, I decided to make a custom camera app that would overcome these difficulties. By God’s grace, I was successful!

It is still a work in progress, but it works well enough for now. The actual command to open the camera and take a video just isn’t working, so I made a workaround. Instead, the camera app simply displays the camera on a surface view, and I leveraged root (su) permission to record that surface view to a file: /sdcard/Pictures/video.mp4. After the recording is complete, there is a command to rename the file the current time in milliseconds, so the user doesn’t have to worry about overwriting their just recorded video by making another recording.

There is a camera picture button, which allows you to take a picture. The picture is taken via the normal camera method, since that portion works correctly. To take a video, you can click on the 1m/3m icon to choose 1 minute or 3 minutes of video recording, then hit the record button. Once you press record, the icons disappear and only the camera view is displayed, as the surface view is being recorded.

There are currently two main problems:

  1. There is no way currently to stop the recording. You simply have to “wait it out”. After the 1 or 3 minutes that you chose are up, the icons re-appear and a pop-up informs you that it is done. If you exit the app at this time, your home screen will be recorded instead until the time expires.
  2. There is currently no audio. I am fairly new at Android app making, and this is a huge learning curve for me, so I have not gotten the audio figured out yet.

You can check it out on my Github if you would like to view the source, you are welcome to use or abuse the source code in any way that helps you with your own projects as well. The app is build-able in Android Studio.

https://github.com/alaskalinuxuser/S4camera_app

And, if you want to download the app, it is also located on that Github page.

Linux – keep it simple.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s