mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-25 14:47:20 +00:00
fix yakju JWR66Y front-camera misbehavior
fixes #4715 Closes #4738 // FREEBIE
This commit is contained in:
parent
0a9f28c228
commit
b07003ae34
@ -370,6 +370,13 @@ public class CameraView extends ViewGroup {
|
|||||||
return outputOrientation;
|
return outputOrientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://github.com/WhisperSystems/Signal-Android/issues/4715
|
||||||
|
private boolean isTroublemaker() {
|
||||||
|
return getCameraInfo().facing == CameraInfo.CAMERA_FACING_FRONT &&
|
||||||
|
"JWR66Y".equals(Build.DISPLAY) &&
|
||||||
|
"yakju".equals(Build.PRODUCT);
|
||||||
|
}
|
||||||
|
|
||||||
private @NonNull CameraInfo getCameraInfo() {
|
private @NonNull CameraInfo getCameraInfo() {
|
||||||
final CameraInfo info = new Camera.CameraInfo();
|
final CameraInfo info = new Camera.CameraInfo();
|
||||||
Camera.getCameraInfo(cameraId, info);
|
Camera.getCameraInfo(cameraId, info);
|
||||||
@ -460,7 +467,7 @@ public class CameraView extends ViewGroup {
|
|||||||
}
|
}
|
||||||
final float newWidth = visibleRect.width() * scale;
|
final float newWidth = visibleRect.width() * scale;
|
||||||
final float newHeight = visibleRect.height() * scale;
|
final float newHeight = visibleRect.height() * scale;
|
||||||
final float centerX = (VERSION.SDK_INT < 14) ? previewWidth - newWidth / 2 : previewWidth / 2;
|
final float centerX = (VERSION.SDK_INT < 14 || isTroublemaker()) ? previewWidth - newWidth / 2 : previewWidth / 2;
|
||||||
final float centerY = previewHeight / 2;
|
final float centerY = previewHeight / 2;
|
||||||
|
|
||||||
visibleRect.set((int) (centerX - newWidth / 2),
|
visibleRect.set((int) (centerX - newWidth / 2),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user