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 17 package com.android.camera.debug; 18 19 import android.os.SystemProperties; 20 21 public class DebugPropertyHelper { 22 private static final String OFF_VALUE = "0"; 23 private static final String ON_VALUE = "1"; 24 25 private static final String PREFIX = "persist.camera"; 26 27 /** Enable frame-by-frame focus logging. */ 28 private static final String PROP_FRAME_LOG = PREFIX + ".frame_log"; 29 /** 30 * Enable additional capture debug UI. 31 * For API1/Photomodule: show faces. 32 * For API2/Capturemodule: show faces, AF state, AE/AF precise regions. 33 */ 34 private static final String PROP_CAPTURE_DEBUG_UI = PREFIX + ".debug_ui"; 35 /** Switch between OneCameraImpl and OneCameraZslImpl. */ 36 private static final String PROP_FORCE_LEGACY_ONE_CAMERA = PREFIX + ".legacy"; 37 /** Write data about each capture request to disk. */ 38 private static final String PROP_WRITE_CAPTURE_DATA = PREFIX + ".capture_write"; 39 /** Is RAW support enabled. */ 40 private static final String PROP_CAPTURE_DNG = PREFIX + ".capture_dng"; 41 /** Redacting EXIF manufacturer and model name. */ 42 private static final String PROP_REDACT_EXIF = PREFIX + ".redact_exif"; 43 isPropertyOn(String property)44 private static boolean isPropertyOn(String property) { 45 return ON_VALUE.equals(SystemProperties.get(property, OFF_VALUE)); 46 } 47 showFrameDebugLog()48 public static boolean showFrameDebugLog() { 49 return isPropertyOn(PROP_FRAME_LOG); 50 } 51 showCaptureDebugUI()52 public static boolean showCaptureDebugUI() { 53 return isPropertyOn(PROP_CAPTURE_DEBUG_UI); 54 } 55 writeCaptureData()56 public static boolean writeCaptureData() { 57 return isPropertyOn(PROP_WRITE_CAPTURE_DATA); 58 } 59 isCaptureDngEnabled()60 public static boolean isCaptureDngEnabled() { 61 return isPropertyOn(PROP_CAPTURE_DNG); 62 } 63 isRedactExifEnabled()64 public static boolean isRedactExifEnabled() { 65 return isPropertyOn(PROP_REDACT_EXIF); 66 } 67 } 68