summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSai Kumar Sanagavarapu <ssanagav@codeaurora.org>2015-08-13 14:04:07 +0530
committerSteve Kondik <steve@cyngn.com>2016-08-03 15:44:39 -0700
commite0b7ffe41424df1bb2bd547e95be8420709140cc (patch)
tree96f24afa2a9edb696c86f0c954ef10549c2e5302
parent8e754707659e9c17c4c485ba17391887ffb0db7c (diff)
downloadandroid_packages_apps_Snap-e0b7ffe41424df1bb2bd547e95be8420709140cc.zip
android_packages_apps_Snap-e0b7ffe41424df1bb2bd547e95be8420709140cc.tar.gz
android_packages_apps_Snap-e0b7ffe41424df1bb2bd547e95be8420709140cc.tar.bz2
SnapdragonCamera: Limit preview size by capping display dimensions.
By capping the display panel dimensions, effectively limit the preview size configured to backend. This will help in optimizing power and bandwidth. Properties to be configured : camera.display.umax -> set it to the upper max of display panel size camera.display.lmax -> set it to the lower max of display panel size For example if the properties are set as below : adb shell setprop camera.display.umax 1920x1080 adb shell setprop camera.display.lmax 1280x720 Then, in devices having display panel size >1080p, panel size will be seen as 1080p. If its 1080p or lesser (but >=720p), limit it to next allowed max which is 720p. For < 720p, there is no need to do any capping. By capping the panel size, we are indirectly controlling the preview size being chosen in getOptimalPreviewSize(). Change-Id: Ia9963467dbda7fb47d96a96a345f26a5e38a95a1
-rw-r--r--src/com/android/camera/util/CameraUtil.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java
index 50fd139..9b728b6 100644
--- a/src/com/android/camera/util/CameraUtil.java
+++ b/src/com/android/camera/util/CameraUtil.java
@@ -52,6 +52,7 @@ import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.Toast;
+import android.os.SystemProperties;
import com.android.camera.CameraActivity;
import com.android.camera.CameraDisabledException;
@@ -523,6 +524,38 @@ public class CameraUtil {
private static Point getDefaultDisplaySize(Activity activity, Point size) {
activity.getWindowManager().getDefaultDisplay().getSize(size);
+ //cap the display resolution given to getOptimalPreviewSize if the below properties
+ //are set. For example if the properties are set as below :
+ //adb shell setprop camera.display.umax 1920x1080
+ //adb shell setprop camera.display.lmax 1280x720
+ //Then, in devices having display panel size >1080p, panel size will be seen as 1080p.
+ //If its 1080p or lesser (but >=720p), limit it to next allowed max which is 720p.
+ //For < 720p, there is no need to do any capping.
+ //By capping the panel size, we are indirectly controlling the preview size being
+ //chosen in getOptimalPreviewSize().
+ String uMax = SystemProperties.get("camera.display.umax", "");
+ String lMax = SystemProperties.get("camera.display.lmax", "");
+ if ((uMax.length() > 0) && (lMax.length() > 0)) {
+ Log.v(TAG,"display uMax "+ uMax + " lMax " + lMax);
+ String uMaxArr[] = uMax.split("x", 2);
+ String lMaxArr[] = lMax.split("x", 2);
+ try {
+ int uMaxWidth = Integer.parseInt(uMaxArr[0]);
+ int uMaxHeight = Integer.parseInt(uMaxArr[1]);
+ int lMaxWidth = Integer.parseInt(lMaxArr[0]);
+ int lMaxHeight = Integer.parseInt(lMaxArr[1]);
+ int defaultDisplaySize = (size.x * size.y);
+ if (defaultDisplaySize > (uMaxWidth*uMaxHeight)) {
+ size.set(uMaxWidth,uMaxHeight);
+ } else if (defaultDisplaySize >= (lMaxWidth*lMaxHeight)) {
+ size.set(lMaxWidth,lMaxHeight);
+ } else {
+ Log.v(TAG,"No need to cap display size");
+ }
+ } catch (Exception e) {
+ Log.e(TAG,"Invalid display properties");
+ }
+ }
return size;
}