File tree 2 files changed +7
-1
lines changed
api14/com/google/android/cameraview
java/com/google/android/cameraview
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 27
27
import java .util .List ;
28
28
import java .util .Set ;
29
29
import java .util .SortedSet ;
30
+ import java .util .TreeSet ;
30
31
import java .util .concurrent .atomic .AtomicBoolean ;
31
32
32
33
@@ -151,7 +152,9 @@ int getFacing() {
151
152
@ Override
152
153
Set <AspectRatio > getSupportedAspectRatios () {
153
154
SizeMap idealAspectRatios = mPreviewSizes ;
154
- for (AspectRatio aspectRatio : idealAspectRatios .ratios ()) {
155
+
156
+ Set <AspectRatio > ratios = new TreeSet <>(idealAspectRatios .ratios ());
157
+ for (AspectRatio aspectRatio : ratios ) {
155
158
if (mPictureSizes .sizes (aspectRatio ) == null ) {
156
159
idealAspectRatios .remove (aspectRatio );
157
160
}
Original file line number Diff line number Diff line change @@ -244,6 +244,9 @@ protected void onRestoreInstanceState(Parcelable state) {
244
244
*/
245
245
public void start () {
246
246
if (!mImpl .start ()) {
247
+ if (mImpl .getView () != null ) {
248
+ this .removeView (mImpl .getView ());
249
+ }
247
250
//store the state ,and restore this state after fall back o Camera1
248
251
Parcelable state =onSaveInstanceState ();
249
252
// Camera2 uses legacy hardware layer; fall back to Camera1
You can’t perform that action at this time.
0 commit comments