diff options
-rw-r--r-- | src/com/android/camera/CaptureModule.java | 40 | ||||
-rw-r--r-- | src/com/android/camera/util/PersistUtil.java | 4 |
2 files changed, 43 insertions, 1 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 4d34cc27c..b33cb361f 100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -1708,11 +1708,49 @@ public class CaptureModule implements CameraModule, PhotoController, updateMaxVideoDuration(); } + private void updatePreviewSize() { + int preview_resolution = PersistUtil.getCameraPreviewSize(); + int width = mPreviewSize.getWidth(); + int height = mPreviewSize.getHeight(); + switch (preview_resolution) { + case 1: { + width = 640; + height = 480; + Log.v(TAG, "Preview resolution hardcoded to 640x480"); + break; + } + case 2: { + width = 720; + height = 480; + Log.v(TAG, "Preview resolution hardcoded to 720x480"); + break; + } + case 3: { + width = 1280; + height = 720; + Log.v(TAG, "Preview resolution hardcoded to 1280x720"); + break; + } + case 4: { + width = 1920; + height = 1080; + Log.v(TAG, "Preview resolution hardcoded to 1920x1080"); + break; + } + default: { + Log.v(TAG, "Preview resolution as per Snapshot aspect ratio"); + break; + } + } + mPreviewSize = new Size(width, height); + mUI.setPreviewSize(mPreviewSize.getWidth(), mPreviewSize.getHeight()); + } + @Override public void onResumeAfterSuper() { Log.d(TAG, "onResume " + getCameraMode()); initializeValues(); - mUI.setPreviewSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());; + updatePreviewSize(); mUI.showSurfaceView(); mUI.setSwitcherIndex(); mCameraIdList = new ArrayList<>(); diff --git a/src/com/android/camera/util/PersistUtil.java b/src/com/android/camera/util/PersistUtil.java index c9a5a474a..a39abaa82 100644 --- a/src/com/android/camera/util/PersistUtil.java +++ b/src/com/android/camera/util/PersistUtil.java @@ -35,6 +35,7 @@ public class PersistUtil { private static final String PERSIST_MEMORY_LIMIT = "persist.camera.perf.memlimit"; private static final String PERSIST_SKIP_MEMORY_CHECK = "persist.camera.perf.skip_memck"; private static final String PERSIST_LONGSHOT_SHOT_LIMIT = "persist.camera.longshot.shotnum"; + private static final String PERSIST_CAMERA_PREVIEW_SIZE = "persist.camera.preview.size"; public static int getMemoryLimit() { return SystemProperties.getInt(PERSIST_MEMORY_LIMIT, 60); @@ -48,4 +49,7 @@ public class PersistUtil { return SystemProperties.getInt(PERSIST_LONGSHOT_SHOT_LIMIT, 20); } + public static int getCameraPreviewSize() { + return SystemProperties.getInt(PERSIST_CAMERA_PREVIEW_SIZE, 0); + } } |