1 /* 2 * Copyright 2023 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 17 package androidx.camera.camera2.pipe.integration.compat 18 19 import android.hardware.camera2.params.DynamicRangeProfiles 20 import androidx.camera.core.DynamicRange 21 import androidx.core.util.Preconditions 22 23 internal class DynamicRangeProfilesCompatBaseImpl : 24 DynamicRangeProfilesCompat.DynamicRangeProfilesCompatImpl { 25 override val supportedDynamicRanges: Set<DynamicRange> 26 get() = SDR_ONLY 27 getDynamicRangeCaptureRequestConstraintsnull28 override fun getDynamicRangeCaptureRequestConstraints( 29 dynamicRange: DynamicRange 30 ): Set<DynamicRange> { 31 Preconditions.checkArgument( 32 DynamicRange.SDR == dynamicRange, 33 "DynamicRange is not supported: $dynamicRange" 34 ) 35 return SDR_ONLY 36 } 37 isExtraLatencyPresentnull38 override fun isExtraLatencyPresent(dynamicRange: DynamicRange): Boolean { 39 Preconditions.checkArgument( 40 DynamicRange.SDR == dynamicRange, 41 "DynamicRange is not supported: $dynamicRange" 42 ) 43 return false 44 } 45 unwrapnull46 override fun unwrap(): DynamicRangeProfiles? { 47 return null 48 } 49 50 companion object { 51 val COMPAT_INSTANCE: DynamicRangeProfilesCompat = 52 DynamicRangeProfilesCompat(DynamicRangeProfilesCompatBaseImpl()) 53 private val SDR_ONLY = setOf(DynamicRange.SDR) 54 } 55 } 56