Merge "Revert "Split AndroidRuntime into AndroidRuntimeBase base-class and the rest.""
diff --git a/cmds/app_process/Android.mk b/cmds/app_process/Android.mk
index 4eef129..b9afe40 100644
--- a/cmds/app_process/Android.mk
+++ b/cmds/app_process/Android.mk
@@ -9,7 +9,7 @@
 	libutils \
 	liblog \
 	libbinder \
-	libandroid_runtime_derived
+	libandroid_runtime
 
 LOCAL_MODULE:= app_process
 
@@ -30,7 +30,7 @@
 	libutils \
 	liblog \
 	libbinder \
-	libandroid_runtime_derived
+	libandroid_runtime
 
 LOCAL_MODULE := app_process__asan
 LOCAL_MODULE_TAGS := eng
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index 8e3d3b8..d8041c5 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -1,25 +1,6 @@
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
-LOCAL_SRC_FILES:= \
-	AndroidRuntimeBase.cpp \
-	android_os_Parcel.cpp \
-	android_util_Binder.cpp
-
-LOCAL_SHARED_LIBRARIES:= \
-	libbinder \
-	libcutils \
-	libnativehelper \
-	libutils \
-
-LOCAL_MODULE := libandroid_runtime
-
-include $(BUILD_SHARED_LIBRARY)
-
-################################################################################
-
-include $(CLEAR_VARS)
-
 LOCAL_CFLAGS += -DHAVE_CONFIG_H -DKHTML_NO_EXCEPTIONS -DGKWQ_NO_JAVA
 LOCAL_CFLAGS += -DNO_SUPPORT_JS_BINDING -DQT_NO_WHEELEVENT -DKHTML_NO_XBL
 LOCAL_CFLAGS += -U__APPLE__
@@ -86,6 +67,7 @@
 	android_os_Debug.cpp \
 	android_os_MemoryFile.cpp \
 	android_os_MessageQueue.cpp \
+	android_os_Parcel.cpp \
 	android_os_SELinux.cpp \
 	android_os_SystemClock.cpp \
 	android_os_SystemProperties.cpp \
@@ -97,6 +79,7 @@
 	android_nio_utils.cpp \
 	android_text_format_Time.cpp \
 	android_util_AssetManager.cpp \
+	android_util_Binder.cpp \
 	android_util_EventLog.cpp \
 	android_util_Log.cpp \
 	android_util_FloatMath.cpp \
@@ -200,7 +183,6 @@
 
 LOCAL_SHARED_LIBRARIES := \
 	libmemtrack \
-	libandroid_runtime \
 	libandroidfw \
 	libexpat \
 	libnativehelper \
@@ -261,7 +243,7 @@
 	LOCAL_CFLAGS += -DMALLOC_LEAK_CHECK
 endif
 
-LOCAL_MODULE:= libandroid_runtime_derived
+LOCAL_MODULE:= libandroid_runtime
 
 include external/stlport/libstlport.mk
 include $(BUILD_SHARED_LIBRARY)
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 7dbdfc1..77c5c18 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -227,6 +227,9 @@
 
 // ----------------------------------------------------------------------
 
+/*static*/ JavaVM* AndroidRuntime::mJavaVM = NULL;
+
+
 AndroidRuntime::AndroidRuntime() :
         mExitWithoutCleanup(false)
 {
@@ -254,6 +257,15 @@
     SkGraphics::Term();
 }
 
+/*
+ * Register native methods using JNI.
+ */
+/*static*/ int AndroidRuntime::registerNativeMethods(JNIEnv* env,
+    const char* className, const JNINativeMethod* gMethods, int numMethods)
+{
+    return jniRegisterNativeMethods(env, className, gMethods, numMethods);
+}
+
 status_t AndroidRuntime::callMain(const char* className,
     jclass clazz, int argc, const char* const argv[])
 {
@@ -916,6 +928,22 @@
 }
 
 /*
+ * Get the JNIEnv pointer for this thread.
+ *
+ * Returns NULL if the slot wasn't allocated or populated.
+ */
+/*static*/ JNIEnv* AndroidRuntime::getJNIEnv()
+{
+    JNIEnv* env;
+    JavaVM* vm = AndroidRuntime::getJavaVM();
+    assert(vm != NULL);
+
+    if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK)
+        return NULL;
+    return env;
+}
+
+/*
  * Makes the current thread visible to the VM.
  *
  * The JNIEnv pointer returned is only valid for the current thread, and
diff --git a/core/jni/AndroidRuntimeBase.cpp b/core/jni/AndroidRuntimeBase.cpp
deleted file mode 100644
index 38afc49c..0000000
--- a/core/jni/AndroidRuntimeBase.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "AndroidRuntimeBase"
-//#define LOG_NDEBUG 0
-#include <utils/Log.h>
-
-#include <android_runtime/AndroidRuntime.h>
-
-#include "jni.h"
-#include "JNIHelp.h"
-
-namespace android {
-
-/*static*/ JavaVM* AndroidRuntimeBase::mJavaVM = NULL;
-
-/*
- * Get the JNIEnv pointer for this thread.
- *
- * Returns NULL if the slot wasn't allocated or populated.
- */
-/*static*/ JNIEnv* AndroidRuntimeBase::getJNIEnv()
-{
-    JNIEnv* env;
-    JavaVM* vm = AndroidRuntimeBase::getJavaVM();
-    assert(vm != NULL);
-
-    if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK)
-        return NULL;
-    return env;
-}
-
-/*
- * Register native methods using JNI.
- */
-/*static*/ int AndroidRuntimeBase::registerNativeMethods(JNIEnv* env,
-    const char* className, const JNINativeMethod* gMethods, int numMethods)
-{
-    return jniRegisterNativeMethods(env, className, gMethods, numMethods);
-}
-
-}  // namespace android
-
diff --git a/include/android_runtime/AndroidRuntime.h b/include/android_runtime/AndroidRuntime.h
index efd92bb..0b3ce9a 100644
--- a/include/android_runtime/AndroidRuntime.h
+++ b/include/android_runtime/AndroidRuntime.h
@@ -19,8 +19,6 @@
 #ifndef _RUNTIME_ANDROID_RUNTIME_H
 #define _RUNTIME_ANDROID_RUNTIME_H
 
-#include "AndroidRuntimeBase.h"
-
 #include <utils/Errors.h>
 #include <binder/IBinder.h>
 #include <utils/String8.h>
@@ -33,7 +31,7 @@
 
 namespace android {
 
-class AndroidRuntime : public AndroidRuntimeBase
+class AndroidRuntime
 {
 public:
     AndroidRuntime();
@@ -47,6 +45,12 @@
     };
 
     /**
+     * Register a set of methods in the specified class.
+     */
+    static int registerNativeMethods(JNIEnv* env,
+        const char* className, const JNINativeMethod* gMethods, int numMethods);
+
+    /**
      * Call a class's static main method with the given arguments,
      */
     status_t callMain(const char* className, jclass clazz, int argc,
@@ -100,6 +104,12 @@
     static android_thread_id_t createJavaThread(const char* name, void (*start)(void *),
         void* arg);
 
+    /** return a pointer to the VM running in this process */
+    static JavaVM* getJavaVM() { return mJavaVM; }
+
+    /** return a pointer to the JNIEnv pointer for this thread */
+    static JNIEnv* getJNIEnv();
+
     /** return a new string corresponding to 'className' with all '.'s replaced by '/'s. */
     static char* toSlashClassName(const char* className);
 
@@ -111,6 +121,9 @@
     Vector<JavaVMOption> mOptions;
     bool mExitWithoutCleanup;
 
+    /* JNI JavaVM pointer */
+    static JavaVM* mJavaVM;
+
     /*
      * Thread creation helpers.
      */
diff --git a/include/android_runtime/AndroidRuntimeBase.h b/include/android_runtime/AndroidRuntimeBase.h
deleted file mode 100644
index 2b14987..0000000
--- a/include/android_runtime/AndroidRuntimeBase.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _RUNTIME_ANDROID_RUNTIME_BASE_H
-#define _RUNTIME_ANDROID_RUNTIME_BASE_H
-
-#include <nativehelper/jni.h>
-
-namespace android {
-
-struct AndroidRuntimeBase {
-    /** return a pointer to the VM running in this process */
-    static JavaVM* getJavaVM() { return mJavaVM; }
-
-    /** return a pointer to the JNIEnv pointer for this thread */
-    static JNIEnv* getJNIEnv();
-
-    /**
-     * Register a set of methods in the specified class.
-     */
-    static int registerNativeMethods(JNIEnv* env,
-        const char* className, const JNINativeMethod* gMethods, int numMethods);
-
-protected:
-    /* JNI JavaVM pointer */
-    static JavaVM* mJavaVM;
-
-    AndroidRuntimeBase() {}
-    virtual ~AndroidRuntimeBase() {}
-
-    AndroidRuntimeBase(const AndroidRuntimeBase &);
-    AndroidRuntimeBase &operator=(const AndroidRuntimeBase &);
-};
-
-}  // namespace android
-
-#endif // _RUNTIME_ANDROID_RUNTIME_BASE_H
diff --git a/media/jni/Android.mk b/media/jni/Android.mk
index 8323ae3..51fccd4 100644
--- a/media/jni/Android.mk
+++ b/media/jni/Android.mk
@@ -24,7 +24,6 @@
 
 LOCAL_SHARED_LIBRARIES := \
     libandroid_runtime \
-    libandroid_runtime_derived \
     libnativehelper \
     libutils \
     libbinder \
diff --git a/media/jni/mediaeditor/Android.mk b/media/jni/mediaeditor/Android.mk
index b9c70f8..6be7fdd 100644
--- a/media/jni/mediaeditor/Android.mk
+++ b/media/jni/mediaeditor/Android.mk
@@ -48,7 +48,6 @@
 
 LOCAL_SHARED_LIBRARIES := \
     libandroid_runtime \
-    libandroid_runtime_derived \
     libaudioflinger \
     libaudioutils \
     libbinder \
diff --git a/native/android/Android.mk b/native/android/Android.mk
index f55f94a..cda38e0 100644
--- a/native/android/Android.mk
+++ b/native/android/Android.mk
@@ -25,8 +25,7 @@
     libbinder \
     libui \
     libgui \
-    libandroid_runtime \
-    libandroid_runtime_derived
+    libandroid_runtime
 
 LOCAL_STATIC_LIBRARIES := \
     libstorage
diff --git a/native/graphics/jni/Android.mk b/native/graphics/jni/Android.mk
index 02fa1b9..8b333e7 100644
--- a/native/graphics/jni/Android.mk
+++ b/native/graphics/jni/Android.mk
@@ -20,7 +20,6 @@
 
 LOCAL_SHARED_LIBRARIES := \
     libandroid_runtime \
-    libandroid_runtime_derived \
     libskia
 
 LOCAL_C_INCLUDES += \
diff --git a/rs/jni/Android.mk b/rs/jni/Android.mk
index 4814a6e..cbb5b3b 100644
--- a/rs/jni/Android.mk
+++ b/rs/jni/Android.mk
@@ -6,7 +6,6 @@
 
 LOCAL_SHARED_LIBRARIES := \
         libandroid_runtime \
-        libandroid_runtime_derived \
         libandroidfw \
         libnativehelper \
         libRS \
diff --git a/services/core/jni/Android.mk b/services/core/jni/Android.mk
index 98d7e38..85f69a4 100644
--- a/services/core/jni/Android.mk
+++ b/services/core/jni/Android.mk
@@ -37,7 +37,6 @@
 
 LOCAL_SHARED_LIBRARIES += \
     libandroid_runtime \
-    libandroid_runtime_derived \
     libandroidfw \
     libbinder \
     libcutils \