Andy Huibers | 99a37d8 | 2014-08-14 22:24:41 -0700 | [diff] [blame] | 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 com.android.camera.util.SystemProperties; |
| 20 | |
| 21 | public class DebugPropertyHelper { |
Andy Huibers | 99a37d8 | 2014-08-14 22:24:41 -0700 | [diff] [blame] | 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 | /** Switch between PhotoModule and the new CaptureModule. */ |
| 28 | private static final String PROP_ENABLE_CAPTURE_MODULE = PREFIX + ".newcapture"; |
Andy Huibers | 62b4c3c | 2014-08-25 15:01:25 -0700 | [diff] [blame] | 29 | /** Enable frame-by-frame focus logging. */ |
| 30 | private static final String PROP_FRAME_LOG = PREFIX + ".frame_log"; |
| 31 | /** |
| 32 | * Enable additional capture debug UI. |
| 33 | * For API1/Photomodule: show faces. |
| 34 | * For API2/Capturemodule: show faces, AF state, AE/AF precise regions. |
| 35 | */ |
| 36 | private static final String PROP_CAPTURE_DEBUG_UI = PREFIX + ".debug_ui"; |
Puneet Lall | e4ebe00 | 2014-08-27 13:38:29 -0700 | [diff] [blame] | 37 | /** Switch between OneCameraImpl and OneCameraZslImpl. */ |
Puneet Lall | 9cd94d7 | 2014-10-14 14:05:11 -0700 | [diff] [blame] | 38 | private static final String PROP_FORCE_LEGACY_ONE_CAMERA = PREFIX + ".legacy"; |
Andy Huibers | 99a37d8 | 2014-08-14 22:24:41 -0700 | [diff] [blame] | 39 | /** Write data about each capture request to disk. */ |
| 40 | private static final String PROP_WRITE_CAPTURE_DATA = PREFIX + ".capture_write"; |
Sascha Haeberling | c6da1a1 | 2014-11-06 09:50:51 -0800 | [diff] [blame^] | 41 | /** Is RAW support enabled. */ |
| 42 | private static final String PROP_CAPTURE_DNG = PREFIX + ".capture_dng"; |
Andy Huibers | 99a37d8 | 2014-08-14 22:24:41 -0700 | [diff] [blame] | 43 | |
| 44 | private static boolean isPropertyOn(String property) { |
| 45 | return ON_VALUE.equals(SystemProperties.get(property, OFF_VALUE)); |
| 46 | } |
| 47 | |
| 48 | public static boolean isCaptureModuleEnabled() { |
Puneet Lall | 9cd94d7 | 2014-10-14 14:05:11 -0700 | [diff] [blame] | 49 | return isPropertyOn(PROP_ENABLE_CAPTURE_MODULE); |
Puneet Lall | e4ebe00 | 2014-08-27 13:38:29 -0700 | [diff] [blame] | 50 | } |
| 51 | |
Puneet Lall | 9cd94d7 | 2014-10-14 14:05:11 -0700 | [diff] [blame] | 52 | public static boolean forceLegacyOneCamera() { |
| 53 | return isPropertyOn(PROP_FORCE_LEGACY_ONE_CAMERA); |
Andy Huibers | 99a37d8 | 2014-08-14 22:24:41 -0700 | [diff] [blame] | 54 | } |
| 55 | |
Andy Huibers | 62b4c3c | 2014-08-25 15:01:25 -0700 | [diff] [blame] | 56 | public static boolean showFrameDebugLog() { |
Andy Huibers | b868274 | 2014-08-27 15:28:42 -0700 | [diff] [blame] | 57 | return isPropertyOn(PROP_FRAME_LOG); |
Andy Huibers | 99a37d8 | 2014-08-14 22:24:41 -0700 | [diff] [blame] | 58 | } |
| 59 | |
Andy Huibers | 62b4c3c | 2014-08-25 15:01:25 -0700 | [diff] [blame] | 60 | public static boolean showCaptureDebugUI() { |
Andy Huibers | b868274 | 2014-08-27 15:28:42 -0700 | [diff] [blame] | 61 | return isPropertyOn(PROP_CAPTURE_DEBUG_UI); |
Andy Huibers | 99a37d8 | 2014-08-14 22:24:41 -0700 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | public static boolean writeCaptureData() { |
| 65 | return isPropertyOn(PROP_WRITE_CAPTURE_DATA); |
| 66 | } |
Sascha Haeberling | c6da1a1 | 2014-11-06 09:50:51 -0800 | [diff] [blame^] | 67 | |
| 68 | public static boolean isCaptureDngEnabled() { |
| 69 | return isPropertyOn(PROP_CAPTURE_DNG); |
| 70 | } |
Andy Huibers | 99a37d8 | 2014-08-14 22:24:41 -0700 | [diff] [blame] | 71 | } |