diff options
-rw-r--r-- | res/layout/camera.xml | 5 | ||||
-rw-r--r-- | res/values/colors.xml | 2 | ||||
-rw-r--r-- | res/values/dimens.xml | 2 | ||||
-rw-r--r-- | src/com/android/camera/CaptureModule.java | 6 | ||||
-rw-r--r-- | src/com/android/camera/CaptureModuleUI.java | 4 | ||||
-rw-r--r-- | src/com/android/camera/FocusOverlayManager.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/PhotoUI.java | 9 | ||||
-rw-r--r-- | src/com/android/camera/VideoModule.java | 3 | ||||
-rw-r--r-- | src/com/android/camera/debug/DebugPropertyHelper.java | 24 | ||||
-rw-r--r-- | src/com/android/camera/one/OneCameraManager.java | 12 | ||||
-rw-r--r-- | src/com/android/camera/one/v2/OneCameraImpl.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/ui/FaceView.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/ui/FocusOverlay.java | 6 |
13 files changed, 47 insertions, 32 deletions
diff --git a/res/layout/camera.xml b/res/layout/camera.xml index 25236473f..cda57e810 100644 --- a/res/layout/camera.xml +++ b/res/layout/camera.xml @@ -42,6 +42,11 @@ android:layout_width="match_parent" android:layout_height="match_parent" /> + <com.android.camera.ui.FaceView + android:id="@+id/face_view" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + <com.android.camera.ui.GridLines android:id="@+id/grid_lines" android:layout_width="match_parent" diff --git a/res/values/colors.xml b/res/values/colors.xml index a8ee96b61..8b6ee22b5 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -65,7 +65,7 @@ <color name="holo_blue_light">#ff33b5e5</color> <color name="bright_foreground_disabled_holo_dark">#ff4c4c4c</color> <color name="bright_foreground_holo_dark">#fff3f3f3</color> - <color name="face_detect_start">#80ffffff</color> + <color name="face_detect_start">#ffffff00</color> <color name="face_detect_success">#8050d060</color> <color name="face_detect_fail">#80d05060</color> <color name="gray">#FFAAAAAA</color> diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 31e855063..19c0e8ac6 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -92,7 +92,7 @@ <dimen name="focus_outer_stroke">3dp</dimen> <dimen name="focus_inner_stroke">2dp</dimen> <dimen name="switcher_size">72dp</dimen> - <dimen name="face_circle_stroke">2dip</dimen> + <dimen name="face_circle_stroke">1dip</dimen> <dimen name="shutter_offset">-22dp</dimen> <dimen name="size_thumbnail">200dip</dimen> <dimen name="size_preview">400dip</dimen> diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 0b2fb1877..da850adb0 100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -150,7 +150,7 @@ public class CaptureModule extends CameraModule private static final int ON_RESUME_TASKS_DELAY_MSEC = 20; /** System Properties switch to enable debugging focus UI. */ - private static final boolean FOCUS_DEBUG_UI = DebugPropertyHelper.showFocusDebugUI(); + private static final boolean CAPTURE_DEBUG_UI = DebugPropertyHelper.showCaptureDebugUI(); private final Object mDimensionLock = new Object(); @@ -660,7 +660,7 @@ public class CaptureModule extends CameraModule public void onFocusStatusUpdate(final AutoFocusMode mode, final AutoFocusState state) { Log.v(TAG, "AF status is mode:" + mode + " state:" + state); - if (FOCUS_DEBUG_UI) { + if (CAPTURE_DEBUG_UI) { // TODO: Add debug circle radius+color UI to FocusOverlay. // mMainHandler.post(...) } @@ -668,7 +668,7 @@ public class CaptureModule extends CameraModule // If mTapToFocusInProgress, clear UI. if (mTapToFocusInProgress) { // Clear UI on return to CONTINUOUS_PICTURE (debug mode). - if (FOCUS_DEBUG_UI) { + if (CAPTURE_DEBUG_UI) { if (mode == AutoFocusMode.CONTINUOUS_PICTURE) { mTapToFocusInProgress = false; mMainHandler.removeCallbacks(mHideAutoFocusTargetRunnable); diff --git a/src/com/android/camera/CaptureModuleUI.java b/src/com/android/camera/CaptureModuleUI.java index bbb7c60c4..74678dc0d 100644 --- a/src/com/android/camera/CaptureModuleUI.java +++ b/src/com/android/camera/CaptureModuleUI.java @@ -202,8 +202,8 @@ public class CaptureModuleUI implements public void setAutoFocusTarget(int x, int y) { // TODO: refactor. - boolean isAutoFocus = false; - mFocusUI.setFocusPosition(x, y, isAutoFocus); + boolean isPassiveScan = true; + mFocusUI.setFocusPosition(x, y, isPassiveScan); } public void clearAutoFocusIndicator() { diff --git a/src/com/android/camera/FocusOverlayManager.java b/src/com/android/camera/FocusOverlayManager.java index d236d8a71..fde7207ef 100644 --- a/src/com/android/camera/FocusOverlayManager.java +++ b/src/com/android/camera/FocusOverlayManager.java @@ -108,7 +108,7 @@ public class FocusOverlayManager implements PreviewStatusListener.PreviewAreaCha public interface FocusUI { public boolean hasFaces(); public void clearFocus(); - public void setFocusPosition(int x, int y, boolean isAutoFocus); + public void setFocusPosition(int x, int y, boolean isPassiveScan); public void onFocusStarted(); public void onFocusSucceeded(); public void onFocusFailed(); diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index 4d609a9b7..70699a7ed 100644 --- a/src/com/android/camera/PhotoUI.java +++ b/src/com/android/camera/PhotoUI.java @@ -33,6 +33,7 @@ import android.widget.FrameLayout; import android.widget.ImageView; import com.android.camera.FocusOverlayManager.FocusUI; +import com.android.camera.debug.DebugPropertyHelper; import com.android.camera.debug.Log; import com.android.camera.ui.CountDownView; import com.android.camera.ui.FaceView; @@ -65,7 +66,7 @@ public class PhotoUI implements PreviewStatusListener, private Dialog mDialog = null; // TODO: Remove face view logic if UX does not bring it back within a month. - private final FaceView mFaceView = null; + private final FaceView mFaceView; private DecodeImageForReview mDecodeTaskForReview = null; private float mZoomMax; @@ -234,6 +235,12 @@ public class PhotoUI implements PreviewStatusListener, mFocusUI = (FocusUI) mRootView.findViewById(R.id.focus_overlay); mPreviewOverlay = (PreviewOverlay) mRootView.findViewById(R.id.preview_overlay); mCountdownView = (CountDownView) mRootView.findViewById(R.id.count_down_view); + // Show faces if we are in debug mode. + if (DebugPropertyHelper.showCaptureDebugUI()) { + mFaceView = (FaceView) mRootView.findViewById(R.id.face_view); + } else { + mFaceView = null; + } if (mController.isImageCaptureIntent()) { initIntentReviewImageView(); diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index 8b2c4fe44..d2619baab 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -227,7 +227,8 @@ public class VideoModule extends CameraModule ? new CameraAgent.CameraAFMoveCallback() { @Override public void onAutoFocusMoving(boolean moving, CameraProxy camera) { - mFocusManager.onAutoFocusMoving(moving); + // mFocusManager.onAutoFocusMoving(moving) not called because UI + // not compatible with vertical video hint UI. } } : null; diff --git a/src/com/android/camera/debug/DebugPropertyHelper.java b/src/com/android/camera/debug/DebugPropertyHelper.java index 122738f21..0500f5e1c 100644 --- a/src/com/android/camera/debug/DebugPropertyHelper.java +++ b/src/com/android/camera/debug/DebugPropertyHelper.java @@ -29,10 +29,14 @@ public class DebugPropertyHelper { /** Switch between PhotoModule and the new CaptureModule. */ private static final String PROP_ENABLE_CAPTURE_MODULE = PREFIX + ".newcapture"; - /** Enable additional focus logging. */ - private static final String PROP_FOCUS_DEBUG_LOG = PREFIX + ".frame_log"; - /** Enable additional debug UI to show AE, AF, Face detection states */ - private static final String PROP_3A_DEBUG_UI = PREFIX + ".debug_ui"; + /** Enable frame-by-frame focus logging. */ + private static final String PROP_FRAME_LOG = PREFIX + ".frame_log"; + /** + * Enable additional capture debug UI. + * For API1/Photomodule: show faces. + * For API2/Capturemodule: show faces, AF state, AE/AF precise regions. + */ + private static final String PROP_CAPTURE_DEBUG_UI = PREFIX + ".debug_ui"; /** Write data about each capture request to disk. */ private static final String PROP_WRITE_CAPTURE_DATA = PREFIX + ".capture_write"; @@ -44,16 +48,12 @@ public class DebugPropertyHelper { return ALL_3A_DEBUG_ON || isPropertyOn(PROP_ENABLE_CAPTURE_MODULE); } - public static boolean showFocusDebugLog() { - return ALL_3A_DEBUG_ON || isPropertyOn(PROP_FOCUS_DEBUG_LOG); + public static boolean showFrameDebugLog() { + return ALL_3A_DEBUG_ON || isPropertyOn(PROP_FRAME_LOG); } - public static boolean showFocusDebugUI() { - return ALL_3A_DEBUG_ON || isPropertyOn(PROP_3A_DEBUG_UI); - } - - public static boolean showFaceDebugUI() { - return ALL_3A_DEBUG_ON || isPropertyOn(PROP_3A_DEBUG_UI); + public static boolean showCaptureDebugUI() { + return ALL_3A_DEBUG_ON || isPropertyOn(PROP_CAPTURE_DEBUG_UI); } public static boolean writeCaptureData() { diff --git a/src/com/android/camera/one/OneCameraManager.java b/src/com/android/camera/one/OneCameraManager.java index 25f34cb4f..dc83d143b 100644 --- a/src/com/android/camera/one/OneCameraManager.java +++ b/src/com/android/camera/one/OneCameraManager.java @@ -86,7 +86,7 @@ public abstract class OneCameraManager { .getSystemService(Context.CAMERA_SERVICE); int maxMemoryMB = activity.getServices().getMemoryManager() .getMaxAllowedNativeMemoryAllocation(); - if (cameraManager != null && isCamera2FullySupported(cameraManager)) { + if (cameraManager != null && isCamera2Supported(cameraManager)) { return new com.android.camera.one.v2.OneCameraManagerImpl(cameraManager, maxMemoryMB, displayMetrics); } else { @@ -95,7 +95,7 @@ public abstract class OneCameraManager { } /** - * Returns whether the device fully supports API2, + * Returns whether the device fully supports API2 * * @param cameraManager the Camera2 API manager. * @return If this device is only emulating Camera2 API on top of an older @@ -103,12 +103,16 @@ public abstract class OneCameraManager { * only returns true, if Camera2 is fully supported through newer * HALs. */ - private static boolean isCamera2FullySupported(CameraManager cameraManager) { + private static boolean isCamera2Supported(CameraManager cameraManager) { try { final String id = cameraManager.getCameraIdList()[0]; + // TODO: We should check for all the flags we need to ensure the + // device is capable of taking Camera2 API shots. For now, let's + // accept all device that are either 'partial' or 'full' devices + // (but not legacy). return cameraManager.getCameraCharacteristics(id).get( CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL) - == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_FULL; + != CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY; } catch (CameraAccessException ex) { Log.e(TAG, "Could not access camera to determine hardware-level API support."); return false; diff --git a/src/com/android/camera/one/v2/OneCameraImpl.java b/src/com/android/camera/one/v2/OneCameraImpl.java index b677275ad..76e3e2997 100644 --- a/src/com/android/camera/one/v2/OneCameraImpl.java +++ b/src/com/android/camera/one/v2/OneCameraImpl.java @@ -85,7 +85,7 @@ public class OneCameraImpl extends AbstractOneCamera { /** If true, will write data about each capture request to disk. */ private static final boolean DEBUG_WRITE_CAPTURE_DATA = DebugPropertyHelper.writeCaptureData(); /** If true, will log per-frame AF info. */ - private static final boolean DEBUG_FOCUS_LOG = DebugPropertyHelper.showFocusDebugLog(); + private static final boolean DEBUG_FOCUS_LOG = DebugPropertyHelper.showFrameDebugLog(); /** Default JPEG encoding quality. */ private static final Byte JPEG_QUALITY = 90; diff --git a/src/com/android/camera/ui/FaceView.java b/src/com/android/camera/ui/FaceView.java index 8d5c292ca..144031f2d 100644 --- a/src/com/android/camera/ui/FaceView.java +++ b/src/com/android/camera/ui/FaceView.java @@ -212,7 +212,7 @@ public class FaceView extends View } mPaint.setColor(mColor); mRect.offset(mPreviewArea.left, mPreviewArea.top); - canvas.drawOval(mRect, mPaint); + canvas.drawRect(mRect, mPaint); } canvas.restore(); } diff --git a/src/com/android/camera/ui/FocusOverlay.java b/src/com/android/camera/ui/FocusOverlay.java index 6d95e074d..46f640c25 100644 --- a/src/com/android/camera/ui/FocusOverlay.java +++ b/src/com/android/camera/ui/FocusOverlay.java @@ -48,7 +48,6 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI { private final int mFocusIndicatorSize; private boolean mShowIndicator; private final int mFocusOuterRingSize; - private boolean mCurrentRunIsAutoFocus = true; public FocusOverlay(Context context, AttributeSet attrs) { super(context, attrs); @@ -70,7 +69,7 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI { } @Override - public void setFocusPosition(int x, int y, boolean isAutoFocus) { + public void setFocusPosition(int x, int y, boolean isPassiveScan) { mPositionX = x; mPositionY = y; mBounds.set(x - mFocusIndicatorSize / 2, y - mFocusIndicatorSize / 2, @@ -78,7 +77,6 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI { mFocusIndicator.setBounds(mBounds); mFocusOuterRing.setBounds(x - mFocusOuterRingSize / 2, y - mFocusOuterRingSize / 2, x + mFocusOuterRingSize / 2, y + mFocusOuterRingSize / 2); - mCurrentRunIsAutoFocus = isAutoFocus; if (getVisibility() != VISIBLE) { setVisibility(VISIBLE); } @@ -127,7 +125,7 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI { public void onDraw(Canvas canvas) { super.onDraw(canvas); - if (mShowIndicator && !mCurrentRunIsAutoFocus) { + if (mShowIndicator) { mFocusOuterRing.draw(canvas); canvas.save(); canvas.rotate(mAngle, mPositionX, mPositionY); |