From 9324f11afe9366cd5479828a214dc8de8696a5ab Mon Sep 17 00:00:00 2001 From: Wu-cheng Li Date: Tue, 10 Nov 2009 18:32:09 +0800 Subject: Add postview callback to know when the captured image is shown. b2237074 Some platform display the captured image to the screen in postview callback. Some do that in raw picture callback. The camera application wants to make sure the captured image is displayed for at least 1.2 seconds. But orginally the app does not register postview callback and always start the timer in raw picture callback. Currently postview callback always arrives before raw callback. Without this change, the camera app may think the captured image is not displyed long enough and add some delay before starting preview, which will increase the shot-to-shot latency (ex: 0.8s) unexpectedly. --- .../com/android/camera/stress/CameraLatency.java | 54 +++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'tests/src/com') diff --git a/tests/src/com/android/camera/stress/CameraLatency.java b/tests/src/com/android/camera/stress/CameraLatency.java index 221e7b1..0c5059f 100755 --- a/tests/src/com/android/camera/stress/CameraLatency.java +++ b/tests/src/com/android/camera/stress/CameraLatency.java @@ -40,14 +40,14 @@ public class CameraLatency extends ActivityInstrumentationTestCase2 { private long mTotalAutoFocusTime; private long mTotalShutterLag; - private long mTotalShutterAndRawPictureCallbackTime; - private long mTotalJpegPictureCallbackTimeLag; - private long mTotalRawPictureAndJpegPictureCallbackTime; + private long mTotalShutterToPictureDisplayedTime; + private long mTotalPictureDisplayedToJpegCallbackTime; + private long mTotalJpegCallbackToFirstFrameTime; private long mAvgAutoFocusTime; private long mAvgShutterLag = mTotalShutterLag; - private long mAvgShutterAndRawPictureCallbackTime; - private long mAveJpegPictureCallbackTimeLag; - private long mAvgRawPictureAndJpegPictureCallbackTime; + private long mAvgShutterToPictureDisplayedTime; + private long mAvgPictureDisplayedToJpegCallbackTime; + private long mAvgJpegCallbackToFirstFrameTime; public CameraLatency() { super("com.android.camera", Camera.class); @@ -78,11 +78,11 @@ public class CameraLatency extends ActivityInstrumentationTestCase2 { Camera c = getActivity(); mTotalAutoFocusTime += c.mAutoFocusTime; mTotalShutterLag += c.mShutterLag; - mTotalShutterAndRawPictureCallbackTime += - c.mShutterAndRawPictureCallbackTime; - mTotalJpegPictureCallbackTimeLag += c.mJpegPictureCallbackTimeLag; - mTotalRawPictureAndJpegPictureCallbackTime += - c.mRawPictureAndJpegPictureCallbackTime; + mTotalShutterToPictureDisplayedTime += + c.mShutterToPictureDisplayedTime; + mTotalPictureDisplayedToJpegCallbackTime += + c.mPictureDisplayedToJpegCallbackTime; + mTotalJpegCallbackToFirstFrameTime += c.mJpegCallbackToFirstFrameTime; } } } catch (Exception e) { @@ -96,12 +96,12 @@ public class CameraLatency extends ActivityInstrumentationTestCase2 { int numberofRun = TOTAL_NUMBER_OF_IMAGECAPTURE - 1; mAvgAutoFocusTime = mTotalAutoFocusTime / numberofRun; mAvgShutterLag = mTotalShutterLag / numberofRun; - mAvgShutterAndRawPictureCallbackTime = - mTotalShutterAndRawPictureCallbackTime / numberofRun; - mAveJpegPictureCallbackTimeLag = - mTotalJpegPictureCallbackTimeLag / numberofRun; - mAvgRawPictureAndJpegPictureCallbackTime = - mTotalRawPictureAndJpegPictureCallbackTime / numberofRun; + mAvgShutterToPictureDisplayedTime = + mTotalShutterToPictureDisplayedTime / numberofRun; + mAvgPictureDisplayedToJpegCallbackTime = + mTotalPictureDisplayedToJpegCallbackTime / numberofRun; + mAvgJpegCallbackToFirstFrameTime = + mTotalJpegCallbackToFirstFrameTime / numberofRun; try { FileWriter fstream = null; @@ -111,11 +111,11 @@ public class CameraLatency extends ActivityInstrumentationTestCase2 { out.write("Number of loop: " + TOTAL_NUMBER_OF_IMAGECAPTURE + "\n"); out.write("Avg AutoFocus = " + mAvgAutoFocusTime + "\n"); out.write("Avg mShutterLag = " + mAvgShutterLag + "\n"); - out.write("Avg mShutterAndRawPictureCallbackTime = " - + mAvgShutterAndRawPictureCallbackTime + "\n"); - out.write("Avg mJpegPictureCallbackTimeLag = " + mAveJpegPictureCallbackTimeLag + "\n"); - out.write("Avg mRawPictureAndJpegPictureCallbackTime = " - + mAvgRawPictureAndJpegPictureCallbackTime + "\n"); + out.write("Avg mShutterToPictureDisplayedTime = " + + mAvgShutterToPictureDisplayedTime + "\n"); + out.write("Avg mPictureDisplayedToJpegCallbackTime = " + + mAvgPictureDisplayedToJpegCallbackTime + "\n"); + out.write("Avg mJpegCallbackToFirstFrameTime = " + mAvgJpegCallbackToFirstFrameTime + "\n"); out.close(); fstream.close(); } catch (Exception e) { @@ -124,11 +124,11 @@ public class CameraLatency extends ActivityInstrumentationTestCase2 { Log.v(TAG, "Avg AutoFocus = " + mAvgAutoFocusTime); Log.v(TAG, "Avg mShutterLag = " + mAvgShutterLag); - Log.v(TAG, "Avg mShutterAndRawPictureCallbackTime = " - + mAvgShutterAndRawPictureCallbackTime); - Log.v(TAG, "Avg mJpegPictureCallbackTimeLag = " + mAveJpegPictureCallbackTimeLag); - Log.v(TAG, "Avg mRawPictureAndJpegPictureCallbackTime = " - + mAvgRawPictureAndJpegPictureCallbackTime); + Log.v(TAG, "Avg mShutterToPictureDisplayedTime = " + + mAvgShutterToPictureDisplayedTime); + Log.v(TAG, "Avg mPictureDisplayedToJpegCallbackTime = " + + mAvgPictureDisplayedToJpegCallbackTime); + Log.v(TAG, "Avg mJpegCallbackToFirstFrameTime = " + mAvgJpegCallbackToFirstFrameTime); assertTrue("testImageCapture", true); } } -- cgit v1.1