1 /*
2  * Copyright (C) 2024 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 package com.google.jetpackcamera.settings.model
17 
18 data class SystemConstraints(
19     val availableLenses: List<LensFacing>,
20     val concurrentCamerasSupported: Boolean,
21     val perLensConstraints: Map<LensFacing, CameraConstraints>
22 )
23 
24 data class CameraConstraints(
25     val supportedStabilizationModes: Set<SupportedStabilizationMode>,
26     val supportedFixedFrameRates: Set<Int>,
27     val supportedDynamicRanges: Set<DynamicRange>,
28     val supportedImageFormatsMap: Map<CaptureMode, Set<ImageOutputFormat>>,
29     val hasFlashUnit: Boolean
30 )
31 
32 /**
33  * Useful set of constraints for testing
34  */
35 val TYPICAL_SYSTEM_CONSTRAINTS =
36     SystemConstraints(
37         availableLenses = listOf(LensFacing.FRONT, LensFacing.BACK),
38         concurrentCamerasSupported = false,
<lambda>null39         perLensConstraints = buildMap {
40             for (lensFacing in listOf(LensFacing.FRONT, LensFacing.BACK)) {
41                 put(
42                     lensFacing,
43                     CameraConstraints(
44                         supportedFixedFrameRates = setOf(15, 30),
45                         supportedStabilizationModes = emptySet(),
46                         supportedDynamicRanges = setOf(DynamicRange.SDR),
47                         supportedImageFormatsMap = mapOf(
48                             Pair(CaptureMode.SINGLE_STREAM, setOf(ImageOutputFormat.JPEG)),
49                             Pair(CaptureMode.MULTI_STREAM, setOf(ImageOutputFormat.JPEG))
50                         ),
51                         hasFlashUnit = lensFacing == LensFacing.BACK
52                     )
53                 )
54             }
55         }
56     )
57