[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 简介

上一篇:易语言21天速成视频教程


下一篇:2020年下载YouTube视频的最佳方法(支持1080P/2K/4K/8K)