Friday, December 2, 2022
HomeAndroidCameraX allows for better device compatibility

CameraX allows for better device compatibility

This was posted by The Android Teams

CameraX can be used Android The Jetpack library makes it simple to integrate camera functionality into your jetpack Android app. That’s why we focus heavily on device compatibility out-of-the-box, so you can focus on what makes your app unique.

In this post, we’ll look at three ways CameraX makes developers’ lives easier when it comes to device compatibility. First, we’ll take a peek into our CameraX Test Lab where we test over 150 physical phones every day. Second, we’ll look at Quirks, the mechanism CameraX uses to automatically handle device inconsistencies. Third, we’ll discuss the ways CameraX makes it easier to develop apps for foldable phones.

CameraX Test Lab

A single rack in our CameraX Test Lab on the left, and on the right, a moving image of the inside of a test inclusure with rotating phone mount 
(Left:) One rack in the CameraX Test Lab. Every test enclosure has two identical racks. Android Phones for testing the front and rear cameras. (Right) GIF showing inside of test enclosure. It includes a rotating phone mounting (for testing landscape orientations as well as portrait) and a high quality test chart (not shown).

CameraX was built in the CameraX Test Lab so that it can be tested on all platforms. Android The majority of people carry around a variety of devices in their pocket. In 2019, the Test Lab was opened with 52 models of phones. The Test Lab now has 150 phones models. Devices with the greatest daily user activity over the last 28 days are preferred (28DAUs), as well as devices that have a variety of system on a chip (SoCs). The Test Lab covers more than 750,000,000 28DAUs. Other products can also be tested. Android Versions going back to Android 5.1 (Lollipop).

Every phone model is equipped with its own testing enclosure, which allows it to be tested for environmental variables and light. Two phones from the same manufacturer are included in each test enclosure to make it easier for you to check the back and front cameras. On the opposite side of the test enclosure from the phones, there’s a high-resolution test chart. The chart contains industry-standard test methods for measuring camera characteristics like sharpness, color accuracy, resolution and dynamic range. Some elements of the chart are also useful for functional testing, such as face detection.

CameraX is a continuous test platform that allows you to use your APIs across multiple devices. Additionally, we’re continuously making improvements to the Test Lab, including adding new phones based on market trends to ensure that the majority of your users are well represented. Check out the Test Lab’s current list of test devices to see our most recent inventory.


Google provides a Camera Image Test Suite so that OEM’s cameras meet a baseline of consistency. Even so, the vast array of devices can be confusing. AndroidThere can be some differences between the user’s camera experience. CameraX uses an abstraction layer known as Quirks in order to reduce variations in camera behavior. CameraX is consistent across devices and requires no app developer effort.

We find these quirks based on our own manual testing, the Test Lab’s automatic testing, and bug reports filed in our public CameraX issue tracker. CameraX currently has more than 30 quirks which automatically correct behavior inconsistencies. These are just a few:

  • OnePixelShiftQuirk: Some phones can shift columns of pixels in converting YUV data into RGB. CameraX corrects this automatically on these phones.
  • ExtensionDisableQuirk: For phones that don’t support extensions or have broken behavior with extensions, CameraX disables certain extensions.
  • CameraUseInconsistentTimebaseQuirk: Many phones don’t properly time stamp audio and video. CameraX adjusts the timestamps for video and audio alignment.

CameraX can automatically handle unusual behavior from devices. We will continue to add more corrections as we find them, so app developers won’t have to deal with these one-offs on their own. If you find inconsistent behavior on a device you’re testing, you can file an issue in the CameraX component detailing the behavior and the device it’s happening on.

Foldable phones

The fastest-growing smartphone type is still the foldable. Camera development is complicated because of their flexibility with screen sizes. CameraX helps you develop your camera app on foldables in a number of ways.

CameraX’s Preview use case handles differences between the aspect ratio of the camera and the aspect ratio of the screen. This difference shouldn’t be significant for traditional smartphone and tablet forms factors. Section 7.5.5 of this manual explains. Android Compatibility Definition Document requires that the “long dimension of the camera aligns with the screen’s long dimension.” However, with foldable devices the screen aspect ratio can change, so this relationship might not always hold. CameraX can preserve aspect ratio with Filling the PreviewView. (This may crop the preview picture) Or fitting the image into PreviewView. (This may cause letterboxing and tabletarboxing). Set PreviewView.ScaleType to specify which method to use.

You can use your app in multiple windows with the rise in popularity of foldable devices. CameraX has been set-up to support multi-windows out of the box. CameraX takes care of all lifecycle management, which includes multi-window cases where other applications can have priority access singleton resources like the camera or microphone. CameraX is a single-window application that requires no extra effort from developers.

We’re always looking for more ways to improve CameraX to make it even easier to use. With respect to foldables, for example, we’re exploring ways to let developers call SetTargetResolution() You don’t have to think about the various configurations that a folding device could be used in. Stay tuned to this blog for new updates and the CameraX release notes!

CameraX: Get started

CameraX is easy to use with our many resources. CameraX’s codelab is the best place to start. CameraX’s codelab offers a wealth of information, including sample codes for various camera features. CameraX documentation provides a comprehensive overview of all that CameraX offers. For any other questions, please feel free to email us. free You can reach us via our CameraX discussion forum.

Trending Articles

Continue to the category
- Advertisment -spot_img

Most Popular