diff options
author | Wu-cheng Li <wuchengli@google.com> | 2010-11-09 01:55:44 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2010-11-09 02:20:02 +0800 |
commit | a48b70fa8ff6363d1e5282be70f6be12bc0688dc (patch) | |
tree | 05e0932b8491b3aaf2bc8d44d7222ae15ccc59ab | |
parent | 17ae359721ba74399e785369346509b776999d1f (diff) | |
download | frameworks_base-a48b70fa8ff6363d1e5282be70f6be12bc0688dc.zip frameworks_base-a48b70fa8ff6363d1e5282be70f6be12bc0688dc.tar.gz frameworks_base-a48b70fa8ff6363d1e5282be70f6be12bc0688dc.tar.bz2 |
Camera.open() should only return back-facing camera.
Also update current.xml and 9.xml. setRotationHint was also
missing from 9.xml.
bug:3173302
Change-Id: Idd3f7417a4d35c65910e9b08a1bfd157b91e1baa
-rw-r--r-- | api/9.xml | 23 | ||||
-rw-r--r-- | api/current.xml | 10 | ||||
-rw-r--r-- | core/java/android/hardware/Camera.java | 24 |
3 files changed, 26 insertions, 31 deletions
@@ -73399,16 +73399,6 @@ visibility="public" > </field> -<field name="CAMERA_ID_DEFAULT" - type="int" - transient="false" - volatile="false" - static="true" - final="false" - deprecated="not deprecated" - visibility="public" -> -</field> </class> <interface name="Camera.AutoFocusCallback" abstract="true" @@ -86967,6 +86957,19 @@ <parameter name="listener" type="android.media.MediaRecorder.OnInfoListener"> </parameter> </method> +<method name="setOrientationHint" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="degrees" type="int"> +</parameter> +</method> <method name="setOutputFile" return="void" abstract="false" diff --git a/api/current.xml b/api/current.xml index ac92b7a..fb3b998 100644 --- a/api/current.xml +++ b/api/current.xml @@ -73399,16 +73399,6 @@ visibility="public" > </field> -<field name="CAMERA_ID_DEFAULT" - type="int" - transient="false" - volatile="false" - static="true" - final="false" - deprecated="not deprecated" - visibility="public" -> -</field> </class> <interface name="Camera.AutoFocusCallback" abstract="true" diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java index 275e2eb..378189e 100644 --- a/core/java/android/hardware/Camera.java +++ b/core/java/android/hardware/Camera.java @@ -211,8 +211,7 @@ public class Camera { * blocking the main application UI thread. * * @param cameraId the hardware camera to access, between 0 and - * {@link #getNumberOfCameras()}-1. Use {@link #CAMERA_ID_DEFAULT} - * to access the default camera. + * {@link #getNumberOfCameras()}-1. * @return a new Camera object, connected, locked and ready for use. * @throws RuntimeException if connection to the camera service fails (for * example, if the camera is in use by another process). @@ -222,18 +221,21 @@ public class Camera { } /** - * The id for the default camera. - * @see #open(int) - */ - public static int CAMERA_ID_DEFAULT = 0; - - /** - * Equivalent to Camera.open(Camera.CAMERA_ID_DEFAULT). - * Creates a new Camera object to access the default camera. + * Creates a new Camera object to access the first back-facing camera on the + * device. If the device does not have a back-facing camera, this returns + * null. * @see #open(int) */ public static Camera open() { - return new Camera(CAMERA_ID_DEFAULT); + int numberOfCameras = getNumberOfCameras(); + CameraInfo cameraInfo = new CameraInfo(); + for (int i = 0; i < numberOfCameras; i++) { + getCameraInfo(i, cameraInfo); + if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) { + return new Camera(i); + } + } + return null; } Camera(int cameraId) { |