2 * Copyright (C) 2014 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.camera.debug;
19 import com.android.camera.util.SystemProperties;
21 public class DebugPropertyHelper {
22 /** Make app start with CaptureModule + ZSL. */
23 private static final boolean FORCE_ZSL_APP = false;
25 private static final String OFF_VALUE = "0";
26 private static final String ON_VALUE = "1";
28 private static final String PREFIX = "persist.camera";
30 /** Switch between PhotoModule and the new CaptureModule. */
31 private static final String PROP_ENABLE_CAPTURE_MODULE = PREFIX + ".newcapture";
32 /** Enable frame-by-frame focus logging. */
33 private static final String PROP_FRAME_LOG = PREFIX + ".frame_log";
35 * Enable additional capture debug UI.
36 * For API1/Photomodule: show faces.
37 * For API2/Capturemodule: show faces, AF state, AE/AF precise regions.
39 private static final String PROP_CAPTURE_DEBUG_UI = PREFIX + ".debug_ui";
40 /** Switch between OneCameraImpl and OneCameraZslImpl. */
41 private static final String PROP_ENABLE_ZSL = PREFIX + ".zsl";
42 /** Write data about each capture request to disk. */
43 private static final String PROP_WRITE_CAPTURE_DATA = PREFIX + ".capture_write";
45 private static boolean isPropertyOn(String property) {
46 return ON_VALUE.equals(SystemProperties.get(property, OFF_VALUE));
49 public static boolean isCaptureModuleEnabled() {
50 return isPropertyOn(PROP_ENABLE_CAPTURE_MODULE) || FORCE_ZSL_APP;
53 public static boolean isZslEnabled() {
54 return isPropertyOn(PROP_ENABLE_ZSL) || FORCE_ZSL_APP;
57 public static boolean showFrameDebugLog() {
58 return isPropertyOn(PROP_FRAME_LOG);
61 public static boolean showCaptureDebugUI() {
62 return isPropertyOn(PROP_CAPTURE_DEBUG_UI);
65 public static boolean writeCaptureData() {
66 return isPropertyOn(PROP_WRITE_CAPTURE_DATA);