Don't use __DATE__/__TIME__ on Android

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
diff --git a/Android.mk b/Android.mk
index ccaff51..23c29a5 100644
--- a/Android.mk
+++ b/Android.mk
@@ -380,7 +380,7 @@
 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 @@
 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 b8b4296..866840d 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 @@
   //
   // __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";