Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does android.hardware.camera2.full come from?

I am trying to implement a camera app. and checking examples. Some examples contain following manifest feature: uses-feature android:name="android.hardware.camera2.full. I have checked official documents and google examples and none of them mentioning existing this feature. (or I am missing some).

What is the source of this feature and what is the difference between android.hardware.camera?


Edit: What confuses me was those examples on googlesamples:

https://github.com/googlesamples/android-Camera2Basic/blob/master/kotlinApp/Application/src/main/AndroidManifest.xml

and this

https://github.com/googlesamples/android-Camera2Basic/blob/master/Application/src/main/AndroidManifest.xml

and this

https://github.com/googlesamples/android-Camera2Raw/blob/master/Application/src/main/AndroidManifest.xml

They are using new Camera2 API and old manifest features. I don't know how both fits together.

like image 719
guness Avatar asked Jan 04 '18 12:01

guness


People also ask

What is Camera2 in Android?

Camera2 is the latest low-level Android camera package and replaces the deprecated Camera class. Camera2 provides in-depth controls for complex use cases, but requires you to manage device-specific configurations.

Is Camera2 deprecated?

camera2 API for new applications. This class was deprecated in API level 21. We recommend using the new android. hardware.

How do I know if my phone has Camera2 API?

Well, all you need to do is download a simple app called 'Camera2 API probe' from the Google Play Store and run it. The app gives detailed info about both the rear and front camera sensors of your Android phone. From that info, you can easily deduce whether your Android device supports Camera2 API or not.

What is Level 3 Camera2 API?

Full: These devices support all of the major capabilities of Camera API2 and must use Camera HAL 3.2 or higher and Android 5.0 or higher. Level_3: These devices support YUV reprocessing and RAW image capture, along with additional output stream configurations on top of full Camera2 API support.


3 Answers

As always, it's best to look in Android source code itself:

* A given camera device may provide support at one of two levels: limited or * full. If a device only supports the limited level, then Camera2 exposes a * feature set that is roughly equivalent to the older * {@link android.hardware.Camera Camera} API, although with a cleaner and more * efficient interface. Devices that implement the full level of support * provide substantially improved capabilities over the older camera * API. Applications that target the limited level devices will run unchanged on * the full-level devices; if your application requires a full-level device for * proper operation, declare the "android.hardware.camera2.full" feature in your * manifest.</p>

I hope that clarifies the nature of the feature you mentioned.

As for the camera2 apis - those were introduced in Android 5 (api level 21) as an attempt to create cleaner apis for interaction with the camera as opposed to the old camera api.

like image 186
aga Avatar answered Oct 17 '22 15:10

aga


The feature flags and the names of the camera APIs aren't actually related, even though they look the same.

The feature "android.hardware.camera" (PackageManager.FEATURE_CAMERA) means that the device has a back-facing camera. That's all; any app that wants to avoid being installed on a device with no back-facing camera needs to list that one.

It's not related to the Java android.hardware.Camera class.

The feature "android.hardware.camera.level.full" (PackageManager.FEATURE_CAMERA_LEVEL_FULL) says that at least one camera on the device supports the FULL hardware level when used via the android.hardware.camera2 API package.

So a device with a back-facing camera always lists "android.hardware.camera". If it's got a good camera, it'll also list "android.hardware.camera.level.full".

Since the sample apps for camera2 are meant to run on any quality of camera, they only require there to be a camera device, not that it has any particular level of capability.

I've seen some developers try to require a feature like "android.hardware.camera2"; there's no such feature defined in the Android SDK, so trying to require it means your app can't be installed on any device. The camera2 API is always available starting from Android 5.0 (Lollipop); it's just a question of what hardware level each camera device supports (LEGACY, LIMITED, FULL, or LEVEL_3).

like image 12
Eddy Talvala Avatar answered Oct 17 '22 17:10

Eddy Talvala


Android introduced Camera2 api since Android API 21, this new Camera api makes it more usable and easy to change parameters. The previous version was more limited in its capabilities.

Android Camera2 has 4 levels of implementations that depends on the manufacturer:

  1. Legacy: Its just a conversion between Camera2 and Camera. Just used for compatibility. Just some things of Camera2 work properly.
  2. Limited: Has Camera2 implementation, but not all the methods that are available. (Not all manufacturers implement the same methods so not everything will work on every device)
  3. Full: All methods of Camera2 are implemented. Usually manufacturers implement this on their flagship devices.
  4. Level 3: Additionally support YUV reprocessing and RAW image capture. (BEST CASE)

source here and personal experience.

like image 3
Ivan Avatar answered Oct 17 '22 15:10

Ivan