12

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.

guness
  • 6,336
  • 7
  • 59
  • 88
  • `android.hardware.camera` is deprecated – AskNilesh Jan 04 '18 at 12:15
  • 1
    @halfer will try to keep in mind. agreed with you. – guness Jan 16 '18 at 15:54
  • @NileshRathod The feature is still called android.hardware.camera so even though you are using the new camera2 api, you still need the same feature. Cant find any reference for a feature called camera2 – Yashvit Feb 19 '19 at 11:32

4 Answers4

12

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).

Eddy Talvala
  • 17,243
  • 2
  • 42
  • 47
9

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.

aga
  • 27,954
  • 13
  • 86
  • 121
  • 3
    How come this android.hardware.camera2.full feature is not listed here? https://developer.android.com/guide/topics/manifest/uses-feature-element#features-reference When I add this feature in the manifest, it shows 0 supported devices in playstore! – Yashvit Feb 19 '19 at 11:22
  • This might help with your supported devices https://stackoverflow.com/questions/33063254/google-play-zero-supported-devices-not-able-to-find-app – DrkStr Oct 18 '19 at 01:45
  • @Yashvit the link in the answer is outdated, in newer versions of CameraDevice.java, the feature is said to be "android.hardware.camera.level.full", which corresponds to PackageManager.FEATURE_CAMERA_LEVEL_FULL – ssynhtn Nov 11 '19 at 17:15
3

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.

Ivan
  • 782
  • 11
  • 23
1

If we just navigate to abstract class in Android studio we will get more clarity it provides the below information

/** *

The CameraDevice class is a representation of a single camera connected to an * Android device, allowing for fine-grain control of image capture and * post-processing at high frame rates.

* *

Your application must declare the * {@link android.Manifest.permission#CAMERA Camera} permission in its manifest * in order to access camera devices.

* *

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.camera.level.full" feature in your * manifest.

* * @see CameraManager#openCamera * @see android.Manifest.permission#CAMERA */ public abstract class CameraDevice implements AutoCloseable {

So there no need or I believe nothing which says camera2 and the same as been pointed out by others.

Manoj Mohanty
  • 372
  • 2
  • 10