在vendor/sec/sec_proprietary/smdkc110/libcamera/SecCameraHWInterface.cpp中,当对硬件设置完毕后,通知packages/apps/Camera/src/com/android/camera/Camera.java,zoom已经完成。
status_t CameraHardwareSec::sendCommand(int32_t command, int32_t arg1, int32_t arg2) { if( command == ZOOM_COMMAND_ID ) { if( arg1 == mZoomLevel ) { return NO_ERROR; } LOGE("startZoom (%s),arg1:%ld,mZoomLevel:%ld", __FUNCTION__,arg1,mZoomLevel); //mZoomLevel = arg1; //mSecCamera->startZoom(mZoomLevel); if( arg1>mZoomLevel ) { LOGE("zoomIn (%s)", __FUNCTION__); mZoomLevel = arg1; mSecCamera->zoomIn(mZoomLevel); } else if( arg1<mZoomLevel ) { LOGE("zoomOut (%s)", __FUNCTION__); mZoomLevel = arg1; mSecCamera->zoomOut(mZoomLevel); } //add by hui if (mMsgEnabled & CAMERA_MSG_ZOOM) mNotifyCb(CAMERA_MSG_ZOOM, true, 1, mCallbackCookie); } return NO_ERROR; }
应用层或者硬件层设置成功,可以对应用程序进行成功后的相关设置。例如把zoomin按钮显示出来。
private final class ZoomCallback implements android.hardware.Camera.ZoomCallback { public void onZoomUpdate(int zoomValue, boolean stopped, android.hardware.Camera camera) { Log.v(TAG, "ZoomCallback: zoom value=" + zoomValue + ". stopped=" + stopped); mZoomValue = zoomValue; // Keep mParameters up to date. We do not getParameter again in // takePicture. If we do not do this, wrong zoom value will be set. mParameters.setZoom(zoomValue); // We only care if the zoom is stopped. mZooming is set to true when // we start smooth zoom. if (stopped) mZooming = false; updateZoomButtonsEnabled(); } }