其他分享
首页 > 其他分享> > [RK3399][Android7.1] 调试笔记 --- 设置系统默认相机为1080p

[RK3399][Android7.1] 调试笔记 --- 设置系统默认相机为1080p

作者:互联网

Platform: RK3399
OS: Android 7.1
Kernel: v4.4.83

需求:
系统相机打开默认是1280*960,需要改成1920*1080


解决方法:

diff --git a/src/com/android/camera/settings/ResolutionSetting.java b/src/com/android/camera/settings/ResolutionSetting.java
index 50ee90c..a99ae92 100644
--- a/src/com/android/camera/settings/ResolutionSetting.java
+++ b/src/com/android/camera/settings/ResolutionSetting.java
@@ -143,7 +143,10 @@ public class ResolutionSetting {
                 pictureSize.width() > 0 && pictureSize.height() > 0;
 
         if (!isPictureSizeSettingSet || isPictureSizeBlacklisted || !isPictureSizeFromSettingsValid) {
-            final Rational aspectRatio = ResolutionUtil.ASPECT_RATIO_4x3;
+
+            //Kris,Use 1920*1080 as default preview size.
+            //final Rational aspectRatio = ResolutionUtil.ASPECT_RATIO_4x3;
+            final Rational aspectRatio = ResolutionUtil.ASPECT_RATIO_16x9;
 
             OneCameraCharacteristics cameraCharacteristics =
                     mOneCameraManager.getOneCameraCharacteristics(cameraId);


调用流程:

openCameraAndStartPreview -> 
  mAppController.getResolutionSetting().getPictureSize -> //获取图片的大小
    getPictureSize -> ResolutionSetting.java
      ResolutionUtil.getLargestPictureSize 	//默认如果没有设置,就会根据比例选择分辨率最大的一个
  updatePreviewBufferDimension ->
    mCamera.pickPreviewSize  -> 根据拍照图片大小选择对应的预览大小
      pickPreviewSize ->  Camera2PreviewSizeSelector.java
        CaptureModuleUtil.getOptimalPreviewSize


参考:
Android Camera2 简介

标签:src,java,settings,com,camera,Android7.1,RK3399,ResolutionSetting,1080p
来源: https://blog.csdn.net/kris_fei/article/details/93718381