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 android.hardware.camera2.CameraCharacteristics; 20import android.util.Log; 21 22import java.lang.ExceptionInInitializerError; 23import java.lang.reflect.Field; 24import java.lang.reflect.Method; 25 26/** 27 * Vendor tag declarations for the Legacy Camera2 API implementation. 28 */ 29public class LegacyVendorTags { 30 31 private static final String TAG = "LegacyVendorTags"; 32 33 /** 34 * Hidden enum for scene modes supported only by the Camera1 API. 35 */ 36 public static final int CONTROL_SCENE_MODE_HDR; 37 38 static { 39 int tempSceneMode = -1; 40 try { 41 tempSceneMode = 42 Class.forName("android.hardware.camera2.CameraCharacteristics"). 43 getField("CONTROL_SCENE_MODE_HDR").getInt(null); 44 } catch (Exception e) { 45 Log.e(TAG, "Error while reflecting on SCENE_MODE_HDR enum, HDR will not be available: " 46 + e); 47 } finally { 48 CONTROL_SCENE_MODE_HDR = tempSceneMode; 49 } 50 } 51 52 private LegacyVendorTags() { 53 throw new AssertionError(); 54 } 55}