use of android.view.SurfaceHolder in project android_frameworks_base by ResurrectionRemix.
the class CameraTest method checkPreviewCallback.
private void checkPreviewCallback() {
SurfaceHolder mSurfaceHolder;
try {
mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
mCamera.setPreviewDisplay(mSurfaceHolder);
Log.v(TAG, "start preview");
mCamera.startPreview();
waitForPreviewDone();
mCamera.setPreviewCallback(null);
} catch (Exception e) {
Log.v(TAG, e.toString());
}
}
use of android.view.SurfaceHolder in project android_frameworks_base by ResurrectionRemix.
the class CameraTest method checkTakePicture.
private void checkTakePicture() {
SurfaceHolder mSurfaceHolder;
try {
mSurfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
mCamera.setPreviewDisplay(mSurfaceHolder);
Log.v(TAG, "Start preview");
mCamera.startPreview();
waitForPreviewDone();
mCamera.setPreviewCallback(null);
mCamera.takePicture(mShutterCallback, mRawPictureCallback, mJpegPictureCallback);
waitForSnapshotDone();
} catch (Exception e) {
Log.v(TAG, e.toString());
}
}
use of android.view.SurfaceHolder in project android_frameworks_base by ResurrectionRemix.
the class CameraStressTest method testStressCameraSceneModes.
/**
* Stress test iterating on the various scene modes (action, night, party, etc.)
*/
@LargeTest
public void testStressCameraSceneModes() throws Exception {
try {
SurfaceHolder surfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
Parameters params = mCameraTestHelper.getCameraParameters();
List<String> supportedSceneModes = params.getSupportedSceneModes();
assertNotNull("No scene modes supported", supportedSceneModes);
mOutput.write("Total number of loops: " + (NUMBER_OF_SCENE_MODE_LOOPS * supportedSceneModes.size()) + "\n");
Log.v(TAG, "Start preview");
mOutput.write("No of loop: ");
for (int i = 0; i < supportedSceneModes.size(); i++) {
for (int j = 0; j < NUMBER_OF_SCENE_MODE_LOOPS; j++) {
runOnLooper(new Runnable() {
@Override
public void run() {
mCameraTestHelper.setupCameraTest();
}
});
Log.v(TAG, "Setting scene mode to " + supportedSceneModes.get(i));
params.setSceneMode(supportedSceneModes.get(i));
mCameraTestHelper.setParameters(params);
mCameraTestHelper.startCameraPreview(surfaceHolder);
mCameraTestHelper.capturePhoto();
if (i == 0 && j == 0) {
mOutput.write(Integer.toString(j + i * NUMBER_OF_SCENE_MODE_LOOPS));
} else {
mOutput.write(", " + (j + i * NUMBER_OF_SCENE_MODE_LOOPS));
}
}
}
mCameraTestHelper.cleanupTestImages();
} catch (Exception e) {
Log.e(TAG, e.toString());
fail("Camera scene mode test Exception");
}
}
use of android.view.SurfaceHolder in project android_frameworks_base by ResurrectionRemix.
the class CameraStressTest method testStressCameraZoom.
/**
* Stress test iterating on the range of supported camera zoom levels
*/
@LargeTest
public void testStressCameraZoom() throws Exception {
try {
SurfaceHolder surfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
Parameters params = mCameraTestHelper.getCameraParameters();
if (!params.isSmoothZoomSupported() && !params.isZoomSupported()) {
Log.v(TAG, "Device camera does not support zoom");
fail("Camera zoom stress test failed due to unsupported feature");
} else {
Log.v(TAG, "Device camera does support zoom");
Log.v(TAG, "Start preview");
mOutput.write("Total number of loops: " + NUMBER_OF_ZOOM_LOOPS + "\n");
mOutput.write("No of loops: ");
int nextZoomLevel = 0;
for (int i = 0; i < NUMBER_OF_ZOOM_LOOPS; i++) {
runOnLooper(new Runnable() {
@Override
public void run() {
mCameraTestHelper.setupCameraTest();
}
});
mCameraTestHelper.startCameraPreview(surfaceHolder);
params = mCameraTestHelper.mCamera.getParameters();
int currentZoomLevel = params.getZoom();
if (nextZoomLevel >= params.getMaxZoom()) {
nextZoomLevel = 0;
}
++nextZoomLevel;
if (params.isSmoothZoomSupported()) {
mCameraTestHelper.mCamera.startSmoothZoom(nextZoomLevel);
} else {
params.setZoom(nextZoomLevel);
mCameraTestHelper.setParameters(params);
}
mCameraTestHelper.capturePhoto();
if (i == 0) {
mOutput.write(Integer.toString(i));
} else {
mOutput.write(", " + i);
}
}
}
mCameraTestHelper.cleanupTestImages();
} catch (Exception e) {
Log.e(TAG, e.toString());
fail("Camera zoom stress test Exception");
}
}
use of android.view.SurfaceHolder in project android_frameworks_base by ResurrectionRemix.
the class DisplaySinkService method setSurfaceView.
public void setSurfaceView(final SurfaceView surfaceView) {
if (mSurfaceView != surfaceView) {
final SurfaceView oldSurfaceView = mSurfaceView;
mSurfaceView = surfaceView;
if (oldSurfaceView != null) {
oldSurfaceView.post(new Runnable() {
@Override
public void run() {
final SurfaceHolder holder = oldSurfaceView.getHolder();
holder.removeCallback(DisplaySinkService.this);
updateSurfaceFromUi(null);
}
});
}
if (surfaceView != null) {
surfaceView.post(new Runnable() {
@Override
public void run() {
final SurfaceHolder holder = surfaceView.getHolder();
holder.addCallback(DisplaySinkService.this);
updateSurfaceFromUi(holder);
}
});
}
}
}
Aggregations