1 /* 2 * Copyright (C) 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 com.android.DeviceAsWebcam; 18 19 import android.graphics.Rect; 20 import android.util.Range; 21 22 /** 23 * A class for providing camera related information. 24 */ 25 public class CameraInfo { 26 private final CameraId mCameraId; 27 private final int mLensFacing; 28 private final int mSensorOrientation; 29 private final Range<Float> mZoomRatioRange; 30 private final Rect mActiveArraySize; 31 private final boolean mFacePrioritySupported; 32 private final boolean mIsStreamUseCaseSupported; 33 private final CameraCategory mCameraCategory; 34 CameraInfo(CameraId cameraId, int lensFacing, int sensorOrientation, Range<Float> zoomRatioRange, Rect activeArraySize, boolean facePrioritySupported, boolean streamUseCaseSupported, CameraCategory cameraCategory)35 public CameraInfo(CameraId cameraId, int lensFacing, 36 int sensorOrientation, Range<Float> zoomRatioRange, Rect activeArraySize, 37 boolean facePrioritySupported, boolean streamUseCaseSupported, 38 CameraCategory cameraCategory) { 39 mCameraId = cameraId; 40 mLensFacing = lensFacing; 41 mSensorOrientation = sensorOrientation; 42 mZoomRatioRange = zoomRatioRange; 43 mActiveArraySize = activeArraySize; 44 mFacePrioritySupported = facePrioritySupported; 45 mIsStreamUseCaseSupported = streamUseCaseSupported; 46 mCameraCategory = cameraCategory; 47 } 48 49 /** 50 * Returns the CameraId. 51 */ getCameraId()52 public CameraId getCameraId() { 53 return mCameraId; 54 } 55 56 /** 57 * Returns lens facing. 58 */ getLensFacing()59 public int getLensFacing() { 60 return mLensFacing; 61 } 62 63 /** 64 * Returns sensor orientation characteristics value. 65 */ getSensorOrientation()66 public int getSensorOrientation() { 67 return mSensorOrientation; 68 } 69 70 /** 71 * Returns zoom ratio range characteristics value. 72 */ getZoomRatioRange()73 public Range<Float> getZoomRatioRange() { 74 return mZoomRatioRange; 75 } 76 77 /** 78 * Returns active array size characteristics value. 79 */ getActiveArraySize()80 public Rect getActiveArraySize() { 81 return mActiveArraySize; 82 } 83 84 /** 85 * Returns if CONTROL_SCENE_MODE_FACE_PRIORITY is supported. 86 */ isFacePrioritySupported()87 public boolean isFacePrioritySupported() { 88 return mFacePrioritySupported; 89 } 90 91 /** 92 * Returns if STRAEM_USE_CASE capability is present. 93 */ isStreamUseCaseSupported()94 public boolean isStreamUseCaseSupported() { 95 return mIsStreamUseCaseSupported; 96 } 97 98 /** 99 * Returns camera category. 100 */ getCameraCategory()101 public CameraCategory getCameraCategory() { 102 return mCameraCategory; 103 } 104 } 105