[Feature][ZXW-88]merge P50 version

Only Configure: No
Affected branch: master
Affected module: unknown
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No

Change-Id: I34667719d9e0e7e29e8e4368848601cde0a48408
diff --git a/ap/lib/binder/Makefile b/ap/lib/binder/Makefile
new file mode 100755
index 0000000..3770eef
--- /dev/null
+++ b/ap/lib/binder/Makefile
@@ -0,0 +1,103 @@
+include $(COMMON_MK)
+
+sources := \
+    Binder.cpp \
+    BpBinder.cpp \
+    BufferedTextOutput.cpp \
+    Debug.cpp \
+    IInterface.cpp \
+    IMemory.cpp \
+    IPCThreadState.cpp \
+    IPermissionController.cpp \
+    IServiceManager.cpp \
+    MemoryDealer.cpp \
+    MemoryBase.cpp \
+    MemoryHeapBase.cpp \
+    Parcel.cpp \
+    PermissionCache.cpp \
+    ProcessState.cpp \
+    Static.cpp \
+    TextOutput.cpp \
+
+LOCAL_SRC_FILES = $(sources)
+
+LOCAL_MODULE := libbinder.so
+
+LOCAL_C_INCLUDES = -I./include
+LOCAL_C_INCLUDES += -I./include/log
+LOCAL_C_INCLUDES += -I./include/cutils
+LOCAL_C_INCLUDES += -I./include/utils
+
+LOCAL_CFLAGS += -fPIC -g -O   -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0 
+LOCAL_CFLAGS += -Werror
+
+LOCAL_CPPFLAGS += -fPIC -g -O2 -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
+#LOCAL_CPPFLAGS += -Werror 
+LOCAL_CPPFLAGS += -std=c++11
+
+LOCAL_LDLIBS  += -lpthread
+LOCAL_LDLIBS  += -L./libcutils -lcutils 
+LOCAL_LDLIBS  += -L./liblog    -llog 
+LOCAL_LDLIBS  += -L./libutils  -lutils
+#LOCAL_LDFLAGS += -shared
+LDFLAGS += -Wl,--no-undefined
+LDFLAGS += -shared
+
+LIB_LOG_MODULE = m_liblog
+LIB_UTILS_MODULE = m_libutils
+LIB_CUTILS_MODULE = m_libcutils
+
+ALL_OBJS = $(subst .cpp,.o, $(LOCAL_SRC_FILES))
+
+all : $(LOCAL_MODULE)
+	@echo "Compile $(LOCAL_MODULE) done!"
+
+#clean : $(LIB_UTILS_MODULE)_clean $(LIB_CUTILS_MODULE)_clean $(LIB_LOG_MODULE)_clean
+#	@rm -rvf $(ALL_OBJS) $(LOCAL_MODULE)
+
+#$(LOCAL_MODULE) : $(ALL_OBJS) $(LIB_CUTILS_MODULE) $(LIB_LOG_MODULE) $(LIB_UTILS_MODULE)
+#	$(CXX) $(LOCAL_LDFLAGS) $(LOCAL_CPPFLAGS) -o $@ $^ $(LOCAL_LDLIBS)
+#	$(CXX) $(LDFLAGS) $(LOCAL_CPPFLAGS) -o $@ $(ALL_OBJS) $(LOCAL_LDLIBS)
+
+#%.o:%.c
+#	@echo Compile $< 
+#	$(CC) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -c $< -o $@
+
+#%.o:%.cpp
+#	@echo Compile $< 
+#	$(CXX) $(LOCAL_CPPFLAGS) $(LOCAL_C_INCLUDES) -c $< -o $@
+
+romfs: $(LIB_UTILS_MODULE)_install $(LIB_CUTILS_MODULE)_install $(LIB_LOG_MODULE)_install
+	$(ROMFSINST) $(LOCAL_MODULE) /lib/$(LOCAL_MODULE)
+	@echo $(LOCAL_MODULE) has been installed!
+
+#Make shared library.
+#$(LIB_UTILS_MODULE):
+#	$(MAKE) -C libutils all
+
+#$(LIB_CUTILS_MODULE):
+#	$(MAKE) -C libcutils all
+
+#$(LIB_LOG_MODULE):
+#	$(MAKE) -C liblog all
+
+#Clean shared library.
+#$(LIB_UTILS_MODULE)_clean:
+#	$(MAKE) -C libutils clean
+
+#$(LIB_CUTILS_MODULE)_clean:
+#	$(MAKE) -C libcutils clean
+
+#$(LIB_LOG_MODULE)_clean:
+#	$(MAKE) -C liblog clean
+
+#Install shared library.
+$(LIB_UTILS_MODULE)_install:
+	$(MAKE) -C libutils romfs
+
+$(LIB_CUTILS_MODULE)_install:
+	$(MAKE) -C libcutils romfs
+
+$(LIB_LOG_MODULE)_install:
+	$(MAKE) -C liblog romfs
+
diff --git a/ap/lib/binder/libbinder.so b/ap/lib/binder/libbinder.so
new file mode 100755
index 0000000..07f275a
--- /dev/null
+++ b/ap/lib/binder/libbinder.so
Binary files differ
diff --git a/ap/lib/binder/libcutils/Makefile b/ap/lib/binder/libcutils/Makefile
new file mode 100755
index 0000000..d124952
--- /dev/null
+++ b/ap/lib/binder/libcutils/Makefile
@@ -0,0 +1,95 @@
+include $(COMMON_MK)
+
+TARGET_CPU_SMP = false
+
+ifeq ($(TARGET_CPU_SMP),true)
+    targetSmpFlag := -DANDROID_SMP=1
+else
+    targetSmpFlag := -DANDROID_SMP=0
+endif
+
+commonSources := \
+	hashmap.c \
+	atomic.c \
+	native_handle.c \
+	config_utils.c \
+	load_file.c \
+	open_memstream.c \
+	strdup16to8.c \
+	strdup8to16.c \
+	record_stream.c \
+	process_name.c \
+	threads.c \
+	sched_policy.c \
+	iosched_policy.c \
+	socket_local_client.c \
+	socket_local_server.c
+
+
+
+LOCAL_SRC_FILES := $(commonSources) \
+        ashmem-dev.c \
+        klog.c \
+        memory.c \
+        uevent.c \
+        properties.c \
+
+
+LOCAL_SRC_FILES_arm += \
+        arch-arm/memset32.S \
+
+LOCAL_SRC_FILES_arm64 += \
+        arch-arm64/android_memset.S \
+
+
+LOCAL_CFLAGS_arm   += -DHAVE_MEMSET16 -DHAVE_MEMSET32
+LOCAL_CFLAGS_arm64 += -DHAVE_MEMSET16 -DHAVE_MEMSET32
+
+LOCAL_MODULE := libcutils.so
+
+LOCAL_C_INCLUDES = -I../include
+LOCAL_C_INCLUDES += -I../include/log
+LOCAL_C_INCLUDES += -I../include/cutils
+LOCAL_C_INCLUDES += -I../include/utils
+#-I$(STAGEDIR)
+
+LOCAL_CFLAGS += -fPIC -g -O3   -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL $(targetSmpFlag) $(LOCAL_CFLAGS_arm)
+LOCAL_CFLAGS += -Werror
+# -nostartfiles
+
+LOCAL_CPPFLAGS += -fPIC -g -O2 -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL $(targetSmpFlag) $(LOCAL_CFLAGS_arm)
+LOCAL_CPPFLAGS += -std=c++11
+
+LOCAL_LDLIBS  += -lpthread
+#LOCAL_LDFLAGS += -shared
+LDFLAGS += -shared
+
+ALL_OBJS = $(subst .c,.o, $(LOCAL_SRC_FILES))
+ALL_OBJS_AS = $(subst .S,.o, $(LOCAL_SRC_FILES_arm))
+
+all : $(LOCAL_MODULE)
+	@echo "Compile $(LOCAL_MODULE) done!"
+
+clean :
+	@rm -rvf $(ALL_OBJS) $(LOCAL_MODULE)
+
+$(LOCAL_MODULE) : $(ALL_OBJS) $(ALL_OBJS_AS)
+#	$(CXX) $(LOCAL_LDFLAGS) $(LOCAL_CPPFLAGS) -o $@ $^ $(LOCAL_LDLIBS)
+	$(CXX) $(LDFLAGS) $(LOCAL_CPPFLAGS) -o $@ $^ $(LOCAL_LDLIBS)
+
+%.o:%.c
+	@echo Compile $< 
+	$(CC) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -c $< -o $@
+
+%.o:%.cpp
+	@echo Compile $< 
+	$(CXX) $(LOCAL_CPPFLAGS) $(LOCAL_C_INCLUDES) -c $< -o $@
+
+%.o:%.S
+	@echo Compile $< 
+	$(CXX) $(LOCAL_CPPFLAGS) $(LOCAL_C_INCLUDES) -c $< -o $@
+
+romfs:
+	$(ROMFSINST) $(LOCAL_MODULE) /lib/$(LOCAL_MODULE)
+	@echo $(LOCAL_MODULE) has been installed!
+
diff --git a/ap/lib/binder/libcutils/libcutils.so b/ap/lib/binder/libcutils/libcutils.so
new file mode 100755
index 0000000..d470748
--- /dev/null
+++ b/ap/lib/binder/libcutils/libcutils.so
Binary files differ
diff --git a/ap/lib/binder/liblog/Makefile b/ap/lib/binder/liblog/Makefile
new file mode 100755
index 0000000..3df98e3
--- /dev/null
+++ b/ap/lib/binder/liblog/Makefile
@@ -0,0 +1,69 @@
+include $(COMMON_MK)
+
+TARGET_USES_LOGD = true
+
+ifneq ($(TARGET_USES_LOGD),false)
+liblog_sources := logd_write.c
+else
+liblog_sources := logd_write_kern.c
+endif
+
+liblog_sources += logprint.c event_tag_map.c
+
+liblog_target_sources := $(liblog_sources)
+
+ifneq ($(TARGET_USES_LOGD),false)
+liblog_target_sources += log_read.c
+else
+liblog_target_sources += log_read_kern.c
+endif
+
+LOCAL_SRC_FILES = $(liblog_target_sources)
+
+LOCAL_SRC_CPP_FILES =  log_time.cpp
+
+LOCAL_MODULE := liblog.so
+
+LOCAL_C_INCLUDES = -I../include
+LOCAL_C_INCLUDES += -I../include/log
+LOCAL_C_INCLUDES += -I../include/cutils
+LOCAL_C_INCLUDES += -I../include/utils
+#-I$(STAGEDIR)
+
+LOCAL_CFLAGS += -fPIC -g -O2   -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0 
+LOCAL_CFLAGS += -Werror
+# -nostartfiles
+
+LOCAL_CPPFLAGS += -fPIC -g -O2 -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0 
+LOCAL_CPPFLAGS += -std=c++11
+
+LOCAL_LDLIBS  +=
+#LOCAL_LDFLAGS += -shared
+LDFLAGS += -shared
+
+ALL_OBJS = $(subst .c,.o, $(LOCAL_SRC_FILES))
+
+ALL_CPP_OBJS = $(subst .cpp,.o, $(LOCAL_SRC_CPP_FILES))
+
+all : $(LOCAL_MODULE)
+	@echo "Compile $(LOCAL_MODULE) done!"
+
+clean :
+	@rm -rvf $(ALL_OBJS) $(LOCAL_MODULE)
+
+$(LOCAL_MODULE) : $(ALL_OBJS) $(ALL_CPP_OBJS)
+#	$(CXX) $(LOCAL_LDFLAGS) $(LOCAL_CPPFLAGS) -o $@ $^ $(LOCAL_LDLIBS)
+	$(CXX) $(LDFLAGS) $(LOCAL_CPPFLAGS) -o $@ $^ $(LOCAL_LDLIBS)
+	
+%.o:%.c
+	@echo Compile $< 
+	$(CC) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -c $< -o $@
+
+%.o:%.cpp
+	@echo Compile $< 
+	$(CXX) $(LOCAL_CPPFLAGS) $(LOCAL_C_INCLUDES) -c $< -o $@
+
+romfs:
+	$(ROMFSINST) $(LOCAL_MODULE) /lib/$(LOCAL_MODULE)
+	@echo $(LOCAL_MODULE) has been installed!
+
diff --git a/ap/lib/binder/liblog/liblog.so b/ap/lib/binder/liblog/liblog.so
new file mode 100755
index 0000000..be855c1
--- /dev/null
+++ b/ap/lib/binder/liblog/liblog.so
Binary files differ
diff --git a/ap/lib/binder/libutils/Makefile b/ap/lib/binder/libutils/Makefile
new file mode 100755
index 0000000..38466cb
--- /dev/null
+++ b/ap/lib/binder/libutils/Makefile
@@ -0,0 +1,69 @@
+include $(COMMON_MK)
+
+commonSources:= \
+	BasicHashtable.cpp \
+	BlobCache.cpp \
+	FileMap.cpp \
+	LinearAllocator.cpp \
+	LinearTransform.cpp \
+	Log.cpp \
+	NativeHandle.cpp \
+	RefBase.cpp \
+	SharedBuffer.cpp \
+	Static.cpp \
+	String8.cpp \
+	String16.cpp \
+	SystemClock.cpp \
+	Threads.cpp \
+	Timers.cpp \
+	Unicode.cpp \
+	VectorImpl.cpp \
+	misc.cpp
+
+
+LOCAL_SRC_FILES = $(commonSources)
+
+LOCAL_MODULE := libutils.so
+
+LOCAL_C_INCLUDES = -I../include
+LOCAL_C_INCLUDES += -I../include/log
+LOCAL_C_INCLUDES += -I../include/cutils
+LOCAL_C_INCLUDES += -I../include/utils
+#-I$(STAGEDIR)
+
+LOCAL_CFLAGS += -fPIC -g -O2   -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0 
+LOCAL_CFLAGS += -Werror
+
+LOCAL_CPPFLAGS += -fPIC -g -O2 -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0 
+LOCAL_CPPFLAGS += -std=c++11
+
+LOCAL_LDLIBS  += -lpthread
+LOCAL_LDLIBS  += -L../liblog    -llog
+LOCAL_LDLIBS  += -L../libcutils    -lcutils
+#LOCAL_LDFLAGS += -shared
+LDFLAGS += -shared
+
+ALL_OBJS = $(subst .cpp,.o, $(LOCAL_SRC_FILES))
+
+all : $(LOCAL_MODULE)
+	@echo "Compile $(LOCAL_MODULE) done!"
+
+clean :
+	@rm -rvf $(ALL_OBJS) $(LOCAL_MODULE)
+
+$(LOCAL_MODULE) : $(ALL_OBJS)
+#	$(CXX) $(LOCAL_LDFLAGS) $(LOCAL_CPPFLAGS) -o $@ $^ $(LOCAL_LDLIBS)
+	$(CXX) $(LDFLAGS) $(LOCAL_CPPFLAGS) -o $@ $^ $(LOCAL_LDLIBS)
+
+%.o:%.c
+	@echo Compile $< 
+	$(CC) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -c $< -o $@
+
+%.o:%.cpp
+	@echo Compile $< 
+	$(CXX) $(LOCAL_CPPFLAGS) $(LOCAL_C_INCLUDES) -c $< -o $@
+
+romfs:
+	$(ROMFSINST) $(LOCAL_MODULE) /lib/$(LOCAL_MODULE)
+	@echo $(LOCAL_MODULE) has been installed!
+
diff --git a/ap/lib/binder/libutils/libutils.so b/ap/lib/binder/libutils/libutils.so
new file mode 100755
index 0000000..e7dd9a1
--- /dev/null
+++ b/ap/lib/binder/libutils/libutils.so
Binary files differ