CameraCapabilities.java revision a0842b40441db5332a5290f941021636b1182761
1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.ex.camera2.portability;
18
19import com.android.ex.camera2.portability.debug.Log;
20
21import java.util.ArrayList;
22import java.util.EnumSet;
23import java.util.HashSet;
24import java.util.List;
25import java.util.Set;
26import java.util.TreeSet;
27
28/**
29 * This class holds all the static information of a camera's capabilities.
30 * <p>
31 * The design of this class is thread-safe and can be passed around regardless
32 * of which thread using it.
33 * </p>
34 */
35public class CameraCapabilities {
36
37    private static Log.Tag TAG = new Log.Tag("CamCapabs");
38
39    /* All internal states are declared final and should be thread-safe. */
40
41    protected final ArrayList<int[]> mSupportedPreviewFpsRange = new ArrayList<int[]>();
42    protected final ArrayList<Size> mSupportedPreviewSizes = new ArrayList<Size>();
43    protected final TreeSet<Integer> mSupportedPreviewFormats = new TreeSet<Integer>();
44    protected final ArrayList<Size> mSupportedVideoSizes = new ArrayList<Size>();
45    protected final ArrayList<Size> mSupportedPhotoSizes = new ArrayList<Size>();
46    protected final TreeSet<Integer> mSupportedPhotoFormats = new TreeSet<Integer>();
47    protected final EnumSet<SceneMode> mSupportedSceneModes = EnumSet.noneOf(SceneMode.class);
48    protected final EnumSet<FlashMode> mSupportedFlashModes = EnumSet.noneOf(FlashMode.class);
49    protected final EnumSet<FocusMode> mSupportedFocusModes = EnumSet.noneOf(FocusMode.class);
50    protected final EnumSet<WhiteBalance> mSupportedWhiteBalances =
51            EnumSet.noneOf(WhiteBalance.class);
52    protected final EnumSet<Feature> mSupportedFeatures = EnumSet.noneOf(Feature.class);
53    protected Size mPreferredPreviewSizeForVideo;
54    protected int mMinExposureCompensation;
55    protected int mMaxExposureCompensation;
56    protected float mExposureCompensationStep;
57    protected int mMaxNumOfFacesSupported;
58    protected int mMaxNumOfFocusAreas;
59    protected int mMaxNumOfMeteringArea;
60    protected int mMaxZoomRatio;
61    protected float mHorizontalViewAngle;
62    protected float mVerticalViewAngle;
63    private final Stringifier mStringifier;
64    protected final ArrayList<Integer> mZoomRatioList = new ArrayList<Integer>();
65    protected int mMaxZoomIndex;
66
67    /**
68     * Focus modes.
69     */
70    public enum FocusMode {
71        /**
72         * Continuous auto focus mode intended for taking pictures.
73         * @see {@link android.hardware.Camera.Parameters#FOCUS_MODE_AUTO}.
74         */
75        AUTO,
76        /**
77         * Continuous auto focus mode intended for taking pictures.
78         * @see {@link android.hardware.Camera.Parameters#FOCUS_MODE_CONTINUOUS_PICTURE}.
79         */
80        CONTINUOUS_PICTURE,
81        /**
82         * Continuous auto focus mode intended for video recording.
83         * @see {@link android.hardware.Camera.Parameters#FOCUS_MODE_CONTINUOUS_VIDEO}.
84         */
85        CONTINUOUS_VIDEO,
86        /**
87         * Extended depth of field (EDOF).
88         * @see {@link android.hardware.Camera.Parameters#FOCUS_MODE_EDOF}.
89         */
90        EXTENDED_DOF,
91        /**
92         * Focus is fixed.
93         * @see {@link android.hardware.Camera.Parameters#FOCUS_MODE_FIXED}.
94         */
95        FIXED,
96        /**
97         * Focus is set at infinity.
98         * @see {@link android.hardware.Camera.Parameters#FOCUS_MODE_INFINITY}.
99         */
100        INFINITY,
101        /**
102         * Macro (close-up) focus mode.
103         * @see {@link android.hardware.Camera.Parameters#FOCUS_MODE_MACRO}.
104         */
105        MACRO,
106    }
107
108    /**
109     * Flash modes.
110     */
111    public enum FlashMode {
112        /**
113         * No flash.
114         */
115        NO_FLASH,
116        /**
117         * Flash will be fired automatically when required.
118         * @see {@link android.hardware.Camera.Parameters#FLASH_MODE_OFF}.
119         */
120        AUTO,
121        /**
122         * Flash will not be fired.
123         * @see {@link android.hardware.Camera.Parameters#FLASH_MODE_OFF}.
124         */
125        OFF,
126        /**
127         * Flash will always be fired during snapshot.
128         * @see {@link android.hardware.Camera.Parameters#FLASH_MODE_ON}.
129         */
130        ON,
131        /**
132         * Constant emission of light during preview, auto-focus and snapshot.
133         * @see {@link android.hardware.Camera.Parameters#FLASH_MODE_TORCH}.
134         */
135        TORCH,
136        /**
137         * Flash will be fired in red-eye reduction mode.
138         * @see {@link android.hardware.Camera.Parameters#FLASH_MODE_RED_EYE}.
139         */
140        RED_EYE,
141    }
142
143    /**
144     * Scene modes.
145     */
146    public enum SceneMode {
147        /**
148         * No supported scene mode.
149         */
150        NO_SCENE_MODE,
151        /**
152         * Scene mode is off.
153         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_AUTO}.
154         */
155        AUTO,
156        /**
157         * Take photos of fast moving objects.
158         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_ACTION}.
159         */
160        ACTION,
161        /**
162         * Applications are looking for a barcode.
163         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_BARCODE}.
164         */
165        BARCODE,
166        /**
167         * Take pictures on the beach.
168         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_BEACH}.
169         */
170        BEACH,
171        /**
172         * Capture the naturally warm color of scenes lit by candles.
173         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_CANDLELIGHT}.
174         */
175        CANDLELIGHT,
176        /**
177         * For shooting firework displays.
178         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_FIREWORKS}.
179         */
180        FIREWORKS,
181        /**
182         * Capture a scene using high dynamic range imaging techniques.
183         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_HDR}.
184         */
185        HDR,
186        /**
187         * Take pictures on distant objects.
188         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_LANDSCAPE}.
189         */
190        LANDSCAPE,
191        /**
192         * Take photos at night.
193         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_NIGHT}.
194         */
195        NIGHT,
196        /**
197         * Take people pictures at night.
198         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_NIGHT_PORTRAIT}.
199         */
200        NIGHT_PORTRAIT,
201        /**
202         * Take indoor low-light shot.
203         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_PARTY}.
204         */
205        PARTY,
206        /**
207         * Take people pictures.
208         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_PORTRAIT}.
209         */
210        PORTRAIT,
211        /**
212         * Take pictures on the snow.
213         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_SNOW}.
214         */
215        SNOW,
216        /**
217         * Take photos of fast moving objects.
218         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_SPORTS}.
219         */
220        SPORTS,
221        /**
222         * Avoid blurry pictures (for example, due to hand shake).
223         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_STEADYPHOTO}.
224         */
225        STEADYPHOTO,
226        /**
227         * Take sunset photos.
228         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_SUNSET}.
229         */
230        SUNSET,
231        /**
232         * Take photos in a theater.
233         * @see {@link android.hardware.Camera.Parameters#SCENE_MODE_THEATRE}.
234         */
235        THEATRE,
236    }
237
238    /**
239     * White blances.
240     */
241    public enum WhiteBalance {
242        /**
243         * @see {@link android.hardware.Camera.Parameters#WHITE_BALANCE_AUTO}.
244         */
245        AUTO,
246        /**
247         * @see {@link android.hardware.Camera.Parameters#WHITE_BALANCE_CLOUDY_DAYLIGHT}.
248         */
249        CLOUDY_DAYLIGHT,
250        /**
251         * @see {@link android.hardware.Camera.Parameters#WHITE_BALANCE_DAYLIGHT}.
252         */
253        DAYLIGHT,
254        /**
255         * @see {@link android.hardware.Camera.Parameters#WHITE_BALANCE_FLUORESCENT}.
256         */
257        FLUORESCENT,
258        /**
259         * @see {@link android.hardware.Camera.Parameters#WHITE_BALANCE_INCANDESCENT}.
260         */
261        INCANDESCENT,
262        /**
263         * @see {@link android.hardware.Camera.Parameters#WHITE_BALANCE_SHADE}.
264         */
265        SHADE,
266        /**
267         * @see {@link android.hardware.Camera.Parameters#WHITE_BALANCE_TWILIGHT}.
268         */
269        TWILIGHT,
270        /**
271         * @see {@link android.hardware.Camera.Parameters#WHITE_BALANCE_WARM_FLUORESCENT}.
272         */
273        WARM_FLUORESCENT,
274    }
275
276    /**
277     * Features.
278     */
279    public enum Feature {
280        /**
281         * Support zoom-related methods.
282         */
283        ZOOM,
284        /**
285         * Support for photo capturing during video recording.
286         */
287        VIDEO_SNAPSHOT,
288        /**
289         * Support for focus area settings.
290         */
291        FOCUS_AREA,
292        /**
293         * Support for metering area settings.
294         */
295        METERING_AREA,
296        /**
297         * Support for automatic exposure lock.
298         */
299        AUTO_EXPOSURE_LOCK,
300        /**
301         * Support for automatic white balance lock.
302         */
303        AUTO_WHITE_BALANCE_LOCK,
304        /**
305         * Support for video stabilization.
306         */
307        VIDEO_STABILIZATION,
308    }
309
310    /**
311     * A interface stringifier to convert abstract representations to API
312     * related string representation.
313     */
314    public static class Stringifier {
315        /**
316         * Converts the string to hyphen-delimited lowercase for compatibility with multiple APIs.
317         *
318         * @param enumCase The name of an enum constant.
319         * @return The converted string.
320         */
321        private static String toApiCase(String enumCase) {
322            return enumCase.toLowerCase().replaceAll("_", "-");
323        }
324
325        /**
326         * Conerts the string to underscore-delimited uppercase to match the enum constant names.
327         *
328         * @param apiCase An API-related string representation.
329         * @return The converted string.
330         */
331        private static String toEnumCase(String apiCase) {
332            return apiCase.toUpperCase().replaceAll("-", "_");
333        }
334
335        /**
336         * Converts the focus mode to API-related string representation.
337         *
338         * @param focus The focus mode to convert.
339         * @return The string used by the camera framework API to represent the
340         *         focus mode.
341         */
342        public String stringify(FocusMode focus) {
343            return toApiCase(focus.name());
344        }
345
346        /**
347         * Converts the API-related string representation of the focus mode to the
348         * abstract representation.
349         *
350         * @param val The string representation.
351         * @return The focus mode represented by the input string, or the focus
352         *         mode with the lowest ordinal if it cannot be converted.
353         */
354        public FocusMode focusModeFromString(String val) {
355            if (val == null) {
356                return FocusMode.values()[0];
357            }
358            try {
359                return FocusMode.valueOf(toEnumCase(val));
360            } catch (IllegalArgumentException ex) {
361                return FocusMode.values()[0];
362            }
363        }
364
365        /**
366         * Converts the flash mode to API-related string representation.
367         *
368         * @param flash The focus mode to convert.
369         * @return The string used by the camera framework API to represent the
370         *         flash mode.
371         */
372        public String stringify(FlashMode flash) {
373            return toApiCase(flash.name());
374        }
375
376        /**
377         * Converts the API-related string representation of the flash mode to the
378         * abstract representation.
379         *
380         * @param val The string representation.
381         * @return The flash mode represented by the input string, or the flash
382         *         mode with the lowest ordinal if it cannot be converted.
383         */
384        public FlashMode flashModeFromString(String val) {
385            if (val == null) {
386                return FlashMode.values()[0];
387            }
388            try {
389                return FlashMode.valueOf(toEnumCase(val));
390            } catch (IllegalArgumentException ex) {
391                return FlashMode.values()[0];
392            }
393        }
394
395        /**
396         * Converts the scene mode to API-related string representation.
397         *
398         * @param scene The focus mode to convert.
399         * @return The string used by the camera framework API to represent the
400         *         scene mode.
401         */
402        public String stringify(SceneMode scene) {
403            return toApiCase(scene.name());
404        }
405
406        /**
407         * Converts the API-related string representation of the scene mode to the
408         * abstract representation.
409         *
410         * @param val The string representation.
411         * @return The scene mode represented by the input string, or the scene
412         *         mode with the lowest ordinal if it cannot be converted.
413         */
414        public SceneMode sceneModeFromString(String val) {
415            if (val == null) {
416                return SceneMode.values()[0];
417            }
418            try {
419                return SceneMode.valueOf(toEnumCase(val));
420            } catch (IllegalArgumentException ex) {
421                return SceneMode.values()[0];
422            }
423        }
424
425        /**
426         * Converts the white balance to API-related string representation.
427         *
428         * @param wb The focus mode to convert.
429         * @return The string used by the camera framework API to represent the
430         * white balance.
431         */
432        public String stringify(WhiteBalance wb) {
433            return toApiCase(wb.name());
434        }
435
436        /**
437         * Converts the API-related string representation of the white balance to
438         * the abstract representation.
439         *
440         * @param val The string representation.
441         * @return The white balance represented by the input string, or the
442         *         white balance with the lowest ordinal if it cannot be
443         *         converted.
444         */
445        public WhiteBalance whiteBalanceFromString(String val) {
446            if (val == null) {
447                return WhiteBalance.values()[0];
448            }
449            try {
450                return WhiteBalance.valueOf(toEnumCase(val));
451            } catch (IllegalArgumentException ex) {
452                return WhiteBalance.values()[0];
453            }
454        }
455    }
456
457    /**
458     * Constructor.
459     * @param stringifier The API-specific stringifier for this instance.
460     */
461    CameraCapabilities(Stringifier stringifier) {
462        mStringifier = stringifier;
463    }
464
465    /**
466     * Copy constructor.
467     * @param src The source instance.
468     */
469    public CameraCapabilities(CameraCapabilities src) {
470        mSupportedPreviewFpsRange.addAll(src.mSupportedPreviewFpsRange);
471        mSupportedPreviewSizes.addAll(src.mSupportedPreviewSizes);
472        mSupportedPreviewFormats.addAll(src.mSupportedPreviewFormats);
473        mSupportedVideoSizes.addAll(src.mSupportedVideoSizes);
474        mSupportedPhotoSizes.addAll(src.mSupportedPhotoSizes);
475        mSupportedPhotoFormats.addAll(src.mSupportedPhotoFormats);
476        mSupportedSceneModes.addAll(src.mSupportedSceneModes);
477        mSupportedFlashModes.addAll(src.mSupportedFlashModes);
478        mSupportedFocusModes.addAll(src.mSupportedFocusModes);
479        mSupportedWhiteBalances.addAll(src.mSupportedWhiteBalances);
480        mSupportedFeatures.addAll(src.mSupportedFeatures);
481        mPreferredPreviewSizeForVideo = src.mPreferredPreviewSizeForVideo;
482        mMaxExposureCompensation = src.mMaxExposureCompensation;
483        mMinExposureCompensation = src.mMinExposureCompensation;
484        mExposureCompensationStep = src.mExposureCompensationStep;
485        mMaxNumOfFacesSupported = src.mMaxNumOfFacesSupported;
486        mMaxNumOfFocusAreas = src.mMaxNumOfFocusAreas;
487        mMaxNumOfMeteringArea = src.mMaxNumOfMeteringArea;
488        mMaxZoomRatio = src.mMaxZoomRatio;
489        mHorizontalViewAngle = src.mHorizontalViewAngle;
490        mVerticalViewAngle = src.mVerticalViewAngle;
491        mStringifier = src.mStringifier;
492    }
493
494    public float getHorizontalViewAngle() {
495        return mHorizontalViewAngle;
496    }
497
498    public float getVerticalViewAngle() {
499        return mVerticalViewAngle;
500    }
501
502    /**
503     * @return the supported picture formats. See {@link android.graphics.ImageFormat}.
504     */
505    public Set<Integer> getSupportedPhotoFormats() {
506        return new TreeSet<Integer>(mSupportedPhotoFormats);
507    }
508
509    /**
510     * Gets the supported preview formats.
511     * @return The supported preview {@link android.graphics.ImageFormat}s.
512     */
513    public Set<Integer> getSupportedPreviewFormats() {
514        return new TreeSet<Integer>(mSupportedPreviewFormats);
515    }
516
517    /**
518     * Gets the supported picture sizes.
519     */
520    public List<Size> getSupportedPhotoSizes() {
521        return new ArrayList<Size>(mSupportedPhotoSizes);
522    }
523
524    /**
525     * @return The supported preview fps (frame-per-second) ranges. The returned
526     * list is sorted by maximum fps then minimum fps in a descending order.
527     * The values are multiplied by 1000.
528     */
529    public final List<int[]> getSupportedPreviewFpsRange() {
530        return new ArrayList<int[]>(mSupportedPreviewFpsRange);
531    }
532
533    /**
534     * @return The supported preview sizes. The list is sorted by width then
535     * height in a descending order.
536     */
537    public final List<Size> getSupportedPreviewSizes() {
538        return new ArrayList<Size>(mSupportedPreviewSizes);
539    }
540
541    public final Size getPreferredPreviewSizeForVideo() {
542        return new Size(mPreferredPreviewSizeForVideo);
543    }
544
545    /**
546     * @return The supported video frame sizes that can be used by MediaRecorder.
547     *         The list is sorted by width then height in a descending order.
548     */
549    public final List<Size> getSupportedVideoSizes() {
550        return new ArrayList<Size>(mSupportedVideoSizes);
551    }
552
553    /**
554     * @return The supported scene modes.
555     */
556    public final Set<SceneMode> getSupportedSceneModes() {
557        return new HashSet<SceneMode>(mSupportedSceneModes);
558    }
559
560    /**
561     * @return Whether the scene mode is supported.
562     */
563    public final boolean supports(SceneMode scene) {
564        return (scene != null && mSupportedSceneModes.contains(scene));
565    }
566
567    public boolean supports(final CameraSettings settings) {
568        if (zoomCheck(settings) && exposureCheck(settings) && focusCheck(settings) &&
569                flashCheck(settings) && photoSizeCheck(settings) && previewSizeCheck(settings) &&
570                videoStabilizationCheck(settings)) {
571            return true;
572        }
573        return false;
574    }
575
576    /**
577     * @return The supported flash modes.
578     */
579    public final Set<FlashMode> getSupportedFlashModes() {
580        return new HashSet<FlashMode>(mSupportedFlashModes);
581    }
582
583    /**
584     * @return Whether the flash mode is supported.
585     */
586    public final boolean supports(FlashMode flash) {
587        return (flash != null && mSupportedFlashModes.contains(flash));
588    }
589
590    /**
591     * @return The supported focus modes.
592     */
593    public final Set<FocusMode> getSupportedFocusModes() {
594        return new HashSet<FocusMode>(mSupportedFocusModes);
595    }
596
597    /**
598     * @return Whether the focus mode is supported.
599     */
600    public final boolean supports(FocusMode focus) {
601        return (focus != null && mSupportedFocusModes.contains(focus));
602    }
603
604    /**
605     * @return The supported white balanceas.
606     */
607    public final Set<WhiteBalance> getSupportedWhiteBalance() {
608        return new HashSet<WhiteBalance>(mSupportedWhiteBalances);
609    }
610
611    /**
612     * @return Whether the white balance is supported.
613     */
614    public boolean supports(WhiteBalance wb) {
615        return (wb != null && mSupportedWhiteBalances.contains(wb));
616    }
617
618    public final Set<Feature> getSupportedFeature() {
619        return new HashSet<Feature>(mSupportedFeatures);
620    }
621
622    public boolean supports(Feature ft) {
623        return (ft != null && mSupportedFeatures.contains(ft));
624    }
625
626    /**
627     * @return The maximal supported zoom ratio.
628     */
629    public float getMaxZoomRatio() {
630        return mMaxZoomRatio;
631    }
632
633    // We'll replace these old style methods with new ones.
634    @Deprecated
635    public int getMaxZoomIndex() {
636        return mMaxZoomIndex;
637    }
638
639    @Deprecated
640    public List<Integer> getZoomRatioList() {
641        return new ArrayList<Integer>(mZoomRatioList);
642    }
643
644    /**
645     * @return The min exposure compensation index. The EV is the compensation
646     * index multiplied by the step value. If unsupported, both this method and
647     * {@link #getMaxExposureCompensation()} return 0.
648     */
649    public final int getMinExposureCompensation() {
650        return mMinExposureCompensation;
651    }
652
653    /**
654     * @return The max exposure compensation index. The EV is the compensation
655     * index multiplied by the step value. If unsupported, both this method and
656     * {@link #getMinExposureCompensation()} return 0.
657     */
658    public final int getMaxExposureCompensation() {
659        return mMaxExposureCompensation;
660    }
661
662    /**
663     * @return The exposure compensation step. The EV is the compensation index
664     * multiplied by the step value.
665     */
666    public final float getExposureCompensationStep() {
667        return mExposureCompensationStep;
668    }
669
670    /**
671     * @return The max number of faces supported by the face detection. 0 if
672     * unsupported.
673     */
674    public final int getMaxNumOfFacesSupported() {
675        return mMaxNumOfFacesSupported;
676    }
677
678    /**
679     * @return The stringifier used by this instance.
680     */
681    public Stringifier getStringifier() {
682        return mStringifier;
683    }
684
685    private boolean zoomCheck(final CameraSettings settings) {
686        final float ratio = settings.getCurrentZoomRatio();
687        final int index = settings.getCurrentZoomIndex();
688        if (!supports(Feature.ZOOM)) {
689            if (ratio != 1.0f || index != 0) {
690                Log.v(TAG, "Zoom is not supported");
691                return false;
692            }
693        } else {
694            if (settings.getCurrentZoomRatio() > getMaxZoomRatio() ||
695                    index > getMaxZoomIndex()) {
696                Log.v(TAG, "Zoom ratio is not supported: ratio = " +
697                        settings.getCurrentZoomRatio() + ", index = " + index);
698                return false;
699            }
700        }
701        return true;
702    }
703
704    private boolean exposureCheck(final CameraSettings settings) {
705        final int index = settings.getExposureCompensationIndex();
706        if (index > getMaxExposureCompensation() || index < getMinExposureCompensation()) {
707            Log.v(TAG, "Exposure compensation index is not supported. Min = " +
708                    getMinExposureCompensation() + ", max = " + getMaxExposureCompensation() + "," +
709                    " setting = " + index);
710            return false;
711        }
712        return true;
713    }
714
715    private boolean focusCheck(final CameraSettings settings) {
716        FocusMode focusMode = settings.getCurrentFocusMode();
717        if (!supports(focusMode)) {
718            Log.v(TAG,
719                    "Focus mode not supported:" + (focusMode != null ? focusMode.name() : "null"));
720            return false;
721        }
722        return true;
723    }
724
725    private boolean flashCheck(final CameraSettings settings) {
726        FlashMode flashMode = settings.getCurrentFlashMode();
727        if (!supports(flashMode)) {
728            Log.v(TAG,
729                    "Flash mode not supported:" + (flashMode != null ? flashMode.name() : "null"));
730            return false;
731        }
732        return true;
733    }
734
735    private boolean photoSizeCheck(final CameraSettings settings) {
736        Size photoSize = settings.getCurrentPhotoSize();
737        if (mSupportedPhotoSizes.contains(photoSize)) {
738            return true;
739        }
740        Log.v(TAG, "Unsupported photo size:" + photoSize);
741        return false;
742    }
743
744    private boolean previewSizeCheck(final CameraSettings settings) {
745        final Size previewSize = settings.getCurrentPreviewSize();
746        if (mSupportedPreviewSizes.contains(previewSize)) {
747            return true;
748        }
749        Log.v(TAG, "Unsupported preview size:" + previewSize);
750        return false;
751    }
752
753    private boolean videoStabilizationCheck(final CameraSettings settings) {
754        if (!settings.isVideoStabilizationEnabled() || supports(Feature.VIDEO_STABILIZATION)) {
755            return true;
756        }
757        Log.v(TAG, "Video stabilization is not supported");
758        return false;
759    }
760}
761