camera2: Fix CameraUtils orientation for front camera.
Bug: 16637957
Change-Id: If6d213794a92eb60b8a333546670ca868b75e5fc
diff --git a/camera/CameraUtils.cpp b/camera/CameraUtils.cpp
index 1ff63ab..04244ac 100644
--- a/camera/CameraUtils.cpp
+++ b/camera/CameraUtils.cpp
@@ -73,23 +73,23 @@
return INVALID_OPERATION;
}
} else {
- // Front camera needs to be horizontally flipped for
- // mirror-like behavior.
- // Note: Flips are applied before rotates.
+ // Front camera needs to be horizontally flipped for mirror-like behavior.
+ // Note: Flips are applied before rotates; using XOR here as some of these flags are
+ // composed in terms of other flip/rotation flags, and are not bitwise-ORable.
switch (orientation) {
case 0:
flags = NATIVE_WINDOW_TRANSFORM_FLIP_H;
break;
case 90:
- flags = NATIVE_WINDOW_TRANSFORM_FLIP_H |
+ flags = NATIVE_WINDOW_TRANSFORM_FLIP_H ^
NATIVE_WINDOW_TRANSFORM_ROT_270;
break;
case 180:
- flags = NATIVE_WINDOW_TRANSFORM_FLIP_H |
+ flags = NATIVE_WINDOW_TRANSFORM_FLIP_H ^
NATIVE_WINDOW_TRANSFORM_ROT_180;
break;
case 270:
- flags = NATIVE_WINDOW_TRANSFORM_FLIP_H |
+ flags = NATIVE_WINDOW_TRANSFORM_FLIP_H ^
NATIVE_WINDOW_TRANSFORM_ROT_90;
break;