From 4b6ade90186f024ce6986a5a13efa3be9e9c8d80 Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Tue, 5 Nov 2013 16:43:50 +0200 Subject: Camera: Cleanup hardware key handling * Fix power shutter behaviour in camcorder mode * Disable volume change while in panorama mode, volume buttons should only handle camera operations while in the camera * Add camera/power/volume key shutter handling in panorama mode On devices with a hardware camera key: * Disable power & volume shutter features * Volume buttons control the zoom On devices without a hardware camera key: * When power shutter is disabled, volume buttons control the shutter (like AOSP) * When power shutter is enabled, volume buttons control the zoom Change-Id: I141946d5b6f5aec8b1e9a9f99270d30295596079 --- src/com/android/camera/util/CameraUtil.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/com/android/camera/util/CameraUtil.java') diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java index 966caa6ad..316d3419e 100644 --- a/src/com/android/camera/util/CameraUtil.java +++ b/src/com/android/camera/util/CameraUtil.java @@ -118,6 +118,9 @@ public class CameraUtil { public static final String TRUE = "true"; public static final String FALSE = "false"; + // Hardware camera key mask + private static final int KEY_MASK_CAMERA = 0x20; + // Fields for the show-on-maps-functionality private static final String MAPS_PACKAGE_NAME = "com.google.android.apps.maps"; private static final String MAPS_CLASS_NAME = "com.google.android.maps.MapsActivity"; @@ -154,6 +157,10 @@ public class CameraUtil { return (supported != null) && supported.contains(SCENE_MODE_HDR); } + public static boolean hasCameraKey() { + return (sDeviceKeysPresent & KEY_MASK_CAMERA) != 0; + } + public static boolean isMeteringAreaSupported(Parameters params) { return params.getMaxNumMeteringAreas() > 0; } @@ -179,6 +186,9 @@ public class CameraUtil { private static float sPixelDensity = 1; private static ImageFileNamer sImageFileNamer; + // Get available hardware keys + private static int sDeviceKeysPresent; + private CameraUtil() { } @@ -190,6 +200,8 @@ public class CameraUtil { sPixelDensity = metrics.density; sImageFileNamer = new ImageFileNamer( context.getString(R.string.image_file_name_format)); + sDeviceKeysPresent = context.getResources().getInteger( + com.android.internal.R.integer.config_deviceHardwareKeys); } public static int dpToPixel(int dp) { -- cgit v1.2.3