Skip to content

Commit

Permalink
Fix for CameraView blacks outs and Aspect ratio iteration issue googl…
Browse files Browse the repository at this point in the history
  • Loading branch information
luowei committed Jul 11, 2018
1 parent bccd24b commit df15c0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,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 @@ -150,7 +151,8 @@ 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 @@ -243,6 +243,10 @@ 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

0 comments on commit df15c0b

Please sign in to comment.