4.2 CameraService的部分代码,和4.1的版本的区别还是比较大的,具体变化多大还没来得及分析.先从他们的代码布局变化看起吧
Android_JellyBean_4.1.2 Camera Service代码布局:
frameworks/av/services/camera/libcameraservice/Android.mk
frameworks/av/services/camera/libcameraservice/CameraHardwareInterface.h
frameworks/av/services/camera/libcameraservice/CameraHardwareStub.cpp
frameworks/av/services/camera/libcameraservice/CameraHardwareStub.h
frameworks/av/services/camera/libcameraservice/CameraService.cpp
frameworks/av/services/camera/libcameraservice/CameraService.h
frameworks/av/services/camera/libcameraservice/CannedJpeg.h
frameworks/av/services/camera/libcameraservice/FakeCamera.cpp
frameworks/av/services/camera/libcameraservice/FakeCamera.h
Android.mk中的内容如下:
LOCAL_PATH:= $(call my-dir)
#
# libcameraservice
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
CameraService.cpp
LOCAL_SHARED_LIBRARIES:= \
libui \
libutils \
libbinder \
libcutils \
libmedia \
libmedia_native \
libcamera_client \
libgui \
libhardware
LOCAL_MODULE:= libcameraservice
include $(BUILD_SHARED_LIBRARY)
Android_JellyBean_4.2.1 Camera Service代码布局:
frameworks/av/services/camera/libcameraservice/Android.mk
frameworks/av/services/camera/libcameraservice/Camera2Client.cpp
frameworks/av/services/camera/libcameraservice/Camera2Client.h
frameworks/av/services/camera/libcameraservice/Camera2Device.cpp
frameworks/av/services/camera/libcameraservice/Camera2Device.h
frameworks/av/services/camera/libcameraservice/CameraClient.cpp
frameworks/av/services/camera/libcameraservice/CameraClient.h
frameworks/av/services/camera/libcameraservice/CameraService.cpp
frameworks/av/services/camera/libcameraservice/CameraHardwareInterface.h
frameworks/av/services/camera/libcameraservice/CameraService.h
frameworks/av/services/camera/libcameraservice/camera2/BurstCapture.cpp
frameworks/av/services/camera/libcameraservice/camera2/BurstCapture.h
frameworks/av/services/camera/libcameraservice/camera2/CallbackProcessor.cpp
frameworks/av/services/camera/libcameraservice/camera2/CallbackProcessor.h
frameworks/av/services/camera/libcameraservice/camera2/CameraMetadata.cpp
frameworks/av/services/camera/libcameraservice/camera2/CameraMetadata.h
frameworks/av/services/camera/libcameraservice/camera2/Camera2Heap.h
frameworks/av/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
frameworks/av/services/camera/libcameraservice/camera2/CaptureSequencer.h
frameworks/av/services/camera/libcameraservice/camera2/FrameProcessor.cpp
frameworks/av/services/camera/libcameraservice/camera2/FrameProcessor.h
frameworks/av/services/camera/libcameraservice/camera2/JpegCompressor.cpp
frameworks/av/services/camera/libcameraservice/camera2/JpegCompressor.h
frameworks/av/services/camera/libcameraservice/camera2/JpegProcessor.cpp
frameworks/av/services/camera/libcameraservice/camera2/JpegProcessor.h
frameworks/av/services/camera/libcameraservice/camera2/Parameters.cpp
frameworks/av/services/camera/libcameraservice/camera2/Parameters.h
frameworks/av/services/camera/libcameraservice/camera2/StreamingProcessor.cpp
frameworks/av/services/camera/libcameraservice/camera2/StreamingProcessor.h
frameworks/av/services/camera/libcameraservice/camera2/ZslProcessor.cpp
frameworks/av/services/camera/libcameraservice/camera2/ZslProcessor.h
Android.mk中的内容:
LOCAL_PATH:= $(call my-dir)
#
# libcameraservice
#
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
CameraService.cpp \
CameraClient.cpp \
Camera2Client.cpp \
Camera2Device.cpp \
camera2/CameraMetadata.cpp \
camera2/Parameters.cpp \
camera2/FrameProcessor.cpp \
camera2/StreamingProcessor.cpp \
camera2/JpegProcessor.cpp \
camera2/CallbackProcessor.cpp \
camera2/ZslProcessor.cpp \
camera2/BurstCapture.cpp \
camera2/JpegCompressor.cpp \
camera2/CaptureSequencer.cpp
LOCAL_SHARED_LIBRARIES:= \
libui \
libutils \
libbinder \
libcutils \
libmedia \
libmedia_native \
libcamera_client \
libgui \
libhardware \
libsync \
libcamera_metadata \
libjpeg
LOCAL_C_INCLUDES += \
system/media/camera/include \
external/jpeg
LOCAL_MODULE:= libcameraservice
include $(BUILD_SHARED_LIBRARY)
从两个Android.mk中可以看出,android4.2中在camera 中还是变动比较大,其中多了一个camera2目录
这个目录是由硬件抽象的版本来决定的,其实在4.1中的hardware/libhardware/include/hardware/Camera_common.h中就定义了下面两个宏
#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0)
这两个宏是控制camera HAL版本处理的,不过在貌似没使用