File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
api14/com/google/android/cameraview
java/com/google/android/cameraview Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 2727import java .util .List ;
2828import java .util .Set ;
2929import java .util .SortedSet ;
30+ import java .util .TreeSet ;
3031import java .util .concurrent .atomic .AtomicBoolean ;
3132
3233
@@ -151,7 +152,9 @@ int getFacing() {
151152 @ Override
152153 Set <AspectRatio > getSupportedAspectRatios () {
153154 SizeMap idealAspectRatios = mPreviewSizes ;
154- for (AspectRatio aspectRatio : idealAspectRatios .ratios ()) {
155+
156+ Set <AspectRatio > ratios = new TreeSet <>(idealAspectRatios .ratios ());
157+ for (AspectRatio aspectRatio : ratios ) {
155158 if (mPictureSizes .sizes (aspectRatio ) == null ) {
156159 idealAspectRatios .remove (aspectRatio );
157160 }
Original file line number Diff line number Diff line change @@ -244,6 +244,9 @@ protected void onRestoreInstanceState(Parcelable state) {
244244 */
245245 public void start () {
246246 if (!mImpl .start ()) {
247+ if (mImpl .getView () != null ) {
248+ this .removeView (mImpl .getView ());
249+ }
247250 //store the state ,and restore this state after fall back o Camera1
248251 Parcelable state =onSaveInstanceState ();
249252 // Camera2 uses legacy hardware layer; fall back to Camera1
You can’t perform that action at this time.
0 commit comments