mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-20 21:51:45 +00:00
parent
336962eb55
commit
a7e05c4cd6
@ -114,6 +114,7 @@ public class CameraView extends FrameLayout {
|
|||||||
host.onCameraFail(result);
|
host.onCameraFail(result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
cameraReady = true;
|
cameraReady = true;
|
||||||
if (getActivity().getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
|
if (getActivity().getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
|
||||||
onOrientationChange.enable();
|
onOrientationChange.enable();
|
||||||
@ -127,6 +128,14 @@ public class CameraView extends FrameLayout {
|
|||||||
requestLayout();
|
requestLayout();
|
||||||
invalidate();
|
invalidate();
|
||||||
Log.w(TAG, "onResume() completed");
|
Log.w(TAG, "onResume() completed");
|
||||||
|
} catch (RuntimeException re) {
|
||||||
|
Log.w(TAG, "exception when starting camera preview", re);
|
||||||
|
try {
|
||||||
|
previewDestroyed();
|
||||||
|
} catch (RuntimeException re2) {
|
||||||
|
Log.w(TAG, "also failed to release camera", re2);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -272,9 +281,12 @@ public class CameraView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void previewDestroyed() {
|
void previewDestroyed() {
|
||||||
|
try {
|
||||||
if (camera != null) {
|
if (camera != null) {
|
||||||
previewStopped();
|
previewStopped();
|
||||||
camera.release();
|
camera.release();
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
camera = null;
|
camera = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user