Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Fix for CameraView blacks outs and Aspect ratio iteration issue #125

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicBoolean;


Expand Down Expand Up @@ -151,7 +152,9 @@ int getFacing() {
@Override
Set<AspectRatio> getSupportedAspectRatios() {
SizeMap idealAspectRatios = mPreviewSizes;
for (AspectRatio aspectRatio : idealAspectRatios.ratios()) {

Set<AspectRatio> ratios = new TreeSet<>(idealAspectRatios.ratios());
for (AspectRatio aspectRatio : ratios) {
if (mPictureSizes.sizes(aspectRatio) == null) {
idealAspectRatios.remove(aspectRatio);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ protected void onRestoreInstanceState(Parcelable state) {
*/
public void start() {
if (!mImpl.start()) {
if (mImpl.getView() != null) {
this.removeView(mImpl.getView());
}
//store the state ,and restore this state after fall back o Camera1
Parcelable state=onSaveInstanceState();
// Camera2 uses legacy hardware layer; fall back to Camera1
Expand Down