summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHangyu Kuang <hkuang@google.com>2019-05-29 17:03:35 -0700
committerHangyu Kuang <hkuang@google.com>2019-05-29 17:03:35 -0700
commit369f06ffbba63c838d4e3376d9199a2953f9075d (patch)
treeba743413c03d9226767f31bfc48fb7472125a495
parent1eea93b2051904dce42214ac09efefbdd4a6a7b4 (diff)
downloadav-369f06ffbba63c838d4e3376d9199a2953f9075d.tar.gz
[ECOService]: Add a setprop to disable ECOService.
Bug: 117877984 Test: Unit Test. Change-Id: Ie354de13151df0d85937b1f846c8cfab04a80894
-rw-r--r--media/eco/ECOService.cpp6
-rw-r--r--media/eco/include/eco/ECODebug.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/media/eco/ECOService.cpp b/media/eco/ECOService.cpp
index 6cc4be4..e95dee5 100644
--- a/media/eco/ECOService.cpp
+++ b/media/eco/ECOService.cpp
@@ -49,6 +49,12 @@ ECOService::ECOService() : BnECOService() {
ECOLOGI("ECOService::obtainSession w: %d, h: %d, isCameraRecording: %d", width, height,
isCameraRecording);
+ bool disable = property_get_bool(kDisableEcoServiceProperty, false);
+ if (disable) {
+ ECOLOGE("ECOService:: Failed to obtainSession as ECOService is disable");
+ return STATUS_ERROR(ERROR_UNSUPPORTED, "ECOService is disable");
+ }
+
if (width <= 0) {
return STATUS_ERROR(ERROR_ILLEGAL_ARGUMENT, "Width can not be <= 0");
}
diff --git a/media/eco/include/eco/ECODebug.h b/media/eco/include/eco/ECODebug.h
index b250f64..1d0e5e9 100644
--- a/media/eco/include/eco/ECODebug.h
+++ b/media/eco/include/eco/ECODebug.h
@@ -26,6 +26,7 @@ namespace android {
namespace media {
namespace eco {
+static const char* kDisableEcoServiceProperty = "media.ecoservice.disable";
static const char* kDebugLogsLevelProperty = "media.ecoservice.log.level";
static const char* kDebugLogStats = "media.ecoservice.log.stats";
static const char* kDebugLogStatsSize = "media.ecoservice.log.stats.size";