camera: common: Metadata: rework class structure, add set of supported camera ids
Change-Id: I86971831930aaea1394a4819d1c7c87c168d7bf5
Signed-off-by: Alexander Martinz <amartinz@shiftphones.com>
diff --git a/camera/common/src/main/java/com/shift/camera/Metadata.java b/camera/common/src/main/java/com/shift/camera/Metadata.java
index 3dc9ca3..246b3aa 100644
--- a/camera/common/src/main/java/com/shift/camera/Metadata.java
+++ b/camera/common/src/main/java/com/shift/camera/Metadata.java
@@ -1,12 +1,26 @@
package com.shift.camera;
+import android.hardware.camera2.params.SessionConfiguration;
+
+import java.util.HashSet;
+import java.util.Set;
+
public final class Metadata {
private Metadata() {
// empty
}
public static final class Bokeh {
- public static final Integer CAMERA_ID = 4;
+ public static final Integer SESSION_TYPE = 0x8003;
+
+ private static final Set<Integer> SUPPORTED_CAMERA_IDS = new HashSet<>();
+ static {
+ SUPPORTED_CAMERA_IDS.add(4);
+ }
+
+ public static boolean supportsCameraId(final int cameraId) {
+ return SUPPORTED_CAMERA_IDS.contains(cameraId);
+ }
public static final int CAPTURE_LEVEL_DEFAULT_VALUE = 75;
public static final int PREVIEW_LEVEL_DEFAULT_VALUE = 75;
@@ -16,13 +30,56 @@
}
}
- public static final class Session {
- public static final Integer TYPE_HDR = 0x8001;
- public static final Integer TYPE_LLS = 0x8001;
- public static final Integer TYPE_BOKEH = 0x8003;
- public static final Integer TYPE_VIDEO_STAB = 0x8004;
+ public static final class HDR {
+ public static final Integer SESSION_TYPE = 0x8001;
- private Session() {
+ private static final Set<Integer> SUPPORTED_CAMERA_IDS = new HashSet<>();
+ static {
+ SUPPORTED_CAMERA_IDS.add(0);
+ SUPPORTED_CAMERA_IDS.add(1);
+ }
+
+ public static boolean supportsCameraId(final int cameraId) {
+ return SUPPORTED_CAMERA_IDS.contains(cameraId);
+ }
+
+ private HDR() {
+ // empty
+ }
+ }
+
+ public static final class LowLightShot {
+ public static final Integer SESSION_TYPE = 0x8001;
+
+ private static final Set<Integer> SUPPORTED_CAMERA_IDS = new HashSet<>();
+ static {
+ SUPPORTED_CAMERA_IDS.add(0);
+ SUPPORTED_CAMERA_IDS.add(1);
+ }
+
+ public static boolean supportsCameraId(final int cameraId) {
+ return SUPPORTED_CAMERA_IDS.contains(cameraId);
+ }
+
+ private LowLightShot() {
+ // empty
+ }
+ }
+
+ public static final class VideoStabilization {
+ public static final Integer SESSION_TYPE = SessionConfiguration.SESSION_REGULAR;
+ public static final Integer STREAM_CONFIG_OPT_MODE = 0x8002;
+
+ private static final Set<Integer> SUPPORTED_CAMERA_IDS = new HashSet<>();
+ static {
+ SUPPORTED_CAMERA_IDS.add(0);
+ }
+
+ public static boolean supportsCameraId(final int cameraId) {
+ return SUPPORTED_CAMERA_IDS.contains(cameraId);
+ }
+
+ private VideoStabilization() {
// empty
}
}