[Feature]add MT2731_MP2_MR2_SVN388 baseline version

Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/meta/meta-mediatek/recipes-support/platform-libs-common/files/base.patch b/meta/meta-mediatek/recipes-support/platform-libs-common/files/base.patch
new file mode 100644
index 0000000..4f70bf5
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/platform-libs-common/files/base.patch
@@ -0,0 +1,42 @@
+diff --git a/system/core/base/errors_unix.cpp b/system/core/base/errors_unix.cpp
+old mode 100644
+new mode 100755
+index 296995e..48269b6
+--- a/system/core/base/errors_unix.cpp
++++ b/system/core/base/errors_unix.cpp
+@@ -17,6 +17,7 @@
+ #include "android-base/errors.h"
+ 
+ #include <errno.h>
++#include <string.h>
+ 
+ namespace android {
+ namespace base {
+diff --git a/system/core/base/file.cpp b/system/core/base/file.cpp
+old mode 100644
+new mode 100755
+index da1adba..91a3901
+--- a/system/core/base/file.cpp
++++ b/system/core/base/file.cpp
+@@ -20,6 +20,7 @@
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <string.h>
+ 
+ #include <string>
+ 
+diff --git a/system/core/base/logging.cpp b/system/core/base/logging.cpp
+old mode 100644
+new mode 100755
+index 1741871..e5a98e3
+--- a/system/core/base/logging.cpp
++++ b/system/core/base/logging.cpp
+@@ -18,6 +18,7 @@
+ #include <windows.h>
+ #endif
+ 
++#include <string.h>
+ #include "android-base/logging.h"
+ 
+ #include <libgen.h>
diff --git a/meta/meta-mediatek/recipes-support/platform-libs-common/files/include.patch b/meta/meta-mediatek/recipes-support/platform-libs-common/files/include.patch
new file mode 100644
index 0000000..b13bff7
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/platform-libs-common/files/include.patch
@@ -0,0 +1,218 @@
+diff --git a/system/core/include/cutils/atomic.h b/system/core/include/cutils/atomic.h
+index ded972a..fb83e77 100644
+--- a/system/core/include/cutils/atomic.h
++++ b/system/core/include/cutils/atomic.h
+@@ -19,7 +19,12 @@
+ 
+ #include <stdint.h>
+ #include <sys/types.h>
++#ifdef __cplusplus
++#include <atomic>
++using namespace std;
++#else
+ #include <stdatomic.h>
++#endif
+ 
+ #ifndef ANDROID_ATOMIC_INLINE
+ #define ANDROID_ATOMIC_INLINE static inline
+diff --git a/system/core/include/cutils/properties.h b/system/core/include/cutils/properties.h
+index 24aa224..2957e2c 100644
+--- a/system/core/include/cutils/properties.h
++++ b/system/core/include/cutils/properties.h
+@@ -33,8 +33,8 @@ extern "C" {
+ ** WARNING: system/bionic/include/sys/system_properties.h also defines
+ **          these, but with different names.  (TODO: fix that)
+ */
+-#define PROPERTY_KEY_MAX   PROP_NAME_MAX
+-#define PROPERTY_VALUE_MAX  PROP_VALUE_MAX
++#define PROPERTY_KEY_MAX   64
++#define PROPERTY_VALUE_MAX  96
+ 
+ /* property_get: returns the length of the value which will never be
+ ** greater than PROPERTY_VALUE_MAX - 1 and will always be zero terminated.
+diff --git a/system/core/include/private/android_filesystem_config.h b/system/core/include/private/android_filesystem_config.h
+index e540de2..dac5eb5 100644
+--- a/system/core/include/private/android_filesystem_config.h
++++ b/system/core/include/private/android_filesystem_config.h
+@@ -40,7 +40,7 @@
+ 
+ #define AID_ROOT             0  /* traditional unix root user */
+ 
+-#define AID_SYSTEM        1000  /* system server */
++#define AID_SYSTEM        0  /* system server */
+ 
+ #define AID_RADIO         1001  /* telephony subsystem, RIL */
+ #define AID_BLUETOOTH     1002  /* bluetooth subsystem */
+diff --git a/system/core/include/sysutils/FrameworkListener.h b/system/core/include/sysutils/FrameworkListener.h
+index 18049cd..2137069 100644
+--- a/system/core/include/sysutils/FrameworkListener.h
++++ b/system/core/include/sysutils/FrameworkListener.h
+@@ -32,6 +32,7 @@ private:
+     int mCommandCount;
+     bool mWithSeq;
+     FrameworkCommandCollection *mCommands;
++    bool mSkipToNextNullByte;
+ 
+ public:
+     FrameworkListener(const char *socketName);
+diff --git a/system/core/include/sysutils/NetlinkEvent.h b/system/core/include/sysutils/NetlinkEvent.h
+index b80f3ea..fd9cab4 100644
+--- a/system/core/include/sysutils/NetlinkEvent.h
++++ b/system/core/include/sysutils/NetlinkEvent.h
+@@ -34,6 +34,9 @@ public:
+         kRdnss = 8,
+         kRouteUpdated = 9,
+         kRouteRemoved = 10,
++        kIPv6Enable = 100,
++        kIPv6Disable = 101,
++        kNoRA = 108,
+     };
+ 
+ private:
+@@ -64,6 +67,8 @@ public:
+     bool parseNfPacketMessage(struct nlmsghdr *nh);
+     bool parseRtMessage(const struct nlmsghdr *nh);
+     bool parseNdUserOptMessage(const struct nlmsghdr *nh);
++    bool parseNewPrefixMessage(const struct nlmsghdr *nh);    
++    bool parseNoRAMessage(const struct nlmsghdr *nh);   
+ };
+ 
+ #endif
+diff --git a/system/core/include/utils/CallStack.h b/system/core/include/utils/CallStack.h
+index 27e89f4..ee986b7 100644
+--- a/system/core/include/utils/CallStack.h
++++ b/system/core/include/utils/CallStack.h
+@@ -18,7 +18,12 @@
+ #define ANDROID_CALLSTACK_H
+ 
+ #include <android/log.h>
++#ifdef __ANDROID__
+ #include <backtrace/backtrace_constants.h>
++#else
++#define BACKTRACE_CURRENT_THREAD -1
++#endif
++
+ #include <utils/String8.h>
+ #include <utils/Vector.h>
+ 
+diff --git a/system/core/include/utils/Printer.h b/system/core/include/utils/Printer.h
+index bb66287..5371afb 100644
+--- a/system/core/include/utils/Printer.h
++++ b/system/core/include/utils/Printer.h
+@@ -17,7 +17,11 @@
+ #ifndef ANDROID_PRINTER_H
+ #define ANDROID_PRINTER_H
+ 
++#if defined(__ANDROID__)
+ #include <android/log.h>
++#else
++#include <cutils/log.h>
++#endif
+ 
+ namespace android {
+ 
+diff --git a/system/core/include/utils/ThreadDefs.h b/system/core/include/utils/ThreadDefs.h
+index ae091e4..7f73c4e 100644
+--- a/system/core/include/utils/ThreadDefs.h
++++ b/system/core/include/utils/ThreadDefs.h
+@@ -19,8 +19,66 @@
+ 
+ #include <stdint.h>
+ #include <sys/types.h>
++#if defined(__ANDROID__)
+ #include <system/graphics.h>
+ #include <system/thread_defs.h>
++#else
++
++#if defined(__cplusplus)
++extern "C" {
++#endif
++
++enum {
++    /*
++     * ***********************************************
++     * ** Keep in sync with android.os.Process.java **
++     * ***********************************************
++     *
++     * This maps directly to the "nice" priorities we use in Android.
++     * A thread priority should be chosen inverse-proportionally to
++     * the amount of work the thread is expected to do. The more work
++     * a thread will do, the less favorable priority it should get so that
++     * it doesn't starve the system. Threads not behaving properly might
++     * be "punished" by the kernel.
++     * Use the levels below when appropriate. Intermediate values are
++     * acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below.
++     */
++    ANDROID_PRIORITY_LOWEST         =  19,
++
++    /* use for background tasks */
++    ANDROID_PRIORITY_BACKGROUND     =  10,
++
++    /* most threads run at normal priority */
++    ANDROID_PRIORITY_NORMAL         =   0,
++
++    /* threads currently running a UI that the user is interacting with */
++    ANDROID_PRIORITY_FOREGROUND     =  -2,
++
++    /* the main UI thread has a slightly more favorable priority */
++    ANDROID_PRIORITY_DISPLAY        =  -4,
++
++    /* ui service treads might want to run at a urgent display (uncommon) */
++    ANDROID_PRIORITY_URGENT_DISPLAY =  -8,
++
++    /* all normal audio threads */
++    ANDROID_PRIORITY_AUDIO          = -16,
++
++    /* service audio threads (uncommon) */
++    ANDROID_PRIORITY_URGENT_AUDIO   = -18,
++
++    /* should never be used in practice. regular process might not
++     * be allowed to use this level */
++    ANDROID_PRIORITY_HIGHEST        = -20,
++
++    ANDROID_PRIORITY_DEFAULT        = ANDROID_PRIORITY_NORMAL,
++    ANDROID_PRIORITY_MORE_FAVORABLE = -1,
++    ANDROID_PRIORITY_LESS_FAVORABLE = +1,
++};
++
++#if defined(__cplusplus)
++}
++#endif
++#endif
+ 
+ // ---------------------------------------------------------------------------
+ // C API
+diff --git a/system/core/include/utils/Vector.h b/system/core/include/utils/Vector.h
+index ed7b725..239b33f 100644
+--- a/system/core/include/utils/Vector.h
++++ b/system/core/include/utils/Vector.h
+@@ -242,13 +242,13 @@ Vector<TYPE>::~Vector() {
+ 
+ template<class TYPE> inline
+ Vector<TYPE>& Vector<TYPE>::operator = (const Vector<TYPE>& rhs) {
+-    VectorImpl::operator = (rhs);
++    VectorImpl::operator = (static_cast<const VectorImpl&>(rhs));
+     return *this; 
+ }
+ 
+ template<class TYPE> inline
+ const Vector<TYPE>& Vector<TYPE>::operator = (const Vector<TYPE>& rhs) const {
+-    VectorImpl::operator = (static_cast<const VectorImpl&>(rhs));
++    VectorImpl::operator = (rhs);
+     return *this;
+ }
+
+diff --git a/system/core/base/include/android-base/strings.h b/system/core/base/include/android-base/strings.h
+index 69781cd..82f7897 100644
+--- a/system/core/base/include/android-base/strings.h
++++ b/system/core/base/include/android-base/strings.h
+@@ -62,6 +62,9 @@ bool StartsWith(const std::string& s, const char* prefix);
+ // Tests whether 's' ends with 'suffix'.
+ bool EndsWith(const std::string& s, const char* suffix);
+ 
++// Tests whether 'lhs' equals 'rhs', ignoring case.
++bool EqualsIgnoreCase(const std::string& lhs, const std::string& rhs);
++
+ }  // namespace base
+ }  // namespace android
+ 
\ No newline at end of file
diff --git a/meta/meta-mediatek/recipes-support/platform-libs-common/files/liblog.patch b/meta/meta-mediatek/recipes-support/platform-libs-common/files/liblog.patch
new file mode 100644
index 0000000..bac8222
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/platform-libs-common/files/liblog.patch
@@ -0,0 +1,252 @@
+diff --git a/system/core/liblog/logger_write.c b/system/core/liblog/logger_write.c
+index b802ed7..3061862 100644
+--- a/system/core/liblog/logger_write.c
++++ b/system/core/liblog/logger_write.c
+@@ -31,6 +31,14 @@
+ #include <private/android_filesystem_config.h>
+ #include <private/android_logger.h>
+ 
++#define __REDIRECT_TO_SYSLOGD__
++
++#if defined(__REDIRECT_TO_SYSLOGD__)
++#include <syslog.h>
++#include <sys/syscall.h>
++#include <unistd.h>
++#endif
++
+ #include "config_write.h"
+ #include "log_portability.h"
+ #include "logger.h"
+@@ -186,8 +194,187 @@ static inline uint32_t get4LE(const uint8_t* src)
+     return src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
+ }
+ 
++#if defined(__REDIRECT_TO_SYSLOGD__)
++static int filterPriAndSysPri (android_LogPriority pri, int *sys_pri)
++{
++    switch (pri) {
++    case ANDROID_LOG_DEBUG:
++        *sys_pri = LOG_DEBUG;
++        return 3;
++    case ANDROID_LOG_INFO:
++        *sys_pri = LOG_INFO;
++        return 4;
++    case ANDROID_LOG_WARN:
++        *sys_pri = LOG_WARNING;
++         return 5;
++    case ANDROID_LOG_ERROR:
++        *sys_pri = LOG_ERR;
++        return 6;
++    case ANDROID_LOG_FATAL:
++        *sys_pri = LOG_CRIT;
++        return 7;
++    case ANDROID_LOG_SILENT:
++        *sys_pri = LOG_EMERG;
++        return 8;
++
++    case ANDROID_LOG_DEFAULT:
++    case ANDROID_LOG_UNKNOWN:
++    default:
++        *sys_pri = LOG_INFO;
++        return 1;
++    }
++}
++
++static char *filterLogId(log_id_t log_id)
++{
++    switch (log_id) {
++    case LOG_ID_MAIN:
++        return "MAIN";
++    case LOG_ID_RADIO :
++        return "RADIO";
++    case LOG_ID_EVENTS:
++        return "EVENT";
++    case LOG_ID_SYSTEM:
++        return "SYSTEM";
++    default:
++        return "UNKOWN";
++    }
++}
++
++/*
++ * Extract an 8-byte value from a byte stream.
++ */
++static inline uint64_t get8LE(const uint8_t* src)
++{
++    uint32_t low, high;
++
++    low = src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
++    high = src[4] | (src[5] << 8) | (src[6] << 16) | (src[7] << 24);
++    return ((long long) high << 32) | (long long) low;
++}
++
++static char filterEvtType(char type, char *buf, void *payload, ssize_t len)
++{
++    switch(type) {
++    case EVENT_TYPE_INT:
++        sprintf(buf, "%d", get4LE(payload));
++        return 'I';
++    case EVENT_TYPE_LONG:
++        sprintf(buf, "%lld", get8LE(payload));
++        return 'L';
++    case EVENT_TYPE_STRING:
++        snprintf(buf, len, "%s", payload);
++        buf[len] = '\0';
++        return 'S';
++    default: /* not support */
++        sprintf(buf, "?");
++        return '?';
++    }
++}
++#endif
++
++
+ static int __write_to_log_daemon(log_id_t log_id, struct iovec *vec, size_t nr)
+ {
++#if defined(__REDIRECT_TO_SYSLOGD__)
++    int ret;
++    size_t totalLen = 0, defaultLen = 512, prefixLen;
++    int write_allocate = 0;
++    int sys_pri = LOG_INFO;
++    char *writeBuf = NULL;
++    char defaultBuf[512];
++    char prefixBuf[128];
++    char *idChar;
++    int priChar;
++
++    // for main, system, radio
++    ssize_t msg_len = 0;
++    int  priority = ANDROID_LOG_INFO;
++    char *tag, *msg;
++
++    // for event
++    int32_t etag;
++    char type;
++    void *payload;
++
++    // ------------------------------------------------------------------
++    // get log id
++    idChar  = filterLogId(log_id);
++
++#if 0 //disable event logid
++    if(log_id == LOG_ID_EVENTS) { /* event type */
++        if(nr == 2) { // __android_log_bwrite
++            etag    = *((int32_t *)vec[0].iov_base);
++            type    = EVENT_TYPE_INT;
++            payload = (void *)vec[1].iov_base;
++            msg_len = vec[1].iov_len;
++        } else { // __android_log_btwrite
++            etag    = *((int32_t *)vec[0].iov_base);
++            type    = *((char *)vec[1].iov_base);
++
++            if(!strcmp(&type, ""))
++                type = EVENT_TYPE_STRING;
++
++            payload = (void *)vec[2].iov_base;
++            msg_len = vec[2].iov_len;
++        }
++
++        // get type char
++        priChar = filterEvtType(type, prefixBuf, payload, msg_len);
++
++        // format prefix (brief format)
++        snprintf(defaultBuf, sizeof(defaultBuf),
++                 "<%c>/%c/%d(%5d): %s\n",
++                 idChar, priChar, etag, getpid(), prefixBuf);
++        // log to syslog
++        syslog(sys_pri, "%s", defaultBuf);
++        ret = strlen(defaultBuf);
++    }
++    else
++#endif
++    {   /* radio, system, main */
++        // get messages and tag from io vector
++        msg_len  = vec[2].iov_len;
++        priority = *((int *)vec[0].iov_base);
++        tag      = (char *)vec[1].iov_base;
++        msg      = (char *)vec[2].iov_base;
++
++        /* disable Android VERBOSE log */
++        if (priority == ANDROID_LOG_VERBOSE) {
++            return -EINVAL;
++        }
++
++        // get priority and logid char
++        priChar = filterPriAndSysPri(priority, &sys_pri);
++
++        // format prefix (brief format)
++        prefixLen = snprintf(prefixBuf, sizeof(prefixBuf),
++                    "(%5d, %5d),[%s],[%d],[Tag]%s[TAG]: ", getpid(), syscall(SYS_gettid), idChar, priChar, tag);
++
++        // compute size
++        totalLen = prefixLen + msg_len + 1 + 1;
++        if(totalLen <= defaultLen) {
++            writeBuf = defaultBuf;
++        } else {
++            write_allocate = 1;
++            writeBuf = (char *)malloc(totalLen);
++            if(writeBuf == NULL)
++                return 0;
++        }
++
++        // combine final string
++        writeBuf[0] = '\0';
++        strncat(writeBuf, prefixBuf, prefixLen);
++        strncat(writeBuf, msg, msg_len);
++        strcat(writeBuf, "\n");
++
++        // log to syslog
++        syslog(sys_pri, "%s", writeBuf);
++        ret = strlen(writeBuf);
++
++        if(write_allocate) free(writeBuf);
++    }
++#else
+     struct android_log_transport_write *node;
+     int ret;
+     struct timespec ts;
+@@ -316,6 +503,7 @@ static int __write_to_log_daemon(log_id_t log_id, struct iovec *vec, size_t nr)
+             (void)(*node->write)(log_id, &ts, vec, nr);
+         }
+     }
++#endif
+ 
+     return ret;
+ }
+@@ -327,6 +515,27 @@ static int __write_to_log_init(log_id_t log_id, struct iovec *vec, size_t nr)
+     if (write_to_log == __write_to_log_init) {
+         int ret;
+ 
++#if defined(__REDIRECT_TO_SYSLOGD__)
++        // open syslogd
++        if (access("/etc/configs/syslog_split", F_OK) == 0) {
++            switch (log_id) {
++            case LOG_ID_MAIN:
++                openlog("ALOG", 0, LOG_LOCAL0);
++                break;
++            case LOG_ID_SYSTEM:
++                openlog("SLOG", 0, LOG_LOCAL1);
++                break;
++            case LOG_ID_RADIO:
++                openlog("RLOG", 0, LOG_LOCAL2);
++                break;
++            default:
++                openlog("ALOG", 0, LOG_LOCAL0);
++                break;
++            }
++        } else {
++            openlog("ALOG", 0, LOG_USER);
++        }
++#else
+         ret = __write_to_log_initialize();
+         if (ret < 0) {
+             __android_log_unlock();
+@@ -335,7 +544,7 @@ static int __write_to_log_init(log_id_t log_id, struct iovec *vec, size_t nr)
+             }
+             return ret;
+         }
+-
++#endif
+         write_to_log = __write_to_log_daemon;
+     }
+ 
diff --git a/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/Makefile.am b/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/Makefile.am
new file mode 100644
index 0000000..26eb2d2
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/Makefile.am
@@ -0,0 +1,5 @@
+SUBDIRS = \
+	system/core/base/include \
+	system/core/include \
+	system/core/liblog \
+	system/core/base
diff --git a/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/configure.ac b/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/configure.ac
new file mode 100644
index 0000000..1b9a96d
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/configure.ac
@@ -0,0 +1,13 @@
+AC_INIT([platform-libs-updateengine], [1.0])
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+AC_PROG_CXX
+AM_PROG_AS
+LT_INIT
+AC_CONFIG_FILES([
+	Makefile
+	system/core/base/include/Makefile
+	system/core/include/Makefile
+	system/core/liblog/Makefile
+	system/core/base/Makefile
+])
+AC_OUTPUT
diff --git a/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/system/core/base/Makefile.am b/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/system/core/base/Makefile.am
new file mode 100644
index 0000000..53de4aa
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/system/core/base/Makefile.am
@@ -0,0 +1,19 @@
+lib_LTLIBRARIES = libbase.la
+
+libbase_la_SOURCES = \
+	file.cpp \
+	logging.cpp \
+	parsenetaddress.cpp \
+	stringprintf.cpp \
+	strings.cpp \
+	test_utils.cpp \
+	errors_unix.cpp
+	
+libbase_la_CPPFLAGS = -Werror -Wall -Wextra  -std=c++14
+
+libbase_la_CPPFLAGS += \
+	-I$(top_srcdir)/system/core/base/include \
+	-I$(top_srcdir)/system/core/include
+
+libbase_la_LIBADD = \
+	$(top_builddir)/system/core/liblog/liblog.la
\ No newline at end of file
diff --git a/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/system/core/base/include/Makefile.am b/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/system/core/base/include/Makefile.am
new file mode 100644
index 0000000..6d83983
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/system/core/base/include/Makefile.am
@@ -0,0 +1,8 @@
+nobase_include_HEADERS = \
+	android-base/unique_fd.h \
+        android-base/file.h \
+        android-base/logging.h \
+        android-base/macros.h \
+        android-base/stringprintf.h \
+        android-base/strings.h  \
+        android-base/parseint.h
diff --git a/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/system/core/include/Makefile.am b/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/system/core/include/Makefile.am
new file mode 100644
index 0000000..ec0f4eb
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/system/core/include/Makefile.am
@@ -0,0 +1,27 @@
+nobase_include_HEADERS = \
+	utils/Compat.h \
+	utils/Errors.h \
+	utils/KeyedVector.h \
+	utils/RefBase.h \
+	utils/SortedVector.h \
+	utils/String8.h \
+	utils/String16.h \
+	utils/SystemClock.h \
+	utils/Timers.h \
+	utils/TypeHelpers.h \
+	utils/Unicode.h \
+	utils/Vector.h \
+	utils/VectorImpl.h \
+	utils/threads.h \
+	utils/StrongPointer.h \
+	utils/CallStack.h \
+	utils/Printer.h \
+	utils/Looper.h \
+	utils/ThreadDefs.h \
+	utils/AndroidThreads.h \
+	utils/Condition.h \
+	utils/Mutex.h \
+	utils/Thread.h \
+	utils/RWLock.h \
+	utils/List.h
+
diff --git a/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/system/core/liblog/Makefile.am b/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/system/core/liblog/Makefile.am
new file mode 100644
index 0000000..1c3443c
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/platform-libs-common/files/makefiles/platform/system/core/liblog/Makefile.am
@@ -0,0 +1,20 @@
+lib_LTLIBRARIES = liblog.la
+
+liblog_la_SOURCES = \
+	config_write.c \
+	event_tag_map.c \
+	fake_log_device.c \
+	fake_writer.c \
+	log_event_list.c \
+	log_event_write.c \
+	logger_lock.c \
+	logger_name.c \
+	logger_write.c
+
+liblog_la_CFLAGS = -Werror -fvisibility=hidden
+
+liblog_la_CPPFLAGS = \
+	-DFAKE_LOG_DEVICE=1 \
+	-DLIBLOG_LOG_TAG=1005 \
+	-DSNET_EVENT_LOG_TAG=1397638484 \
+	-I$(top_srcdir)/system/core/include
diff --git a/meta/meta-mediatek/recipes-support/platform-libs-common/files/parseint.patch b/meta/meta-mediatek/recipes-support/platform-libs-common/files/parseint.patch
new file mode 100644
index 0000000..136fcc4
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/platform-libs-common/files/parseint.patch
@@ -0,0 +1,57 @@
+diff --git a/system/core/base/include/android-base/parseint.h b/system/core/base/include/android-base/parseint.h
+index ed75e2d..e3ebce6 100644
+--- a/system/core/base/include/android-base/parseint.h
++++ b/system/core/base/include/android-base/parseint.h
+@@ -21,6 +21,7 @@
+ #include <stdlib.h>
+ 
+ #include <limits>
++#include <string>
+ 
+ namespace android {
+ namespace base {
+@@ -31,7 +32,7 @@ namespace base {
+ template <typename T>
+ bool ParseUint(const char* s, T* out,
+                T max = std::numeric_limits<T>::max()) {
+-  int base = (s[0] == '0' && s[1] == 'x') ? 16 : 10;
++  int base = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) ? 16 : 10;
+   errno = 0;
+   char* end;
+   unsigned long long int result = strtoull(s, &end, base);
+@@ -45,6 +46,12 @@ bool ParseUint(const char* s, T* out,
+   return true;
+ }
+ 
++// TODO: string_view
++template <typename T>
++bool ParseUint(const std::string& s, T* out,
++               T max = std::numeric_limits<T>::max()) {
++  return ParseUint(s.c_str(), out, max);
++}
+ // Parses the signed decimal integer in the string 's' and sets 'out' to
+ // that value. Optionally allows the caller to define a 'min' and 'max
+ // beyond which otherwise valid values will be rejected. Returns boolean
+@@ -53,7 +60,7 @@ template <typename T>
+ bool ParseInt(const char* s, T* out,
+               T min = std::numeric_limits<T>::min(),
+               T max = std::numeric_limits<T>::max()) {
+-  int base = (s[0] == '0' && s[1] == 'x') ? 16 : 10;
++  int base = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X')) ? 16 : 10;
+   errno = 0;
+   char* end;
+   long long int result = strtoll(s, &end, base);
+@@ -67,6 +74,13 @@ bool ParseInt(const char* s, T* out,
+   return true;
+ }
+ 
++// TODO: string_view
++template <typename T>
++bool ParseInt(const std::string& s, T* out,
++              T min = std::numeric_limits<T>::min(),
++              T max = std::numeric_limits<T>::max()) {
++  return ParseInt(s.c_str(), out, min, max);
++}
+ }  // namespace base
+ }  // namespace android
+ 
diff --git a/meta/meta-mediatek/recipes-support/platform-libs-common/files/string.patch b/meta/meta-mediatek/recipes-support/platform-libs-common/files/string.patch
new file mode 100644
index 0000000..aeb0438
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/platform-libs-common/files/string.patch
@@ -0,0 +1,14 @@
+diff --git a/system/core/base/strings.cpp b/system/core/base/strings.cpp
+index b8775df..eceb844 100644
+--- a/system/core/base/strings.cpp
++++ b/system/core/base/strings.cpp
+@@ -100,5 +100,9 @@ bool EndsWith(const std::string& s, const char* suffix) {
+   return s.compare(offset, suffix_length, suffix) == 0;
+ }
+ 
++bool EqualsIgnoreCase(const std::string& lhs, const std::string& rhs) {
++  return strcasecmp(lhs.c_str(), rhs.c_str()) == 0;
++}
++
+ }  // namespace base
+ }  // namespace android