diff options
-rw-r--r-- | res/values/colors.xml | 2 | ||||
-rw-r--r-- | src/com/android/camera/CaptureModule.java | 47 | ||||
-rw-r--r-- | src/com/android/camera/CaptureModuleUI.java | 10 | ||||
-rw-r--r-- | src/com/android/camera/FocusOverlayManager.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 9 | ||||
-rw-r--r-- | src/com/android/camera/app/FilmstripBottomPanel.java | 27 | ||||
-rw-r--r-- | src/com/android/camera/one/OneCamera.java | 3 | ||||
-rw-r--r-- | src/com/android/camera/one/OneCameraManager.java | 3 | ||||
-rw-r--r-- | src/com/android/camera/one/v2/OneCameraImpl.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/one/v2/OneCameraManagerImpl.java | 8 | ||||
-rw-r--r-- | src/com/android/camera/one/v2/OneCameraZslImpl.java | 3 | ||||
-rw-r--r-- | src/com/android/camera/ui/FocusOverlay.java | 138 | ||||
-rw-r--r-- | src/com/android/camera/widget/Cling.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/widget/ExternalViewerButton.java | 7 | ||||
-rw-r--r-- | src_pd/com/android/camera/one/v2/OneCameraCreator.java | 3 |
15 files changed, 204 insertions, 62 deletions
diff --git a/res/values/colors.xml b/res/values/colors.xml index 4c3069508..474809989 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -67,7 +67,7 @@ <color name="bright_foreground_holo_dark">#fff3f3f3</color> <color name="face_detect_start">#ffffff00</color> <color name="focus_debug">#90ffffff</color> - <color name="focus_debug_light">#50ffffff</color> + <color name="focus_debug_text">#b0ffffff</color> <color name="focus_debug_success">#9000ff00</color> <color name="focus_debug_fail">#90ff0000</color> <color name="gray">#FFAAAAAA</color> diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 16a0d6987..8fe036aa8 100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -30,6 +30,7 @@ import android.hardware.SensorManager; import android.location.Location; import android.net.Uri; import android.os.Handler; +import android.os.SystemClock; import android.provider.MediaStore; import android.view.KeyEvent; import android.view.OrientationEventListener; @@ -201,6 +202,10 @@ public class CaptureModule extends CameraModule /** True if in AF tap-to-focus sequence. */ private boolean mTapToFocusWaitForActiveScan = false; + /** Records beginning frame of each AF scan. */ + private long mAutoFocusScanStartFrame = -1; + /** Records beginning time of each AF scan in uptimeMillis. */ + private long mAutoFocusScanStartTime; /** Persistence of Tap to Focus target UI after scan complete. */ private static final int FOCUS_HOLD_UI_MILLIS = 0; @@ -768,13 +773,14 @@ public class CaptureModule extends CameraModule true, (int) (Settings3A.getAutoFocusRegionWidth() * mZoomValue * minEdge), (int) (Settings3A.getMeteringRegionWidth() * mZoomValue * minEdge)); + mUI.showAutoFocusInProgress(); } /** * Update UI based on AF state changes. */ @Override - public void onFocusStatusUpdate(final AutoFocusState state) { + public void onFocusStatusUpdate(final AutoFocusState state, long frameNumber) { Log.v(TAG, "AF status is state:" + state); switch (state) { @@ -784,7 +790,6 @@ public class CaptureModule extends CameraModule @Override public void run() { setAutoFocusTargetPassive(); - mUI.showAutoFocusInProgress(); } }); break; @@ -796,8 +801,7 @@ public class CaptureModule extends CameraModule mMainHandler.post(new Runnable() { @Override public void run() { - setAutoFocusTargetPassive(); - mMainHandler.post(mHideAutoFocusTargetRunnable); + mUI.setPassiveFocusSuccess(state == AutoFocusState.PASSIVE_FOCUSED); } }); break; @@ -810,6 +814,40 @@ public class CaptureModule extends CameraModule } break; } + + if (CAPTURE_DEBUG_UI) { + measureAutoFocusScans(state, frameNumber); + } + } + + private void measureAutoFocusScans(final AutoFocusState state, long frameNumber) { + // Log AF scan lengths. + boolean passive = false; + switch (state) { + case PASSIVE_SCAN: + case ACTIVE_SCAN: + if (mAutoFocusScanStartFrame == -1) { + mAutoFocusScanStartFrame = frameNumber; + mAutoFocusScanStartTime = SystemClock.uptimeMillis(); + } + break; + case PASSIVE_FOCUSED: + case PASSIVE_UNFOCUSED: + passive = true; + case ACTIVE_FOCUSED: + case ACTIVE_UNFOCUSED: + if (mAutoFocusScanStartFrame != -1) { + long frames = frameNumber - mAutoFocusScanStartFrame; + long dt = SystemClock.uptimeMillis() - mAutoFocusScanStartTime; + int fps = Math.round(frames * 1000f / dt); + String report = String.format("%s scan: fps=%d frames=%d", + passive ? "CAF" : "AF", fps, frames); + Log.v(TAG, report); + mUI.showDebugMessage(String.format("%d / %d", frames, fps)); + mAutoFocusScanStartFrame = -1; + } + break; + } } @Override @@ -834,7 +872,6 @@ public class CaptureModule extends CameraModule @Override public void onPictureTaken(CaptureSession session) { mAppController.getCameraAppUI().enableModeOptions(); - mAppController.getCameraAppUI().setShutterButtonEnabled(true); } @Override diff --git a/src/com/android/camera/CaptureModuleUI.java b/src/com/android/camera/CaptureModuleUI.java index 9b3b6abd3..67fb12f4c 100644 --- a/src/com/android/camera/CaptureModuleUI.java +++ b/src/com/android/camera/CaptureModuleUI.java @@ -25,7 +25,6 @@ import android.view.MotionEvent; import android.view.TextureView; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; import com.android.camera.debug.Log; import com.android.camera.ui.CountDownView; @@ -33,7 +32,6 @@ import com.android.camera.ui.PreviewOverlay; import com.android.camera.ui.PreviewOverlay.OnZoomChangedListener; import com.android.camera.ui.PreviewStatusListener; import com.android.camera.ui.ProgressOverlay; -import com.android.camera.util.UsageStatistics; import com.android.camera2.R; /** @@ -199,6 +197,14 @@ public class CaptureModuleUI implements mFocusUI.onFocusFailed(); } + public void setPassiveFocusSuccess(boolean success) { + mFocusUI.setPassiveFocusSuccess(success); + } + + public void showDebugMessage(String message) { + mFocusUI.showDebugMessage(message); + } + public void setAutoFocusTarget(int x, int y, boolean isPassiveScan, int afSize, int aeSize) { mFocusUI.setFocusPosition(x, y, isPassiveScan, afSize, aeSize); } diff --git a/src/com/android/camera/FocusOverlayManager.java b/src/com/android/camera/FocusOverlayManager.java index a48c11e7d..1c5e00ace 100644 --- a/src/com/android/camera/FocusOverlayManager.java +++ b/src/com/android/camera/FocusOverlayManager.java @@ -118,6 +118,8 @@ public class FocusOverlayManager implements PreviewStatusListener.PreviewAreaCha public void onFocusStarted(); public void onFocusSucceeded(); public void onFocusFailed(); + public void setPassiveFocusSuccess(boolean success); + public void showDebugMessage(String message); public void pauseFaceDetection(); public void resumeFaceDetection(); } diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index 53316a6e9..5f606eb29 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -1420,9 +1420,11 @@ public class PhotoModule outputStream.write(data); outputStream.close(); + Log.v(TAG, "saved result to URI: " + mSaveUri); mActivity.setResultEx(Activity.RESULT_OK); mActivity.finish(); } catch (IOException ex) { + Log.w(TAG, "exception saving result to URI: " + mSaveUri, ex); // ignore exception } finally { CameraUtil.closeSilently(outputStream); @@ -1432,6 +1434,7 @@ public class PhotoModule int orientation = Exif.getOrientation(exif); Bitmap bitmap = CameraUtil.makeBitmap(data, 50 * 1024); bitmap = CameraUtil.rotate(bitmap, orientation); + Log.v(TAG, "inlined bitmap into capture intent result"); mActivity.setResultEx(Activity.RESULT_OK, new Intent("inline-data").putExtra("data", bitmap)); mActivity.finish(); @@ -1447,11 +1450,14 @@ public class PhotoModule tempStream.write(data); tempStream.close(); tempUri = Uri.fromFile(path); + Log.v(TAG, "wrote temp file for cropping to: " + sTempCropFilename); } catch (FileNotFoundException ex) { + Log.w(TAG, "error writing temp cropping file to: " + sTempCropFilename, ex); mActivity.setResultEx(Activity.RESULT_CANCELED); mActivity.finish(); return; } catch (IOException ex) { + Log.w(TAG, "error writing temp cropping file to: " + sTempCropFilename, ex); mActivity.setResultEx(Activity.RESULT_CANCELED); mActivity.finish(); return; @@ -1464,6 +1470,7 @@ public class PhotoModule newExtras.putString("circleCrop", "true"); } if (mSaveUri != null) { + Log.v(TAG, "setting output of cropped file to: " + mSaveUri); newExtras.putParcelable(MediaStore.EXTRA_OUTPUT, mSaveUri); } else { newExtras.putBoolean(CameraUtil.KEY_RETURN_DATA, true); @@ -1478,7 +1485,7 @@ public class PhotoModule cropIntent.setData(tempUri); cropIntent.putExtras(newExtras); - + Log.v(TAG, "starting CROP intent for capture"); mActivity.startActivityForResult(cropIntent, REQUEST_CROP); } } diff --git a/src/com/android/camera/app/FilmstripBottomPanel.java b/src/com/android/camera/app/FilmstripBottomPanel.java index f9788561d..018476c18 100644 --- a/src/com/android/camera/app/FilmstripBottomPanel.java +++ b/src/com/android/camera/app/FilmstripBottomPanel.java @@ -16,6 +16,9 @@ package com.android.camera.app; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ObjectAnimator; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; @@ -269,17 +272,29 @@ class FilmstripBottomPanel implements CameraAppUI.BottomPanel { } public void show() { - if (mLayout.getTranslationY() > 0) { - mLayout.animate().translationY(0).setDuration(ANIM_DURATION) - .setInterpolator(Gusterpolator.INSTANCE); - } + ObjectAnimator animator = ObjectAnimator + .ofFloat(mLayout, "translationY", mLayout.getHeight(), 0.0f); + animator.setDuration(ANIM_DURATION); + animator.setInterpolator(Gusterpolator.INSTANCE); + animator.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + mViewButton.updateClingVisibility(); + } + }); + mViewButton.hideClings(); + animator.start(); } public void hide() { int offset = mLayout.getHeight(); if (mLayout.getTranslationY() < offset) { - mLayout.animate().translationY(offset).setDuration(ANIM_DURATION) - .setInterpolator(Gusterpolator.INSTANCE); + ObjectAnimator animator = ObjectAnimator + .ofFloat(mLayout, "translationY", mLayout.getTranslationY(), offset); + animator.setDuration(ANIM_DURATION); + animator.setInterpolator(Gusterpolator.INSTANCE); + mViewButton.hideClings(); + animator.start(); } } } diff --git a/src/com/android/camera/one/OneCamera.java b/src/com/android/camera/one/OneCamera.java index ab0f95ed8..1b7eccac1 100644 --- a/src/com/android/camera/one/OneCamera.java +++ b/src/com/android/camera/one/OneCamera.java @@ -204,8 +204,9 @@ public interface OneCamera { * Called when state of auto focus system changes. * * @param state Current auto focus state. + * @param frameNumber Frame number if available. */ - public void onFocusStatusUpdate(AutoFocusState state); + public void onFocusStatusUpdate(AutoFocusState state, long frameNumber); } /** diff --git a/src/com/android/camera/one/OneCameraManager.java b/src/com/android/camera/one/OneCameraManager.java index 4a4ed6e52..13f7dfe0b 100644 --- a/src/com/android/camera/one/OneCameraManager.java +++ b/src/com/android/camera/one/OneCameraManager.java @@ -87,7 +87,8 @@ public abstract class OneCameraManager { int maxMemoryMB = activity.getServices().getMemoryManager() .getMaxAllowedNativeMemoryAllocation(); if (cameraManager != null && isCamera2Supported(cameraManager)) { - return new com.android.camera.one.v2.OneCameraManagerImpl(cameraManager, maxMemoryMB, + return new com.android.camera.one.v2.OneCameraManagerImpl( + activity.getApplicationContext(), cameraManager, maxMemoryMB, displayMetrics, activity.getSoundPlayer()); } else { return new com.android.camera.one.v1.OneCameraManagerImpl(); diff --git a/src/com/android/camera/one/v2/OneCameraImpl.java b/src/com/android/camera/one/v2/OneCameraImpl.java index 16a027f7b..e27755d28 100644 --- a/src/com/android/camera/one/v2/OneCameraImpl.java +++ b/src/com/android/camera/one/v2/OneCameraImpl.java @@ -615,7 +615,7 @@ public class OneCameraImpl extends AbstractOneCamera { // Report state change when AF state has changed. if (resultAFState != mLastResultAFState && mFocusStateListener != null) { - mFocusStateListener.onFocusStatusUpdate(resultAFState); + mFocusStateListener.onFocusStatusUpdate(resultAFState, result.getFrameNumber()); } mLastResultAFState = resultAFState; } diff --git a/src/com/android/camera/one/v2/OneCameraManagerImpl.java b/src/com/android/camera/one/v2/OneCameraManagerImpl.java index d876f2e40..0f2247704 100644 --- a/src/com/android/camera/one/v2/OneCameraManagerImpl.java +++ b/src/com/android/camera/one/v2/OneCameraManagerImpl.java @@ -16,6 +16,7 @@ package com.android.camera.one.v2; +import android.content.Context; import android.hardware.camera2.CameraAccessException; import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CameraDevice; @@ -36,6 +37,8 @@ import com.android.camera.util.Size; */ public class OneCameraManagerImpl extends OneCameraManager { private static final Tag TAG = new Tag("OneCameraMgrImpl2"); + + private final Context mContext; private final CameraManager mCameraManager; private final int mMaxMemoryMB; private final DisplayMetrics mDisplayMetrics; @@ -48,8 +51,9 @@ public class OneCameraManagerImpl extends OneCameraManager { * @param maxMemoryMB maximum amount of memory opened cameras should consume * during capture and processing, in megabytes. */ - public OneCameraManagerImpl(CameraManager cameraManager, int maxMemoryMB, + public OneCameraManagerImpl(Context context, CameraManager cameraManager, int maxMemoryMB, DisplayMetrics displayMetrics, SoundPlayer soundPlayer) { + mContext = context; mCameraManager = cameraManager; mMaxMemoryMB = maxMemoryMB; mDisplayMetrics = displayMetrics; @@ -80,7 +84,7 @@ public class OneCameraManagerImpl extends OneCameraManager { CameraCharacteristics characteristics = mCameraManager .getCameraCharacteristics(device.getId()); // TODO: Set boolean based on whether HDR+ is enabled. - OneCamera oneCamera = OneCameraCreator.create(useHdr, device, + OneCamera oneCamera = OneCameraCreator.create(mContext, useHdr, device, characteristics, pictureSize, mMaxMemoryMB, mDisplayMetrics, mSoundPlayer); openCallback.onCameraOpened(oneCamera); diff --git a/src/com/android/camera/one/v2/OneCameraZslImpl.java b/src/com/android/camera/one/v2/OneCameraZslImpl.java index ca3f9f384..34284ddc9 100644 --- a/src/com/android/camera/one/v2/OneCameraZslImpl.java +++ b/src/com/android/camera/one/v2/OneCameraZslImpl.java @@ -305,7 +305,8 @@ public class OneCameraZslImpl extends AbstractOneCamera { CaptureResult result) { mFocusStateListener.onFocusStatusUpdate( AutoFocusHelper.stateFromCamera2State( - result.get(CaptureResult.CONTROL_AF_STATE))); + result.get(CaptureResult.CONTROL_AF_STATE)), + result.getFrameNumber()); } }); diff --git a/src/com/android/camera/ui/FocusOverlay.java b/src/com/android/camera/ui/FocusOverlay.java index dd2165075..bd913d4f6 100644 --- a/src/com/android/camera/ui/FocusOverlay.java +++ b/src/com/android/camera/ui/FocusOverlay.java @@ -48,15 +48,16 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI { private final Rect mBounds = new Rect(); private final ValueAnimator mFocusAnimation = new ValueAnimator(); - private Paint mDebugPaint; - private Paint mDebugAEPaint; + private Paint mDebugSolidPaint; + private Paint mDebugCornersPaint; + private Paint mDebugTextPaint; private int mDebugStartColor; - private int mDebugPassiveColor; private int mDebugSuccessColor; private int mDebugFailColor; - private Rect mFocusDebugAFRect; - private Rect mFocusDebugAERect; + private Rect mFocusDebugSolidRect; + private Rect mFocusDebugCornersRect; private boolean mIsPassiveScan; + private String mDebugMessage; private int mPositionX; private int mPositionY; @@ -75,18 +76,20 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI { if (CAPTURE_DEBUG_UI) { Resources res = getResources(); mDebugStartColor = res.getColor(R.color.focus_debug); - mDebugPassiveColor = res.getColor(R.color.focus_debug_light); mDebugSuccessColor = res.getColor(R.color.focus_debug_success); mDebugFailColor = res.getColor(R.color.focus_debug_fail); - mDebugPaint = new Paint(); - mDebugPaint.setColor(res.getColor(R.color.focus_debug)); - mDebugPaint.setAntiAlias(true); - mDebugPaint.setStyle(Paint.Style.STROKE); - mDebugPaint.setStrokeWidth(res.getDimension(R.dimen.focus_debug_stroke)); - mDebugAEPaint = new Paint(mDebugPaint); - mDebugAEPaint.setColor(res.getColor(R.color.focus_debug)); - mFocusDebugAFRect = new Rect(); - mFocusDebugAERect = new Rect(); + mDebugTextPaint= new Paint(); + mDebugTextPaint.setColor(res.getColor(R.color.focus_debug_text)); + mDebugTextPaint.setStyle(Paint.Style.FILL); + mDebugSolidPaint = new Paint(); + mDebugSolidPaint.setColor(res.getColor(R.color.focus_debug)); + mDebugSolidPaint.setAntiAlias(true); + mDebugSolidPaint.setStyle(Paint.Style.STROKE); + mDebugSolidPaint.setStrokeWidth(res.getDimension(R.dimen.focus_debug_stroke)); + mDebugCornersPaint = new Paint(mDebugSolidPaint); + mDebugCornersPaint.setColor(res.getColor(R.color.focus_debug)); + mFocusDebugSolidRect = new Rect(); + mFocusDebugCornersRect = new Rect(); } } @@ -122,15 +125,24 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI { if (CAPTURE_DEBUG_UI) { mFocusOuterRing.setBounds(0, 0, 0, 0); - mFocusDebugAFRect.set(x - aFsize / 2, y - aFsize / 2, x + aFsize / 2, y + aFsize / 2); - // If AE region is different size than AF region and active scan. - if (aFsize != aEsize && !isPassiveScan) { - mFocusDebugAERect.set(x - aEsize / 2, y - aEsize / 2, x + aEsize / 2, - y + aEsize / 2); + if (isPassiveScan) { + // Use AE rect only. + mFocusDebugSolidRect.setEmpty(); + int avg = (aFsize + aEsize) / 2; + mFocusDebugCornersRect.set(x - avg / 2, y - avg / 2, x + avg / 2, y + avg / 2); } else { - mFocusDebugAERect.set(0, 0, 0, 0); + mFocusDebugSolidRect.set(x - aFsize / 2, y - aFsize / 2, x + aFsize / 2, + y + aFsize / 2); + // If AE region is different size than AF region and active scan. + if (aFsize != aEsize) { + mFocusDebugCornersRect.set(x - aEsize / 2, y - aEsize / 2, x + aEsize / 2, + y + aEsize / 2); + } else { + mFocusDebugCornersRect.setEmpty(); + } } - mDebugPaint.setColor(isPassiveScan ? mDebugPassiveColor : mDebugStartColor); + mDebugSolidPaint.setColor(mDebugStartColor); + mDebugCornersPaint.setColor(mDebugStartColor); } if (getVisibility() != VISIBLE) { @@ -139,6 +151,15 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI { invalidate(); } + /** + * This is called in: + * <ul> + * <li>API1 non-CAF after autoFocus().</li> + * <li>API1 CAF mode for onAutoFocusMoving(true).</li> + * <li>API2 for transition to ACTIVE_SCANNING or PASSIVE_SCANNING.</li> + * <ul> + * TODO after PhotoModule/GcamModule deprecation: Do not use this for CAF. + */ @Override public void onFocusStarted() { mShowIndicator = true; @@ -152,29 +173,69 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI { } }); mFocusAnimation.start(); + if (CAPTURE_DEBUG_UI) { + mDebugMessage = null; + } } + /** + * This is called in: + * <ul> + * <li>API1 non-CAF for onAutoFocus(true).</li> + * <li>API2 non-CAF for transition to FOCUSED_LOCKED.</li> + * <li>API1 CAF mode for onAutoFocusMoving(false).</li> + * <ul> + * TODO after PhotoModule/GcamModule deprecation: Do not use this for CAF. + */ @Override public void onFocusSucceeded() { mFocusAnimation.cancel(); mShowIndicator = false; if (CAPTURE_DEBUG_UI && !mIsPassiveScan) { - mDebugPaint.setColor(mDebugSuccessColor); + mDebugSolidPaint.setColor(mDebugSuccessColor); } invalidate(); } + /** + * This is called in: + * <ul> + * <li>API1 non-CAF for onAutoFocus(false).</li> + * <li>API2 non-CAF for transition to NOT_FOCUSED_LOCKED.</li> + * <ul> + */ @Override public void onFocusFailed() { mFocusAnimation.cancel(); mShowIndicator = false; if (CAPTURE_DEBUG_UI && !mIsPassiveScan) { - mDebugPaint.setColor(mDebugFailColor); + mDebugSolidPaint.setColor(mDebugFailColor); + } + invalidate(); + } + + /** + * This is called in: + * API2 for CAF state changes to PASSIVE_FOCUSED or PASSIVE_UNFOCUSED. + */ + @Override + public void setPassiveFocusSuccess(boolean success) { + mFocusAnimation.cancel(); + mShowIndicator = false; + if (CAPTURE_DEBUG_UI) { + mDebugCornersPaint.setColor(success ? mDebugSuccessColor : mDebugFailColor); } invalidate(); } @Override + public void showDebugMessage(String message) { + if (CAPTURE_DEBUG_UI) { + mDebugMessage = message; + } + } + + @Override public void pauseFaceDetection() { // TODO: Add face detection support. } @@ -195,18 +256,23 @@ public class FocusOverlay extends View implements FocusOverlayManager.FocusUI { mFocusIndicator.draw(canvas); canvas.restore(); } - if (CAPTURE_DEBUG_UI && mFocusDebugAFRect != null) { - canvas.drawRect(mFocusDebugAFRect, mDebugPaint); - float delta = 0.1f * mFocusDebugAERect.width(); - float left = mFocusDebugAERect.left; - float top = mFocusDebugAERect.top; - float right = mFocusDebugAERect.right; - float bot = mFocusDebugAERect.bottom; - - canvas.drawLines(new float[]{left, top + delta, left, top, left, top, left + delta, top}, mDebugAEPaint); - canvas.drawLines(new float[]{right, top + delta, right, top, right, top, right - delta, top}, mDebugAEPaint); - canvas.drawLines(new float[]{left, bot - delta, left, bot, left, bot, left + delta, bot}, mDebugAEPaint); - canvas.drawLines(new float[]{right, bot - delta, right, bot, right, bot, right - delta, bot}, mDebugAEPaint); + if (CAPTURE_DEBUG_UI) { + canvas.drawRect(mFocusDebugSolidRect, mDebugSolidPaint); + float delta = 0.1f * mFocusDebugCornersRect.width(); + float left = mFocusDebugCornersRect.left; + float top = mFocusDebugCornersRect.top; + float right = mFocusDebugCornersRect.right; + float bot = mFocusDebugCornersRect.bottom; + + canvas.drawLines(new float[]{left, top + delta, left, top, left, top, left + delta, top}, mDebugCornersPaint); + canvas.drawLines(new float[]{right, top + delta, right, top, right, top, right - delta, top}, mDebugCornersPaint); + canvas.drawLines(new float[]{left, bot - delta, left, bot, left, bot, left + delta, bot}, mDebugCornersPaint); + canvas.drawLines(new float[]{right, bot - delta, right, bot, right, bot, right - delta, bot}, mDebugCornersPaint); + + if (mDebugMessage != null) { + mDebugTextPaint.setTextSize(40); + canvas.drawText(mDebugMessage, left - 4, bot + 44, mDebugTextPaint); + } } } } diff --git a/src/com/android/camera/widget/Cling.java b/src/com/android/camera/widget/Cling.java index 46ef68b2d..712dc9bed 100644 --- a/src/com/android/camera/widget/Cling.java +++ b/src/com/android/camera/widget/Cling.java @@ -76,7 +76,7 @@ public class Cling extends TextView { /** * Adjust the translation of the cling to stay on top of the reference view. */ - private void adjustPosition() { + public void adjustPosition() { if (mReferenceView == null) { return; } diff --git a/src/com/android/camera/widget/ExternalViewerButton.java b/src/com/android/camera/widget/ExternalViewerButton.java index bac54d05d..7ac42f4f0 100644 --- a/src/com/android/camera/widget/ExternalViewerButton.java +++ b/src/com/android/camera/widget/ExternalViewerButton.java @@ -110,7 +110,7 @@ public class ExternalViewerButton extends ImageButton { /** * Sets all the clings to be invisible. */ - private void hideClings() { + public void hideClings() { for (int i = 0; i < mClingMap.size(); i++) { mClingMap.valueAt(i).setVisibility(View.INVISIBLE); } @@ -134,11 +134,12 @@ public class ExternalViewerButton extends ImageButton { * Updates the visibility of clings based on whether the button is currently * shown. */ - private void updateClingVisibility() { + public void updateClingVisibility() { hideClings(); if (isShown()) { - View cling = mClingMap.get(mState); + Cling cling = mClingMap.get(mState); if (cling != null) { + cling.adjustPosition(); cling.setVisibility(View.VISIBLE); } } diff --git a/src_pd/com/android/camera/one/v2/OneCameraCreator.java b/src_pd/com/android/camera/one/v2/OneCameraCreator.java index 472066380..afb96b359 100644 --- a/src_pd/com/android/camera/one/v2/OneCameraCreator.java +++ b/src_pd/com/android/camera/one/v2/OneCameraCreator.java @@ -16,6 +16,7 @@ package com.android.camera.one.v2; +import android.content.Context; import android.hardware.camera2.CameraCharacteristics; import android.hardware.camera2.CameraDevice; import android.util.DisplayMetrics; @@ -25,7 +26,7 @@ import com.android.camera.one.OneCamera; import com.android.camera.util.Size; public class OneCameraCreator { - public static OneCamera create(boolean useHdr, CameraDevice device, + public static OneCamera create(Context context, boolean useHdr, CameraDevice device, CameraCharacteristics characteristics, Size pictureSize, int maxMemoryMB, DisplayMetrics displayMetrics, SoundPlayer soundPlayer) { // TODO: Might want to switch current camera to vendor HDR. |