am 17ae3597: Revert "android.hardware.Camera.open only returns back-facing camera."

* commit '17ae359721ba74399e785369346509b776999d1f':
  Revert "android.hardware.Camera.open only returns back-facing camera."
This commit is contained in:
Wu-cheng Li
2010-11-08 12:19:26 -08:00
committed by Android Git Automerger
2 changed files with 21 additions and 13 deletions

View File

@@ -75363,6 +75363,16 @@
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"

View File

@@ -211,7 +211,8 @@ public class Camera {
* blocking the main application UI thread.
*
* @param cameraId the hardware camera to access, between 0 and
* {@link #getNumberOfCameras()}-1.
* {@link #getNumberOfCameras()}-1. Use {@link #CAMERA_ID_DEFAULT}
* to access the default camera.
* @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).
@@ -221,21 +222,18 @@ public class 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.
* 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.
* @see #open(int)
*/
public static Camera open() {
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;
return new Camera(CAMERA_ID_DEFAULT);
}
Camera(int cameraId) {