Skip to content

Commit 514a6cf

Browse files
Wu-cheng LiAndroid (Google) Code Review
authored andcommitted
Merge "Improve camera javadoc and fix some errors." into ics-mr0
2 parents 8da1191 + 53b3091 commit 514a6cf

File tree

2 files changed

+62
-30
lines changed

2 files changed

+62
-30
lines changed

core/java/android/hardware/Camera.java

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ public final void release() {
337337
* Camera objects are locked by default unless {@link #unlock()} is
338338
* called. Normally {@link #reconnect()} is used instead.
339339
*
340-
* <p>Since API level 13, camera is automatically locked for applications in
340+
* <p>Since API level 14, camera is automatically locked for applications in
341341
* {@link android.media.MediaRecorder#start()}. Applications can use the
342342
* camera (ex: zoom) after recording starts. There is no need to call this
343343
* after recording starts or stops.
@@ -356,7 +356,7 @@ public final void release() {
356356
* which will re-acquire the lock and allow you to continue using the
357357
* camera.
358358
*
359-
* <p>Since API level 13, camera is automatically locked for applications in
359+
* <p>Since API level 14, camera is automatically locked for applications in
360360
* {@link android.media.MediaRecorder#start()}. Applications can use the
361361
* camera (ex: zoom) after recording starts. There is no need to call this
362362
* after recording starts or stops.
@@ -781,7 +781,7 @@ public interface AutoFocusCallback
781781
* @see android.hardware.Camera.Parameters#setAutoWhiteBalanceLock(boolean)
782782
*/
783783
void onAutoFocus(boolean success, Camera camera);
784-
};
784+
}
785785

786786
/**
787787
* Starts camera auto-focus and registers a callback function to run when
@@ -804,11 +804,17 @@ public interface AutoFocusCallback
804804
* {@link android.hardware.Camera.Parameters#FLASH_MODE_OFF}, flash may be
805805
* fired during auto-focus, depending on the driver and camera hardware.<p>
806806
*
807-
* Auto-exposure lock {@link android.hardware.Camera.Parameters#getAutoExposureLock()}
807+
* <p>Auto-exposure lock {@link android.hardware.Camera.Parameters#getAutoExposureLock()}
808808
* and auto-white balance locks {@link android.hardware.Camera.Parameters#getAutoWhiteBalanceLock()}
809809
* do not change during and after autofocus. But auto-focus routine may stop
810810
* auto-exposure and auto-white balance transiently during focusing.
811811
*
812+
* <p>Stopping preview with {@link #stopPreview()}, or triggering still
813+
* image capture with {@link #takePicture(Camera.ShutterCallback,
814+
* Camera.PictureCallback, Camera.PictureCallback)}, will not change the
815+
* the focus position. Applications must call cancelAutoFocus to reset the
816+
* focus.</p>
817+
*
812818
* @param cb the callback to run
813819
* @see #cancelAutoFocus()
814820
* @see android.hardware.Camera.Parameters#setAutoExposureLock(boolean)
@@ -1059,8 +1065,7 @@ public interface FaceDetectionListener
10591065
/**
10601066
* Notify the listener of the detected faces in the preview frame.
10611067
*
1062-
* @param faces The detected faces in a list sorted by the confidence score.
1063-
* The highest scored face is the first element.
1068+
* @param faces The detected faces in a list
10641069
* @param camera The {@link Camera} service object
10651070
*/
10661071
void onFaceDetection(Face[] faces, Camera camera);
@@ -1121,7 +1126,7 @@ public final void stopFaceDetection() {
11211126

11221127
/**
11231128
* Information about a face identified through camera face detection.
1124-
*
1129+
*
11251130
* <p>When face detection is used with a camera, the {@link FaceDetectionListener} returns a
11261131
* list of face objects for use in focusing and metering.</p>
11271132
*
@@ -1140,7 +1145,9 @@ public Face() {
11401145
* the field of view. For example, suppose the size of the viewfinder UI
11411146
* is 800x480. The rect passed from the driver is (-1000, -1000, 0, 0).
11421147
* The corresponding viewfinder rect should be (0, 0, 400, 240). The
1143-
* width and height of the rect will not be 0 or negative.
1148+
* width and height of the rect will not be 0 or negative. The
1149+
* coordinates can be smaller than -1000 or bigger than 1000. But at
1150+
* least one vertex will be within (-1000, -1000) and (1000, 1000).
11441151
*
11451152
* <p>The direction is relative to the sensor orientation, that is, what
11461153
* the sensor sees. The direction is not affected by the rotation or
@@ -1653,23 +1660,36 @@ public class Parameters {
16531660
* call {@link #takePicture(Camera.ShutterCallback,
16541661
* Camera.PictureCallback, Camera.PictureCallback)} in this mode but the
16551662
* subject may not be in focus. Auto focus starts when the parameter is
1656-
* set. Applications should not call {@link
1657-
* #autoFocus(AutoFocusCallback)} in this mode. To stop continuous
1658-
* focus, applications should change the focus mode to other modes.
1663+
* set.
1664+
*
1665+
* <p>Since API level 14, applications can call {@link
1666+
* #autoFocus(AutoFocusCallback)} in this mode. The focus callback will
1667+
* immediately return with a boolean that indicates whether the focus is
1668+
* sharp or not. The focus position is locked after autoFocus call. If
1669+
* applications want to resume the continuous focus, cancelAutoFocus
1670+
* must be called. Restarting the preview will not resume the continuous
1671+
* autofocus. To stop continuous focus, applications should change the
1672+
* focus mode to other modes.
1673+
*
1674+
* @see #FOCUS_MODE_CONTINUOUS_PICTURE
16591675
*/
16601676
public static final String FOCUS_MODE_CONTINUOUS_VIDEO = "continuous-video";
16611677

16621678
/**
16631679
* Continuous auto focus mode intended for taking pictures. The camera
16641680
* continuously tries to focus. The speed of focus change is more
16651681
* aggressive than {@link #FOCUS_MODE_CONTINUOUS_VIDEO}. Auto focus
1666-
* starts when the parameter is set. If applications call {@link
1667-
* #autoFocus(AutoFocusCallback)} in this mode, the focus callback will
1668-
* immediately return with a boolean that indicates whether the focus is
1669-
* sharp or not. The apps can then decide if they want to take a picture
1670-
* immediately or to change the focus mode to auto, and run a full
1671-
* autofocus cycle. To stop continuous focus, applications should change
1672-
* the focus mode to other modes.
1682+
* starts when the parameter is set.
1683+
*
1684+
* <p>If applications call {@link #autoFocus(AutoFocusCallback)} in this
1685+
* mode, the focus callback will immediately return with a boolean that
1686+
* indicates whether the focus is sharp or not. The apps can then decide
1687+
* if they want to take a picture immediately or to change the focus
1688+
* mode to auto, and run a full autofocus cycle. The focus position is
1689+
* locked after autoFocus call. If applications want to resume the
1690+
* continuous focus, cancelAutoFocus must be called. Restarting the
1691+
* preview will not resume the continuous autofocus. To stop continuous
1692+
* focus, applications should change the focus mode to other modes.
16731693
*
16741694
* @see #FOCUS_MODE_CONTINUOUS_VIDEO
16751695
*/
@@ -3061,8 +3081,9 @@ public int getMaxNumFocusAreas() {
30613081
* when using zoom.</p>
30623082
*
30633083
* <p>Focus area only has effect if the current focus mode is
3064-
* {@link #FOCUS_MODE_AUTO}, {@link #FOCUS_MODE_MACRO}, or
3065-
* {@link #FOCUS_MODE_CONTINUOUS_VIDEO}.</p>
3084+
* {@link #FOCUS_MODE_AUTO}, {@link #FOCUS_MODE_MACRO},
3085+
* {@link #FOCUS_MODE_CONTINUOUS_VIDEO}, or
3086+
* {@link #FOCUS_MODE_CONTINUOUS_PICTURE}.</p>
30663087
*
30673088
* @return a list of current focus areas
30683089
*/

include/camera/CameraParameters.h

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ class CameraParameters
283283
// outside the current field of view, even when using zoom.
284284
//
285285
// Focus area only has effect if the current focus mode is FOCUS_MODE_AUTO,
286-
// FOCUS_MODE_MACRO, or FOCUS_MODE_CONTINOUS_VIDEO.
286+
// FOCUS_MODE_MACRO, FOCUS_MODE_CONTINUOUS_VIDEO, or
287+
// FOCUS_MODE_CONTINUOUS_PICTURE.
287288
// Example value: "(-10,-10,0,0,300),(0,0,10,10,700)". Read/write.
288289
static const char KEY_FOCUS_AREAS[];
289290
// Focal length in millimeter.
@@ -629,19 +630,29 @@ class CameraParameters
629630
// recording because the focus changes smoothly . Applications still can
630631
// call CameraHardwareInterface.takePicture in this mode but the subject may
631632
// not be in focus. Auto focus starts when the parameter is set.
632-
// Applications should not call CameraHardwareInterface.autoFocus in this
633-
// mode. To stop continuous focus, applications should change the focus mode
634-
// to other modes.
633+
//
634+
// Applications can call CameraHardwareInterface.autoFocus in this mode. The
635+
// focus callback will immediately return with a boolean that indicates
636+
// whether the focus is sharp or not. The focus position is locked after
637+
// autoFocus call. If applications want to resume the continuous focus,
638+
// cancelAutoFocus must be called. Restarting the preview will not resume
639+
// the continuous autofocus. To stop continuous focus, applications should
640+
// change the focus mode to other modes.
635641
static const char FOCUS_MODE_CONTINUOUS_VIDEO[];
636642
// Continuous auto focus mode intended for taking pictures. The camera
637643
// continuously tries to focus. The speed of focus change is more aggressive
638644
// than FOCUS_MODE_CONTINUOUS_VIDEO. Auto focus starts when the parameter is
639-
// set. If applications call autoFocus in this mode, the focus callback will
640-
// immediately return with a boolean that indicates the focus is sharp or
641-
// not. The apps can then decide if they want to take a picture immediately
642-
// or to change the focus mode to auto, and run a full autofocus cycle. To
643-
// stop continuous focus, applications should change the focus mode to other
644-
// modes.
645+
// set.
646+
//
647+
// If applications call CameraHardwareInterface.autoFocus in this mode, the
648+
// focus callback will immediately return with a boolean that indicates
649+
// whether the focus is sharp or not. The apps can then decide if they want
650+
// to take a picture immediately or to change the focus mode to auto, and
651+
// run a full autofocus cycle. The focus position is locked after autoFocus
652+
// call. If applications want to resume the continuous focus,
653+
// cancelAutoFocus must be called. Restarting the preview will not resume
654+
// the continuous autofocus. To stop continuous focus, applications should
655+
// change the focus mode to other modes.
645656
static const char FOCUS_MODE_CONTINUOUS_PICTURE[];
646657

647658
private:

0 commit comments

Comments
 (0)