Use OpenJdk implementation of java.util.zip.*

- Move some of the internal implementation details of libcore's
  zipfile into StrictJarFile.
- TODO: Adler32 continues to use old native code from libcore, this
  must be switched over.
- InflaterInputStream: |closed| becomes protected.
- ZipFile : Always use mmap.
- ZipEntry : Add a long dataOffset.
- Switch all native code over to explicit registration.

Change-Id: Id5519b4548ea1eb22fd182edfbd2c804dc6f3bb5
diff --git a/NativeCode.mk b/NativeCode.mk
index 0ae615e..3ad4e1a 100644
--- a/NativeCode.mk
+++ b/NativeCode.mk
@@ -47,6 +47,13 @@
     LOCAL_SRC_FILES :=
 endef
 
+define include-openjdk-native-dir
+    LOCAL_SRC_FILES :=
+    include $(LOCAL_PATH)/$(1)/openjdksub.mk
+    openjdk_core_src_files += $$(addprefix $(1)/,$$(LOCAL_SRC_FILES))
+    LOCAL_SRC_FILES :=
+endef
+
 # Set up the default state. Note: We use CLEAR_VARS here, even though
 # we aren't quite defining a new rule yet, to make sure that the
 # sub.mk files don't see anything stray from the last rule that was
@@ -56,6 +63,13 @@
 LOCAL_MODULE := $(core_magic_local_target)
 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/NativeCode.mk
 core_src_files :=
+openjdk_core_src_files :=
+
+#Include the sub.m in openjdk.
+$(foreach dir, \
+    ojluni/src/main/native, \
+    $(eval $(call include-openjdk-native-dir,$(dir))))
+
 
 # Include the sub.mk files.
 $(foreach dir, \
@@ -90,6 +104,27 @@
 include external/stlport/libstlport.mk
 include $(BUILD_SHARED_LIBRARY)
 
+include $(CLEAR_VARS)
+
+LOCAL_CFLAGS += -Wall
+LOCAL_CFLAGS += $(core_cflags)
+LOCAL_CPPFLAGS += $(core_cppflags)
+ifeq ($(TARGET_ARCH),arm)
+# Ignore "note: the mangling of 'va_list' has changed in GCC 4.4"
+LOCAL_CFLAGS += -Wno-psabi
+endif
+
+# Define the rules.
+LOCAL_SRC_FILES := $(openjdk_core_src_files)
+LOCAL_C_INCLUDES := $(core_c_includes)
+LOCAL_SHARED_LIBRARIES := $(core_shared_libraries) libcrypto libssl libz
+LOCAL_SHARED_LIBRARIES += libart libnativehelper libdl
+LOCAL_STATIC_LIBRARIES := $(core_static_libraries) libfdlibm
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE := libopenjdkjavacore
+include external/stlport/libstlport.mk
+include $(BUILD_SHARED_LIBRARY)
+
 # Test JNI library.
 ifeq ($(LIBCORE_SKIP_TESTS),)