summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2015-10-28 18:11:23 -0700
committerDan Willemsen <dwillemsen@google.com>2015-10-29 12:14:34 -0700
commit8b7977eccc94f6b3a3896cd13b4aeacbfa1e0f84 (patch)
tree1c5f0a738387ff55aacd94fc9de6d8a7d33bc89b
parent5e3f7a49613f24ed1a169179b77fbb4c7eb0f08f (diff)
downloadlibchrome-brillo-m7-dev.tar.gz
Don't use __DATE__/__TIME__ on Androidbrillo-m7-releasebrillo-m7-mr-devbrillo-m7-dev
Instead, pull the build date of the system from the ro.build.date system property. Then this library will be identical as long as the sources and dependencies don't change, and we won't have to update it on every OTA. Bug: 24204119 Change-Id: Ie5368ec0bbbc635dc6b86f9259d6567fe26ca2ba
-rw-r--r--Android.mk4
-rw-r--r--base/build_time.cc9
2 files changed, 10 insertions, 3 deletions
diff --git a/Android.mk b/Android.mk
index ccaff518c3..23c29a5680 100644
--- a/Android.mk
+++ b/Android.mk
@@ -380,7 +380,7 @@ LOCAL_CPP_EXTENSION := $(libchromeCommonCppExtension)
LOCAL_CFLAGS := $(libchromeCommonCFlags)
LOCAL_CPPFLAGS := $(libchromeCommonCppFlags)
LOCAL_C_INCLUDES := $(libchromeCommonCIncludes)
-LOCAL_SHARED_LIBRARIES := libevent liblog
+LOCAL_SHARED_LIBRARIES := libevent liblog libcutils
LOCAL_STATIC_LIBRARIES := libmodpb64
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
include $(BUILD_SHARED_LIBRARY)
@@ -518,7 +518,7 @@ endif
LOCAL_SRC_FILES := $(libchromeCommonUnittestSrc)
LOCAL_RTTI_FLAG := -frtti
LOCAL_CPP_EXTENSION := $(libchromeCommonCppExtension)
-LOCAL_CFLAGS := $(libchromeCommonCFlags) -DUNIT_TEST
+LOCAL_CFLAGS := $(libchromeCommonCFlags) -DUNIT_TEST -DDONT_EMBED_BUILD_METADATA
LOCAL_CPPFLAGS := $(libchromeCommonCppFlags)
LOCAL_C_INCLUDES := $(libchromeCommonCIncludes)
LOCAL_SHARED_LIBRARIES := libchrome libevent
diff --git a/base/build_time.cc b/base/build_time.cc
index b8b4296690..866840d49f 100644
--- a/base/build_time.cc
+++ b/base/build_time.cc
@@ -7,6 +7,10 @@
#include "base/logging.h"
#include "base/time/time.h"
+#ifdef __ANDROID__
+#include <cutils/properties.h>
+#endif
+
namespace base {
Time GetBuildTime() {
@@ -16,7 +20,10 @@ Time GetBuildTime() {
//
// __DATE__ is exactly "Mmm DD YYYY".
// __TIME__ is exactly "hh:mm:ss".
-#if defined(DONT_EMBED_BUILD_METADATA) && !defined(OFFICIAL_BUILD)
+#if defined(__ANDROID__)
+ char kDateTime[PROPERTY_VALUE_MAX];
+ property_get("ro.build.date", kDateTime, "Sep 02 2008 08:00:00 PST");
+#elif defined(DONT_EMBED_BUILD_METADATA) && !defined(OFFICIAL_BUILD)
const char kDateTime[] = "Sep 02 2008 08:00:00 PST";
#else
const char kDateTime[] = __DATE__ " " __TIME__ " PST";