[Feature]add MT2731_MP2_MR2_SVN388 baseline version

Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/meta/meta-mediatek-ivt/recipes-platform/platform-libs-header/files/0001.patch b/meta/meta-mediatek-ivt/recipes-platform/platform-libs-header/files/0001.patch
new file mode 100644
index 0000000..b21c714
--- /dev/null
+++ b/meta/meta-mediatek-ivt/recipes-platform/platform-libs-header/files/0001.patch
@@ -0,0 +1,761 @@
+diff --git a/Makefile.am b/Makefile.am
+new file mode 100644
+index 0000000..28276e6
+--- /dev/null
++++ b/Makefile.am
+@@ -0,0 +1,12 @@
++SUBDIRS = \
++	frameworks/native/include \
++	hardware/libhardware_legacy/include \
++	system/core/base/include \
++	system/core/include \
++	system/core/liblog \
++	system/core/libcutils \
++	hardware/libhardware_legacy \
++	system/core/libnetutils \
++	system/core/libnetutils/include \
++	system/core/libutils \
++	frameworks/native/libs/binder
+diff --git a/configure.ac b/configure.ac
+new file mode 100644
+index 0000000..60f5e48
+--- /dev/null
++++ b/configure.ac
+@@ -0,0 +1,21 @@
++AC_INIT([platform-libs], [1.0])
++AM_INIT_AUTOMAKE([foreign])
++AC_PROG_CXX
++AC_ENABLE_SHARED
++AC_DISABLE_STATIC
++LT_INIT
++AC_CONFIG_FILES([
++	Makefile
++	frameworks/native/include/Makefile
++	frameworks/native/libs/binder/Makefile
++	hardware/libhardware_legacy/Makefile
++	hardware/libhardware_legacy/include/Makefile
++	system/core/base/include/Makefile
++	system/core/include/Makefile
++	system/core/libcutils/Makefile
++	system/core/liblog/Makefile
++	system/core/libnetutils/Makefile
++	system/core/libnetutils/include/Makefile
++	system/core/libutils/Makefile
++])
++AC_OUTPUT
+diff --git a/frameworks/native/include/Makefile.am b/frameworks/native/include/Makefile.am
+new file mode 100644
+index 0000000..0a3bd94
+--- /dev/null
++++ b/frameworks/native/include/Makefile.am
+@@ -0,0 +1,2 @@
++nobase_include_HEADERS = \
++	binder/Parcel.h
+diff --git a/frameworks/native/include/binder/Parcel.h b/frameworks/native/include/binder/Parcel.h
+index 97a3376..cc8ed09 100644
+--- a/frameworks/native/include/binder/Parcel.h
++++ b/frameworks/native/include/binder/Parcel.h
+@@ -21,20 +21,31 @@
+ #include <vector>
+ 
+ #include <android-base/unique_fd.h>
++#if 0
+ #include <cutils/native_handle.h>
++#endif
+ #include <utils/Errors.h>
++#if 0
+ #include <utils/RefBase.h>
++#endif
+ #include <utils/String16.h>
++#if 0
+ #include <utils/Vector.h>
+ #include <utils/Flattenable.h>
+ #include <linux/binder.h>
+ 
+ #include <binder/IInterface.h>
+ #include <binder/Parcelable.h>
++#endif
++#include <limits>
++#include <memory>
++typedef size_t binder_size_t;
++typedef uintptr_t binder_uintptr_t;
+ 
+ // ---------------------------------------------------------------------------
+ namespace android {
+ 
++#if 0
+ template <typename T> class Flattenable;
+ template <typename T> class LightFlattenable;
+ class IBinder;
+@@ -42,6 +53,7 @@ class IPCThreadState;
+ class ProcessState;
+ class String8;
+ class TextOutput;
++#endif
+ 
+ class Parcel {
+     friend class IPCThreadState;
+@@ -73,6 +85,7 @@ public:
+ 
+     bool                hasFileDescriptors() const;
+ 
++#if 0
+     // Writes the RPC header.
+     status_t            writeInterfaceToken(const String16& interface);
+ 
+@@ -86,6 +99,7 @@ public:
+     bool                enforceInterface(const String16& interface,
+                                          IPCThreadState* threadState = NULL) const;
+     bool                checkInterface(IBinder*) const;
++#endif
+ 
+     void                freeData();
+ 
+@@ -108,12 +122,18 @@ public:
+     status_t            writeFloat(float val);
+     status_t            writeDouble(double val);
+     status_t            writeCString(const char* str);
++#if 0
+     status_t            writeString8(const String8& str);
++#endif
+     status_t            writeString16(const String16& str);
++#if 0
+     status_t            writeString16(const std::unique_ptr<String16>& str);
++#endif
+     status_t            writeString16(const char16_t* str, size_t len);
++#if 0
+     status_t            writeStrongBinder(const sp<IBinder>& val);
+     status_t            writeWeakBinder(const wp<IBinder>& val);
++#endif
+     status_t            writeInt32Array(size_t len, const int32_t *val);
+     status_t            writeByteArray(size_t len, const uint8_t *val);
+     status_t            writeBool(bool val);
+@@ -140,13 +160,16 @@ public:
+     status_t            writeBoolVector(const std::vector<bool>& val);
+     status_t            writeCharVector(const std::unique_ptr<std::vector<char16_t>>& val);
+     status_t            writeCharVector(const std::vector<char16_t>& val);
++#if 0
+     status_t            writeString16Vector(
+                             const std::unique_ptr<std::vector<std::unique_ptr<String16>>>& val);
+     status_t            writeString16Vector(const std::vector<String16>& val);
++#endif
+     status_t            writeUtf8VectorAsUtf16Vector(
+                             const std::unique_ptr<std::vector<std::unique_ptr<std::string>>>& val);
+     status_t            writeUtf8VectorAsUtf16Vector(const std::vector<std::string>& val);
+ 
++#if 0
+     status_t            writeStrongBinderVector(const std::unique_ptr<std::vector<sp<IBinder>>>& val);
+     status_t            writeStrongBinderVector(const std::vector<sp<IBinder>>& val);
+ 
+@@ -214,6 +237,7 @@ public:
+     // Currently the native implementation doesn't do any of the StrictMode
+     // stack gathering and serialization that the Java implementation does.
+     status_t            writeNoException();
++#endif
+ 
+     void                remove(size_t start, size_t amt);
+     
+@@ -245,11 +269,16 @@ public:
+     status_t            readUtf8FromUtf16(std::unique_ptr<std::string>* str) const;
+ 
+     const char*         readCString() const;
++#if 0
+     String8             readString8() const;
++#endif
+     String16            readString16() const;
++#if 0
+     status_t            readString16(String16* pArg) const;
+     status_t            readString16(std::unique_ptr<String16>* pArg) const;
++#endif
+     const char16_t*     readString16Inplace(size_t* outLen) const;
++#if 0
+     sp<IBinder>         readStrongBinder() const;
+     status_t            readStrongBinder(sp<IBinder>* val) const;
+     status_t            readNullableStrongBinder(sp<IBinder>* val) const;
+@@ -274,6 +303,7 @@ public:
+ 
+     status_t            readStrongBinderVector(std::unique_ptr<std::vector<sp<IBinder>>>* val) const;
+     status_t            readStrongBinderVector(std::vector<sp<IBinder>>* val) const;
++#endif
+ 
+     status_t            readByteVector(std::unique_ptr<std::vector<int8_t>>* val) const;
+     status_t            readByteVector(std::vector<int8_t>* val) const;
+@@ -291,13 +321,16 @@ public:
+     status_t            readBoolVector(std::vector<bool>* val) const;
+     status_t            readCharVector(std::unique_ptr<std::vector<char16_t>>* val) const;
+     status_t            readCharVector(std::vector<char16_t>* val) const;
++#if 0
+     status_t            readString16Vector(
+                             std::unique_ptr<std::vector<std::unique_ptr<String16>>>* val) const;
+     status_t            readString16Vector(std::vector<String16>* val) const;
++#endif
+     status_t            readUtf8VectorFromUtf16Vector(
+                             std::unique_ptr<std::vector<std::unique_ptr<std::string>>>* val) const;
+     status_t            readUtf8VectorFromUtf16Vector(std::vector<std::string>* val) const;
+ 
++#if 0
+     template<typename T>
+     status_t            read(Flattenable<T>& val) const;
+ 
+@@ -341,6 +374,7 @@ public:
+ 
+     // Explicitly close all file descriptors in the parcel.
+     void                closeFileDescriptors();
++#endif
+ 
+     // Debugging: get metrics on current allocations.
+     static size_t       getGlobalAllocSize();
+@@ -352,6 +386,7 @@ private:
+                                         const binder_size_t* objects, size_t objectsSize,
+                                         void* cookie);
+                         
++#if 0
+     uintptr_t           ipcData() const;
+     size_t              ipcDataSize() const;
+     uintptr_t           ipcObjects() const;
+@@ -362,6 +397,7 @@ private:
+     
+ public:
+     void                print(TextOutput& to, uint32_t flags = 0) const;
++#endif
+ 
+ private:
+                         Parcel(const Parcel& o);
+@@ -378,7 +414,9 @@ private:
+     uintptr_t           readPointer() const;
+     void                freeDataNoInit();
+     void                initState();
++#if 0
+     void                scanForFds() const;
++#endif
+                         
+     template<class T>
+     status_t            readAligned(T *pArg) const;
+@@ -388,8 +426,10 @@ private:
+     template<class T>
+     status_t            writeAligned(T val);
+ 
++#if 0
+     status_t            writeRawNullableParcelable(const Parcelable*
+                                                    parcelable);
++#endif
+ 
+     template<typename T, typename U>
+     status_t            unsafeReadTypedVector(std::vector<T>* val,
+@@ -453,6 +493,7 @@ private:
+         bool mMutable;
+     };
+ 
++#if 0
+     class FlattenableHelperInterface {
+     protected:
+         ~FlattenableHelperInterface() { }
+@@ -485,6 +526,7 @@ private:
+     };
+     status_t write(const FlattenableHelperInterface& val);
+     status_t read(FlattenableHelperInterface& val) const;
++#endif
+ 
+ public:
+     class ReadableBlob : public Blob {
+@@ -511,6 +553,7 @@ public:
+ 
+ // ---------------------------------------------------------------------------
+ 
++#if 0
+ template<typename T>
+ status_t Parcel::write(const Flattenable<T>& val) {
+     const FlattenableHelper<T> helper(val);
+@@ -591,6 +634,7 @@ status_t Parcel::readNullableStrongBinder(sp<T>* val) const {
+         }
+     }
+ }
++#endif
+ 
+ template<typename T, typename U>
+ status_t Parcel::unsafeReadTypedVector(
+@@ -706,6 +750,7 @@ status_t Parcel::writeNullableTypedVector(const std::unique_ptr<std::vector<T>>&
+     return unsafeWriteTypedVector(*val, write_func);
+ }
+ 
++#if 0
+ template<typename T>
+ status_t Parcel::readParcelableVector(std::vector<T>* val) const {
+     return unsafeReadTypedVector<T, Parcelable>(val, &Parcel::readParcelable);
+@@ -800,6 +845,7 @@ status_t unflatten_binder(const sp<ProcessState>& proc,
+                           const flat_binder_object& flat, sp<IBinder>* out);
+ status_t unflatten_binder(const sp<ProcessState>& proc,
+                           const flat_binder_object& flat, wp<IBinder>* out);
++#endif
+ 
+ }; // namespace android
+ 
+diff --git a/frameworks/native/libs/binder/Makefile.am b/frameworks/native/libs/binder/Makefile.am
+new file mode 100644
+index 0000000..b1eb2c2
+--- /dev/null
++++ b/frameworks/native/libs/binder/Makefile.am
+@@ -0,0 +1,16 @@
++lib_LTLIBRARIES = libbinder.la
++
++libbinder_la_SOURCES = \
++	Parcel.cpp
++
++libbinder_la_CPPFLAGS = \
++	-I$(top_srcdir)/frameworks/native/include \
++	-I$(top_srcdir)/system/core/include \
++	-I$(top_srcdir)/system/core/base/include
++
++libbinder_la_CXXFLAGS = -std=gnu++14
++
++libbinder_la_LIBADD = \
++	$(top_builddir)/system/core/liblog/liblog.la \
++	$(top_builddir)/system/core/libcutils/libcutils.la \
++	$(top_builddir)/system/core/libutils/libutils.la
+diff --git a/frameworks/native/libs/binder/Parcel.cpp b/frameworks/native/libs/binder/Parcel.cpp
+index 6fd6ddc..a6aad09 100644
+--- a/frameworks/native/libs/binder/Parcel.cpp
++++ b/frameworks/native/libs/binder/Parcel.cpp
+@@ -29,24 +29,39 @@
+ #include <sys/types.h>
+ #include <unistd.h>
+ 
++#if 0
+ #include <binder/Binder.h>
+ #include <binder/BpBinder.h>
+ #include <binder/IPCThreadState.h>
++#endif
+ #include <binder/Parcel.h>
++#if 0
+ #include <binder/ProcessState.h>
+ #include <binder/Status.h>
+ #include <binder/TextOutput.h>
+ 
+ #include <cutils/ashmem.h>
++#endif
+ #include <utils/Debug.h>
++#if 0
+ #include <utils/Flattenable.h>
+ #include <utils/Log.h>
++#endif
+ #include <utils/misc.h>
++#if 0
+ #include <utils/String8.h>
+ #include <utils/String16.h>
+ 
+ #include <private/binder/binder_module.h>
+ #include <private/binder/Static.h>
++#endif
++#include <limits.h>
++#include <string.h>
++#include <utils/Unicode.h>
++#define ALOGE printf
++#define ALOGV printf
++#define LOG_ALWAYS_FATAL printf
++#define SIZE_T_MAX ULONG_MAX
+ 
+ #ifndef INT32_MAX
+ #define INT32_MAX ((int32_t)(2147483647))
+@@ -123,6 +138,7 @@ static dev_t ashmem_rdev()
+     return rdev;
+ }
+ 
++#if 0
+ void acquire_object(const sp<ProcessState>& proc,
+     const flat_binder_object& obj, const void* who, size_t* outAshmemSize)
+ {
+@@ -371,6 +387,7 @@ status_t unflatten_binder(const sp<ProcessState>& proc,
+     }
+     return BAD_TYPE;
+ }
++#endif
+ 
+ // ---------------------------------------------------------------------------
+ 
+@@ -487,6 +504,7 @@ status_t Parcel::setData(const uint8_t* buffer, size_t len)
+     return err;
+ }
+ 
++#if 0
+ status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len)
+ {
+     const sp<ProcessState> proc(ProcessState::self());
+@@ -650,6 +668,7 @@ bool Parcel::enforceInterface(const String16& interface,
+         return false;
+     }
+ }
++#endif
+ 
+ const binder_size_t* Parcel::objects() const
+ {
+@@ -925,6 +944,7 @@ status_t Parcel::writeCharVector(const std::unique_ptr<std::vector<char16_t>>& v
+     return writeNullableTypedVector(val, &Parcel::writeChar);
+ }
+ 
++#if 0
+ status_t Parcel::writeString16Vector(const std::vector<String16>& val)
+ {
+     return writeTypedVector(val, &Parcel::writeString16);
+@@ -935,6 +955,7 @@ status_t Parcel::writeString16Vector(
+ {
+     return writeNullableTypedVector(val, &Parcel::writeString16);
+ }
++#endif
+ 
+ status_t Parcel::writeUtf8VectorAsUtf16Vector(
+                         const std::unique_ptr<std::vector<std::unique_ptr<std::string>>>& val) {
+@@ -1049,6 +1070,7 @@ status_t Parcel::writeCString(const char* str)
+     return write(str, strlen(str)+1);
+ }
+ 
++#if 0
+ status_t Parcel::writeString8(const String8& str)
+ {
+     status_t err = writeInt32(str.bytes());
+@@ -1074,6 +1096,7 @@ status_t Parcel::writeString16(const String16& str)
+ {
+     return writeString16(str.string(), str.size());
+ }
++#endif
+ 
+ status_t Parcel::writeString16(const char16_t* str, size_t len)
+ {
+@@ -1093,6 +1116,7 @@ status_t Parcel::writeString16(const char16_t* str, size_t len)
+     return err;
+ }
+ 
++#if 0
+ status_t Parcel::writeStrongBinder(const sp<IBinder>& val)
+ {
+     return flatten_binder(ProcessState::self(), val, this);
+@@ -1350,6 +1374,7 @@ status_t Parcel::writeNoException()
+     binder::Status status;
+     return status.writeToParcel(this);
+ }
++#endif
+ 
+ void Parcel::remove(size_t /*start*/, size_t /*amt*/)
+ {
+@@ -1600,6 +1625,7 @@ status_t Parcel::readCharVector(std::vector<char16_t>* val) const {
+     return readTypedVector(val, &Parcel::readChar);
+ }
+ 
++#if 0
+ status_t Parcel::readString16Vector(
+         std::unique_ptr<std::vector<std::unique_ptr<String16>>>* val) const {
+     return readNullableTypedVector(val, &Parcel::readString16);
+@@ -1608,6 +1634,7 @@ status_t Parcel::readString16Vector(
+ status_t Parcel::readString16Vector(std::vector<String16>* val) const {
+     return readTypedVector(val, &Parcel::readString16);
+ }
++#endif
+ 
+ status_t Parcel::readUtf8VectorFromUtf16Vector(
+         std::unique_ptr<std::vector<std::unique_ptr<std::string>>>* val) const {
+@@ -1832,6 +1859,7 @@ const char* Parcel::readCString() const
+     return NULL;
+ }
+ 
++#if 0
+ String8 Parcel::readString8() const
+ {
+     int32_t size = readInt32();
+@@ -1887,6 +1915,7 @@ status_t Parcel::readString16(String16* pArg) const
+         return UNEXPECTED_NULL;
+     }
+ }
++#endif
+ 
+ const char16_t* Parcel::readString16Inplace(size_t* outLen) const
+ {
+@@ -1903,6 +1932,7 @@ const char16_t* Parcel::readString16Inplace(size_t* outLen) const
+     return NULL;
+ }
+ 
++#if 0
+ status_t Parcel::readStrongBinder(sp<IBinder>* val) const
+ {
+     status_t status = readNullableStrongBinder(val);
+@@ -2240,9 +2270,11 @@ void Parcel::print(TextOutput& to, uint32_t /*flags*/) const
+ 
+     to << ")";
+ }
++#endif
+ 
+ void Parcel::releaseObjects()
+ {
++#if 0
+     const sp<ProcessState> proc(ProcessState::self());
+     size_t i = mObjectsSize;
+     uint8_t* const data = mData;
+@@ -2253,10 +2285,12 @@ void Parcel::releaseObjects()
+             = reinterpret_cast<flat_binder_object*>(data+objects[i]);
+         release_object(proc, *flat, this, &mOpenAshmemSize);
+     }
++#endif
+ }
+ 
+ void Parcel::acquireObjects()
+ {
++#if 0
+     const sp<ProcessState> proc(ProcessState::self());
+     size_t i = mObjectsSize;
+     uint8_t* const data = mData;
+@@ -2267,6 +2301,7 @@ void Parcel::acquireObjects()
+             = reinterpret_cast<flat_binder_object*>(data+objects[i]);
+         acquire_object(proc, *flat, this, &mOpenAshmemSize);
+     }
++#endif
+ }
+ 
+ void Parcel::freeData()
+@@ -2447,6 +2482,7 @@ status_t Parcel::continueWrite(size_t desired)
+ 
+     } else if (mData) {
+         if (objectsSize < mObjectsSize) {
++#if 0
+             // Need to release refs on any objects we are dropping.
+             const sp<ProcessState> proc(ProcessState::self());
+             for (size_t i=objectsSize; i<mObjectsSize; i++) {
+@@ -2458,6 +2494,7 @@ status_t Parcel::continueWrite(size_t desired)
+                 }
+                 release_object(proc, *flat, this, &mOpenAshmemSize);
+             }
++#endif
+             binder_size_t* objects =
+                 (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t));
+             if (objects) {
+@@ -2544,6 +2581,7 @@ void Parcel::initState()
+     mOpenAshmemSize = 0;
+ }
+ 
++#if 0
+ void Parcel::scanForFds() const
+ {
+     bool hasFds = false;
+@@ -2558,6 +2596,7 @@ void Parcel::scanForFds() const
+     mHasFds = hasFds;
+     mFdsKnown = true;
+ }
++#endif
+ 
+ size_t Parcel::getBlobAshmemSize() const
+ {
+diff --git a/hardware/libhardware_legacy/Makefile.am b/hardware/libhardware_legacy/Makefile.am
+new file mode 100644
+index 0000000..1c2c55e
+--- /dev/null
++++ b/hardware/libhardware_legacy/Makefile.am
+@@ -0,0 +1,8 @@
++lib_LTLIBRARIES = libpower.la
++
++libpower_la_SOURCES = \
++	power/power.c
++
++libpower_la_CPPFLAGS = \
++	-I$(top_srcdir)/hardware/libhardware_legacy/include \
++	-I$(top_srcdir)/system/core/include
+diff --git a/hardware/libhardware_legacy/include/Makefile.am b/hardware/libhardware_legacy/include/Makefile.am
+new file mode 100644
+index 0000000..f38e70b
+--- /dev/null
++++ b/hardware/libhardware_legacy/include/Makefile.am
+@@ -0,0 +1,2 @@
++nobase_include_HEADERS = \
++	hardware_legacy/power.h
+diff --git a/system/core/base/include/Makefile.am b/system/core/base/include/Makefile.am
+new file mode 100644
+index 0000000..d22d479
+--- /dev/null
++++ b/system/core/base/include/Makefile.am
+@@ -0,0 +1,2 @@
++nobase_include_HEADERS = \
++	android-base/unique_fd.h
+diff --git a/system/core/include/Makefile.am b/system/core/include/Makefile.am
+new file mode 100644
+index 0000000..e2ca17b
+--- /dev/null
++++ b/system/core/include/Makefile.am
+@@ -0,0 +1,18 @@
++nobase_include_HEADERS = \
++	cutils/jstring.h \
++	cutils/record_stream.h \
++	cutils/sockets.h \
++	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
+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/libcutils/Makefile.am b/system/core/libcutils/Makefile.am
+new file mode 100644
+index 0000000..51dadb4
+--- /dev/null
++++ b/system/core/libcutils/Makefile.am
+@@ -0,0 +1,19 @@
++lib_LTLIBRARIES = libcutils.la
++
++libcutils_la_SOURCES = \
++	socket_inaddr_any_server_unix.c \
++	socket_local_client_unix.c \
++	socket_local_server_unix.c \
++	socket_loopback_client_unix.c \
++	socket_loopback_server_unix.c \
++	socket_network_client_unix.c \
++	sockets_unix.cpp \
++	strdup16to8.c \
++	strdup8to16.c
++
++libcutils_la_CPPFLAGS = \
++	-I$(top_srcdir)/system/core/include
++
++libcutils_la_CFLAGS = -std=gnu90
++
++libcutils_la_LIBADD = $(top_builddir)/system/core/liblog/liblog.la
+diff --git a/system/core/liblog/Makefile.am b/system/core/liblog/Makefile.am
+new file mode 100644
+index 0000000..1c3443c
+--- /dev/null
++++ b/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/system/core/libnetutils/Makefile.am b/system/core/libnetutils/Makefile.am
+new file mode 100644
+index 0000000..a4a73ce
+--- /dev/null
++++ b/system/core/libnetutils/Makefile.am
+@@ -0,0 +1,11 @@
++lib_LTLIBRARIES = libnetutils.la
++
++libnetutils_la_SOURCES = \
++	ifc_utils.c
++
++libnetutils_la_CPPFLAGS = \
++	-I$(top_srcdir)/system/core/libnetutils/include
++
++libnetutils_la_LIBADD = \
++	$(top_builddir)/bionic/libc/libc_dns.la
++#	$(top_builddir)/system/core/liblog/liblog.la
+diff --git a/system/core/libnetutils/ifc_utils.c b/system/core/libnetutils/ifc_utils.c
+index f9f62f8..f637939 100644
+--- a/system/core/libnetutils/ifc_utils.c
++++ b/system/core/libnetutils/ifc_utils.c
+@@ -25,7 +25,9 @@
+ #include <sys/types.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
++#ifdef ANDROID
+ #include <net/if.h>
++#endif
+ #include <netdb.h>
+ 
+ #include <linux/if.h>
+@@ -47,6 +49,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #define ALOGD printf
++#define ALOGE printf
+ #define ALOGW printf
+ #endif
+ 
+@@ -57,7 +60,11 @@
+ 
+ static int ifc_ctl_sock = -1;
+ static int ifc_ctl_sock6 = -1;
++#ifdef ANDROID
+ void printerr(char *fmt, ...);
++#else
++#define printerr printf
++#endif
+ 
+ #define DBG 0
+ #define INET_ADDRLEN 4
+@@ -678,6 +685,7 @@ int ifc_remove_default_route(const char *ifname)
+     return result;
+ }
+ 
++#ifdef ANDROID
+ int
+ ifc_configure(const char *ifname,
+         in_addr_t address,
+@@ -720,3 +728,4 @@ ifc_configure(const char *ifname,
+ 
+     return 0;
+ }
++#endif
+diff --git a/system/core/libnetutils/include/Makefile.am b/system/core/libnetutils/include/Makefile.am
+new file mode 100644
+index 0000000..fc71a47
+--- /dev/null
++++ b/system/core/libnetutils/include/Makefile.am
+@@ -0,0 +1,2 @@
++nobase_include_HEADERS = \
++	netutils/ifc.h
+diff --git a/system/core/libutils/Makefile.am b/system/core/libutils/Makefile.am
+new file mode 100644
+index 0000000..2bbf615
+--- /dev/null
++++ b/system/core/libutils/Makefile.am
+@@ -0,0 +1,18 @@
++lib_LTLIBRARIES = libutils.la
++
++libutils_la_SOURCES = \
++	Looper.cpp \
++	RefBase.cpp \
++	SharedBuffer.cpp \
++	SystemClock.cpp \
++	Timers.cpp \
++	Unicode.cpp \
++	VectorImpl.cpp
++
++libutils_la_CPPFLAGS = \
++	-I$(top_srcdir)/external/safe-iop/include \
++	-I$(top_srcdir)/system/core/include
++
++libutils_la_CXXFLAGS = -std=gnu++14
++
++libutils_la_LIBADD = $(top_builddir)/system/core/liblog/liblog.la