summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.xml33
-rw-r--r--core/java/android/hardware/Camera.java33
-rw-r--r--include/ui/CameraParameters.h10
-rw-r--r--libs/ui/CameraParameters.cpp3
4 files changed, 79 insertions, 0 deletions
diff --git a/api/current.xml b/api/current.xml
index 9f92b73..2fbd374 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -70193,6 +70193,17 @@
visibility="public"
>
</method>
+<method name="getFocalLength"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getFocusMode"
return="java.lang.String"
abstract="false"
@@ -70204,6 +70215,17 @@
visibility="public"
>
</method>
+<method name="getHorizontalViewAngle"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getInt"
return="int"
abstract="false"
@@ -70448,6 +70470,17 @@
visibility="public"
>
</method>
+<method name="getVerticalViewAngle"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
<method name="getWhiteBalance"
return="java.lang.String"
abstract="false"
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index 82012b0..47c2cac 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -720,6 +720,9 @@ public class Camera {
private static final String KEY_SCENE_MODE = "scene-mode";
private static final String KEY_FLASH_MODE = "flash-mode";
private static final String KEY_FOCUS_MODE = "focus-mode";
+ private static final String KEY_FOCAL_LENGTH = "focal-length";
+ private static final String KEY_HORIZONTAL_VIEW_ANGLE = "horizontal-view-angle";
+ private static final String KEY_VERTICAL_VIEW_ANGLE = "vertical-view-angle";
// Parameter key suffix for supported values.
private static final String SUPPORTED_VALUES_SUFFIX = "-values";
@@ -1507,6 +1510,36 @@ public class Camera {
}
/**
+ * Gets the focal length (in millimeter) of the camera.
+ *
+ * @return the focal length. This method will always return a valid
+ * value.
+ */
+ public float getFocalLength() {
+ return Float.parseFloat(get(KEY_FOCAL_LENGTH));
+ }
+
+ /**
+ * Gets the horizontal angle of view in degrees.
+ *
+ * @return horizontal angle of view. This method will always return a
+ * valid value.
+ */
+ public float getHorizontalViewAngle() {
+ return Float.parseFloat(get(KEY_HORIZONTAL_VIEW_ANGLE));
+ }
+
+ /**
+ * Gets the vertical angle of view in degrees.
+ *
+ * @return vertical angle of view. This method will always return a
+ * valid value.
+ */
+ public float getVerticalViewAngle() {
+ return Float.parseFloat(get(KEY_VERTICAL_VIEW_ANGLE));
+ }
+
+ /**
* Gets current zoom value. This also works when smooth zoom is in
* progress.
*
diff --git a/include/ui/CameraParameters.h b/include/ui/CameraParameters.h
index cae0676..b9c2bbe 100644
--- a/include/ui/CameraParameters.h
+++ b/include/ui/CameraParameters.h
@@ -176,6 +176,16 @@ public:
// Supported focus modes.
// Example value: "auto,macro,fixed". Read only.
static const char KEY_SUPPORTED_FOCUS_MODES[];
+ // Focal length in millimeter.
+ // Example value: "4.31". Read only.
+ static const char KEY_FOCAL_LENGTH[];
+ // Horizontal angle of view in degrees.
+ // Example value: "54.8". Read only.
+ static const char KEY_HORIZONTAL_VIEW_ANGLE[];
+ // Vertical angle of view in degrees.
+ // Example value: "42.5". Read only.
+ static const char KEY_VERTICAL_VIEW_ANGLE[];
+
// Values for white balance settings.
static const char WHITE_BALANCE_AUTO[];
diff --git a/libs/ui/CameraParameters.cpp b/libs/ui/CameraParameters.cpp
index a94f6b9..495e164 100644
--- a/libs/ui/CameraParameters.cpp
+++ b/libs/ui/CameraParameters.cpp
@@ -56,6 +56,9 @@ const char CameraParameters::KEY_FLASH_MODE[] = "flash-mode";
const char CameraParameters::KEY_SUPPORTED_FLASH_MODES[] = "flash-mode-values";
const char CameraParameters::KEY_FOCUS_MODE[] = "focus-mode";
const char CameraParameters::KEY_SUPPORTED_FOCUS_MODES[] = "focus-mode-values";
+const char CameraParameters::KEY_FOCAL_LENGTH[] = "focal-length";
+const char CameraParameters::KEY_HORIZONTAL_VIEW_ANGLE[] = "horizontal-view-angle";
+const char CameraParameters::KEY_VERTICAL_VIEW_ANGLE[] = "vertical-view-angle";
// Values for white balance settings.
const char CameraParameters::WHITE_BALANCE_AUTO[] = "auto";