import android.provider.MediaStore;
import android.provider.MediaStore.MediaColumns;
import android.provider.MediaStore.Video;
-import android.util.Log;
import android.view.KeyEvent;
import android.view.OrientationEventListener;
import android.view.View;
import com.android.camera.app.MediaSaver;
import com.android.camera.app.MemoryManager;
import com.android.camera.app.MemoryManager.MemoryListener;
+import com.android.camera.debug.Log;
import com.android.camera.exif.ExifInterface;
import com.android.camera.hardware.HardwareSpec;
import com.android.camera.hardware.HardwareSpecImpl;
import com.android.camera.module.ModuleController;
import com.android.camera.settings.SettingsManager;
import com.android.camera.settings.SettingsUtil;
-import com.android.camera.util.AccessibilityUtils;
import com.android.camera.util.ApiHelper;
import com.android.camera.util.CameraUtil;
import com.android.camera.util.UsageStatistics;
MediaRecorder.OnErrorListener,
MediaRecorder.OnInfoListener, FocusOverlayManager.Listener {
- private static final String TAG = "VideoModule";
+ private static final Log.Tag TAG = new Log.Tag("VideoModule");
// Messages defined for the UI thread handler.
private static final int MSG_CHECK_DISPLAY_ROTATION = 4;
null, null, null, new JpegPictureCallback(loc));
showVideoSnapshotUI(true);
mSnapshotInProgress = true;
- UsageStatistics.captureEvent(eventprotos.NavigationChange.Mode.VIDEO_STILL,
- null, null);
+ UsageStatistics.instance().captureEvent(
+ eventprotos.NavigationChange.Mode.VIDEO_STILL, null, null, null);
}
}
};
@Override
+ public void hardResetSettings(SettingsManager settingsManager) {
+ // VideoModule does not need to hard reset any settings.
+ }
+
+ @Override
public HardwareSpec getHardwareSpec() {
return (mParameters != null ? new HardwareSpecImpl(mParameters) : null);
}
return;
}
- mCameraDevice.setErrorCallback(mErrorCallback);
+ mCameraDevice.setErrorCallback(mHandler, mErrorCallback);
if (mPreviewing == true) {
stopPreview();
}
return;
}
mCameraDevice.setZoomChangeListener(null);
- mCameraDevice.setErrorCallback(null);
+ mCameraDevice.setErrorCallback(null, null);
mActivity.getCameraProvider().releaseCamera(mCameraDevice.getCameraId());
mCameraDevice = null;
mPreviewing = false;
mCurrentVideoValues.put(MediaColumns.DATE_MODIFIED, dateTaken / 1000);
mCurrentVideoValues.put(Video.Media.MIME_TYPE, mime);
mCurrentVideoValues.put(Video.Media.DATA, path);
+ mCurrentVideoValues.put(Video.Media.WIDTH, mProfile.videoFrameWidth);
+ mCurrentVideoValues.put(Video.Media.HEIGHT, mProfile.videoFrameHeight);
mCurrentVideoValues.put(Video.Media.RESOLUTION,
Integer.toString(mProfile.videoFrameWidth) + "x" +
Integer.toString(mProfile.videoFrameHeight));
mUI.showFocusUI(false);
mUI.showVideoRecordingHints(false);
- // A special case of mode options closing: during capture it should
- // not be possible to change mode state.
- mAppController.getCameraAppUI().hideModeOptions();
- mAppController.getCameraAppUI().animateBottomBarToVideoStop(R.drawable.ic_stop);
-
mActivity.updateStorageSpaceAndHint();
if (mActivity.getStorageSpaceBytes() <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {
Log.v(TAG, "Storage issue, ignore the start request");
}
mAppController.getCameraAppUI().setSwipeEnabled(false);
- // Make sure the video recording has started before announcing
- // this in accessibility.
- AccessibilityUtils.makeAnnouncement(mUI.getShutterButton(),
- mActivity.getString(R.string.video_recording_started));
-
// The parameters might have been altered by MediaRecorder already.
// We need to force mCameraDevice to refresh before getting it.
mCameraDevice.refreshParameters();
mMediaRecorderRecording = true;
mActivity.lockOrientation();
mRecordingStartTime = SystemClock.uptimeMillis();
+
+ // A special case of mode options closing: during capture it should
+ // not be possible to change mode state.
+ mAppController.getCameraAppUI().hideModeOptions();
+ mAppController.getCameraAppUI().animateBottomBarToVideoStop(R.drawable.ic_stop);
mUI.showRecordingUI(true);
setFocusParameters();
mUI.showFocusUI(true);
mUI.showVideoRecordingHints(true);
- mAppController.getCameraAppUI().showModeOptions();
- mAppController.getCameraAppUI().animateBottomBarToFullSize(mShutterIconId);
-
boolean fail = false;
if (mMediaRecorderRecording) {
boolean shouldAddToMediaStoreNow = false;
String statisticFilename = (mCurrentVideoFilename == null
? "INTENT"
: mCurrentVideoFilename);
- UsageStatistics.captureEvent(eventprotos.NavigationChange.Mode.VIDEO_CAPTURE,
- statisticFilename, mParameters, duration);
- AccessibilityUtils.makeAnnouncement(mUI.getShutterButton(),
- mActivity.getAndroidContext().getString(R.string
- .video_recording_stopped));
+ UsageStatistics.instance().captureEvent(
+ eventprotos.NavigationChange.Mode.VIDEO_CAPTURE, statisticFilename,
+ mParameters, duration);
} catch (RuntimeException e) {
Log.e(TAG, "stop fail", e);
if (mVideoFilename != null) {
}
// release media recorder
releaseMediaRecorder();
+
+ mAppController.getCameraAppUI().showModeOptions();
+ mAppController.getCameraAppUI().animateBottomBarToFullSize(mShutterIconId);
if (!mPaused) {
setFocusParameters();
mCameraDevice.lock();
enableTorchMode(settingsManager.isCameraBackFacing());
- // Set white balance parameter.
- String whiteBalance = settingsManager.get(SettingsManager.SETTING_WHITE_BALANCE);
- if (isSupported(whiteBalance,
- mParameters.getSupportedWhiteBalance())) {
- mParameters.setWhiteBalance(whiteBalance);
- } else {
- whiteBalance = mParameters.getWhiteBalance();
- if (whiteBalance == null) {
- whiteBalance = Parameters.WHITE_BALANCE_AUTO;
- }
- }
-
// Set zoom.
if (mParameters.isZoomSupported()) {
mParameters.setZoom(mZoomValue);
mHandler.sendEmptyMessageDelayed(MSG_CHECK_DISPLAY_ROTATION, 100);
}
- UsageStatistics.changeScreen(eventprotos.NavigationChange.Mode.VIDEO_CAPTURE,
+ UsageStatistics.instance().changeScreen(eventprotos.NavigationChange.Mode.VIDEO_CAPTURE,
eventprotos.CameraEvent.InteractionCause.BUTTON);
getServices().getMemoryManager().addListener(this);
}