Unify orientation calculation logic.
Camera API takes clockwise degrees for JPEG rotation and
OrientationEventListener reports clockwise device orientation.
The easiest formula of calculating output image rotation degree is:
"camera sensor orientation" + "device orientation"
Since front cameras face in opposite direction. The result needs to be mirrored
for front camera.
Detailed changes:
* Refactor OrientationManager to remove unnecessary complexity.
* Add OrientationManager.DeviceOrientation enum and
OrientationManager.getDeviceOrientation
* Remove CameraUtil.roundOrientation.
* Fix the weird calculation which is hard to understand in
CameraUtil.getJpegRotation and add CameraUtil.getImageRotation
* Clean up image rotation logic in all modules:
* Always look up the current device orientation via OrientationManager.getDeviceOrientation
* Fix the doc for copyImagePlaneToBitmap() which actually rotates image
counterclockwise.
* Clean up CameraActivity:
* Remove CameraActivity.onOrientationChanged and
ModuleController.onOrientationChanged. Any individual module which
wants to listen orientation change should register itself to
OrientationManager. Now only VideoModule needs to do that.
Bug: 17443789
Change-Id: I6d54cac5bde950acae0c3226448c27a816266df0
12 files changed