以下的代码源码路径都在? packages/apps/Camera2/ 下面,以下为调用流程
com.android.camera.CaptureModule -> takePictureNow()
com.android.camera.one.v2.initialization.GenericOneCameraImpl -> takePicture
com.android.camera.one.v2.photo.PictureTakerImpl -> takePicture(OneCamera.PhotoCaptureParameters params, final CaptureSession session)
com.android.camera.one.v2.photo.PictureTakerImpl -> run
com.android.camera.one.v2.photo.SimpleImageCaptureCommand -> run
com.android.camera.one.v2.imagesaver.MostRecentImageSaver -> addFullSizeImage -> close()
com.android.camera.one.v2.imagesaver.JpegImageBackendImageSaver -> saveAndCloseImage
com.android.camera.processing.imagebackend.ImageBackend -> receiveImage(ImageToProcess img, Set<TaskImageContainer> tasks,
boolean blockUntilImageRelease, boolean closeOnImageRelease,
Optional<Runnable> runnableWhenDone)
com.android.camera.processing.imagebackend.TaskCompressImageToJpeg.java -> run
以下的代码控制了图片保存的方向
final DeviceOrientation exifDerivedRotation;
if (exifOrientation == null) {
// No existing rotation value is assumed to be 0
// rotation.
exifDerivedRotation = DeviceOrientation.CLOCKWISE_0;
} else {
exifDerivedRotation = DeviceOrientation
.from(exifOrientation);
}
com.android.camera.session.PlaceholderManager -> finishPlaceholder
com.android.camera.Storage -> updateImage -> addImageToMediaStore ->getContentValuesForData
|