beautypg.com

Camera, Non-autofocus cameras, Accelerometer – Google Android Compatibility Definition: Android 1.6 User Manual

Page 18

background image

8.9. Camera

Device implementations MUST include a camera. The included camera:

• MUST have a resolution of at least 2 megapixels
• SHOULD have either hardware auto-focus, or software auto-focus implemented in the camera

driver (transparent to application software)

• MAY have fixed-focus or EDOF (extended depth of field) hardware
• MAY include a flash. If the Camera includes a flash, the flash lamp MUST NOT be lit while an

android.hardware.Camera.PreviewCallback instance has been registered on a Camera preview
surface.

Device implementations MUST implement the following behaviors for the camera-related APIs
[

Resources

, 27]:

1. If an application has never called android.hardware.Camera.Parameters.setPreviewFormat(int),

then the device MUST use android.hardware.PixelFormat.YCbCr_420_SP for preview data
provided to application callbacks.

2. If an application registers an android.hardware.Camera.PreviewCallback instance and the

system calls the onPreviewFrame() method when the preview format is YCbCr_420_SP, the
data in the byte[] passed into onPreviewFrame() must further be in the NV21 encoding format.
(This is the format used natively by the 7k hardware family.) That is, NV21 MUST be the default.

8.9.1. Non-Autofocus Cameras

If a device lacks an autofocus camera, the device implementer MUST meet the additional requirements in
this section. Device implementations MUST implement the full Camera API included in the Android 1.6
SDK documentation in some reasonable way, regardless of actual camera hardware's capabilities.

For Android 1.6, if the camera lacks auto-focus, the device implementation MUST adhere to the following:

1. The system MUST include a read-only system property named "ro.workaround.noautofocus"

with the value of "1". This value is intended to be used by applications such as Android Market to
selectively identify device capabilities, and will be replaced in a future version of Android with a
robust API.

2. If an application calls android.hardware.Camera.autoFocus(), the system MUST call the

onAutoFocus() callback method on any registered
android.hardware.Camera.AutoFocusCallback instances, even though no focusing actually
happened. This is to avoid having existing applications break by waiting forever for an autofocus
callback that will never come.

3. The call to the AutoFocusCallback.onAutoFocus() method MUST be triggered by the driver or

framework in a new event on the main framework Looper thread. That is, Camera.autoFocus()
MUST NOT directly call AutoFocusCallback.onAutoFocus() since this violates the Android
framework threading model and will break apps.

8.10. Accelerometer

Device implementations MUST include a 3-axis accelerometer and MUST be able to deliver events at at
least 50 Hz. The coordinate system used by the accelerometer MUST comply with the Android sensor
coordinate system as detailed in the Android APIs [

Resources

, 28].