Add utility to identify lean targets
This utility reads ro.lean system property
and returns a 1 if the property is set to true
and returns 0 otherwise.
Change-Id: I52a8396ee085d44b90d8416131f27b0b1a46575e
CRs-fixed: 801990
diff --git a/utils/loc_target.cpp b/utils/loc_target.cpp
index f829d51..08f5584 100644
--- a/utils/loc_target.cpp
+++ b/utils/loc_target.cpp
@@ -244,3 +244,17 @@
LOC_LOGD("HAL: %s returned %d", __FUNCTION__, gTarget);
return gTarget;
}
+
+/*Reads the property ro.lean to identify if this is a lean target
+ Returns:
+ 0 if not a lean and mean target
+ 1 if this is a lean and mean target
+*/
+int loc_identify_lean_target()
+{
+ int ret = 0;
+ char lean_target[PROPERTY_VALUE_MAX];
+ property_get("ro.lean", lean_target, "");
+ LOC_LOGD("%s:%d]: lean target: %s\n", __func__, __LINE__, lean_target);
+ return !(strncmp(lean_target, "true", PROPERTY_VALUE_MAX));
+}
diff --git a/utils/loc_target.h b/utils/loc_target.h
index 873ddfc..3bb3b5e 100644
--- a/utils/loc_target.h
+++ b/utils/loc_target.h
@@ -52,6 +52,11 @@
/*The character array passed to this function should have length
of atleast PROPERTY_VALUE_MAX*/
void loc_get_platform_name(char *platform_name, int array_length);
+/*Reads the property ro.lean to identify if this is a lean target
+ Returns:
+ 0 if not a lean and mean target
+ 1 if this is a lean and mean target*/
+int loc_identify_lean_target();
/* Please remember to update 'target_name' in loc_log.cpp,
if do any changes to this enum. */