Android and the camera2 Interface

To the long time readers, I apologize for the series of Android app posts (given that this blog is generally dominated by database or high performance systems type material, it surely sticks out for some users), but please excuse just one more.

Gallus, the hyperlapse/stabilization thing for Android (which I honestly thought would get more attention out of the gate. Instagram Hyperlapse-like — well…better than instagram hyperlapse — functionality for the dominant platform? The first and only product of this sort on the mobile OS? All of those media outlets that were gushing about Instagram’s offering, and then about their statements regarding missing APIs on Android…crickets), has been slowly building some inertia.

It has been installed on quite a variety of devices, and I’ve learned the many ways that things can fail unexpectedly on Android. When users have ROMs that allow them to override permissions that your app set as mandatory, it can lead to some really abnormal run conditions. Not to mention that Gallus uses some pretty cool functionality that I doubt has ever been touched on many devices, so the number of possible failure conditions is very high. Developers often make reference to the many devices they have to use to test on with Android, and while it is just farce for the majority of apps (even OpenGL games), when you’re dealing with the camera and encoders/decoders and OES textures, it really is true: I have no idea how the app runs on a Galaxy S6, and I can’t reasonably buy one just to see.

Anyways, one of the least impressive devices to run the app was the Nexus 5. While the results were rock solid on the Nexus4, timing variances and a deep image pipeline in the Nexus5 yielded a more hit or miss stabilization proposition.

No more, dear friends. Over the weekend I abstracted the whole camera mess, and now equally support the deprectated original camera interface, or the new camera2 interface for Lollipop devices with a non-legacy camera stack (I believe only the Nexus 5 and 6 support the full camera2 stack, but even the limited camera2 stack on a variety of other devices, including the Galaxy S6, will yield the timing benefits. Theoretically even the legacy wrapper of camera2 should provide the benefits, but in my testing on a Nexus 4 the results were so unpredictable that I simply revert to the old camera interface if the device declares itself a legacy device). The camera2 interface offers an enormous level of control (with that opening up new resolution and frame rate options), but more importantly for Gallus offered timing options that could yield a more consistent experience on those newer devices. On those devices that paradoxically had worse timing before.

So it has achieved greatness on the Nexus 5, and presumably 6, as well. Hopefully this carries over to other new devices. It also allows you to take videos at 2K/4K type resolutions if your device supports it. The camera2 interface has some rather odd implementation decisions, but it represents an enormous improvement over the sparse, arms-length (or more correctly football-field length) deprecated interface it replaces.