diff options
author | Vladimir Chtchetkine <vchtchetkine@google.com> | 2012-01-06 12:33:32 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-01-06 12:33:32 -0800 |
commit | 4387517c83737958222d2b06aa238a0f52358bac (patch) | |
tree | 61b477f587d495d04846261cdd4f0b60d49e7b39 /android | |
parent | 17d48cc1809075732813cd90eee10bc1efa4b52e (diff) | |
parent | f8675c20db7625adc69800ca4ac54e72846ac9a8 (diff) | |
download | external_qemu-4387517c83737958222d2b06aa238a0f52358bac.zip external_qemu-4387517c83737958222d2b06aa238a0f52358bac.tar.gz external_qemu-4387517c83737958222d2b06aa238a0f52358bac.tar.bz2 |
Merge "Respect 'camera' flag in AVD"
Diffstat (limited to 'android')
-rw-r--r-- | android/avd/hardware-properties.ini | 2 | ||||
-rw-r--r-- | android/camera/camera-service.c | 6 | ||||
-rw-r--r-- | android/main.c | 14 |
3 files changed, 20 insertions, 2 deletions
diff --git a/android/avd/hardware-properties.ini b/android/avd/hardware-properties.ini index 83a9300..ebf2450 100644 --- a/android/avd/hardware-properties.ini +++ b/android/avd/hardware-properties.ini @@ -117,7 +117,7 @@ description = Whether there is a GSM modem in the device. # Camera support name = hw.camera type = boolean -default = no +default = yes abstract = Camera support description = Whether the device has a camera. diff --git a/android/camera/camera-service.c b/android/camera/camera-service.c index 8f0e2ec..69b9524 100644 --- a/android/camera/camera-service.c +++ b/android/camera/camera-service.c @@ -438,6 +438,12 @@ _camera_service_init(CameraServiceDesc* csd) memset(ci, 0, sizeof(CameraInfo) * MAX_CAMERA); memset(csd->camera_info, 0, sizeof(CameraInfo) * MAX_CAMERA); csd->camera_count = 0; + + if (android_hw->hw_camera == 0) { + /* Camera emulation is disabled. Skip enumeration of webcameras. */ + return; + } + connected_cnt = enumerate_camera_devices(ci, MAX_CAMERA); if (connected_cnt <= 0) { /* Nothing is connected - nothing to emulate. */ diff --git a/android/main.c b/android/main.c index 56ae698..1adb6a1 100644 --- a/android/main.c +++ b/android/main.c @@ -1168,9 +1168,9 @@ int main(int argc, char **argv) } } + int webcam_num = 0; if (opts->webcam != NULL) { ParamList* pl = opts->webcam; - int webcam_num = 0; for ( ; pl != NULL; pl = pl->next ) { char webcam_name[64]; char webcam_dir[16]; @@ -1229,6 +1229,18 @@ int main(int argc, char **argv) hw->hw_webcam_count = webcam_num; } + /* Command line options related to webcam, and fake camera should + * override camera emulation flag, set in AVD. */ + if (hw->hw_camera == 0) { + /* Camera emulation is disabled in AVD. Lets see if command line enables + * webcam, or fake camera emulation. */ + if (webcam_num != 0 || + (opts->fake_camera && strcmp(hw->hw_fakeCamera, "off") != 0)) { + /* Command line parameters enable camera emulation. */ + hw->hw_camera = 1; + } + } + /* physical memory is now in hw->hw_ramSize */ hw->avd_name = ASTRDUP(avdInfo_getName(avd)); |