From 9774612b57f08afa9f178ba1d89d9b95dd32d85e Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Thu, 31 Oct 2013 14:56:54 -0700 Subject: Set persist.sys.dalvik.vm.lib at system server startup Bug: 11463182 Change-Id: I4409e84570c4e27bf8da36d0aca87812a1c032a6 --- core/java/com/android/internal/os/RuntimeInit.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java index 5538dca2a4fa..69b593a6fb56 100644 --- a/core/java/com/android/internal/os/RuntimeInit.java +++ b/core/java/com/android/internal/os/RuntimeInit.java @@ -103,6 +103,18 @@ public class RuntimeInit { /* set default handler; this applies to all threads in the VM */ Thread.setDefaultUncaughtExceptionHandler(new UncaughtHandler()); + /* + * In case the runtime switched since last boot (such as when + * the old runtime was removed in an OTA), set the system + * property so that it is in sync. We can't do this in + * libnativehelper's JniInvocation::Init code where we already + * had to fallback to a different runtime because it is + * running as root and we need to be the system user to set + * the property. http://b/11463182 + */ + SystemProperties.set("persist.sys.dalvik.vm.lib", + VMRuntime.getRuntime().vmLibrary()); + /* * Install a TimezoneGetter subclass for ZoneInfo.db */ -- cgit v1.2.3 From 5bcd758d6ba6a46bd35a04518f4ba0c3c7bb2242 Mon Sep 17 00:00:00 2001 From: Brian Carlstrom Date: Fri, 1 Nov 2013 14:51:58 -0700 Subject: Move set of persist.sys.dalvik.vm.lib to SystemServer only Bug: 11463182 Bug: 11479647 Change-Id: I38efdecdd65fe3efc9c33b4dc204a64543ae6377 --- core/java/com/android/internal/os/RuntimeInit.java | 12 ------------ services/java/com/android/server/SystemServer.java | 13 +++++++++++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java index 69b593a6fb56..5538dca2a4fa 100644 --- a/core/java/com/android/internal/os/RuntimeInit.java +++ b/core/java/com/android/internal/os/RuntimeInit.java @@ -103,18 +103,6 @@ public class RuntimeInit { /* set default handler; this applies to all threads in the VM */ Thread.setDefaultUncaughtExceptionHandler(new UncaughtHandler()); - /* - * In case the runtime switched since last boot (such as when - * the old runtime was removed in an OTA), set the system - * property so that it is in sync. We can't do this in - * libnativehelper's JniInvocation::Init code where we already - * had to fallback to a different runtime because it is - * running as root and we need to be the system user to set - * the property. http://b/11463182 - */ - SystemProperties.set("persist.sys.dalvik.vm.lib", - VMRuntime.getRuntime().vmLibrary()); - /* * Install a TimezoneGetter subclass for ZoneInfo.db */ diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 0e0f15625823..bb1425952c1c 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -1104,6 +1104,19 @@ public class SystemServer { private static native void nativeInit(); public static void main(String[] args) { + + /* + * In case the runtime switched since last boot (such as when + * the old runtime was removed in an OTA), set the system + * property so that it is in sync. We can't do this in + * libnativehelper's JniInvocation::Init code where we already + * had to fallback to a different runtime because it is + * running as root and we need to be the system user to set + * the property. http://b/11463182 + */ + SystemProperties.set("persist.sys.dalvik.vm.lib", + VMRuntime.getRuntime().vmLibrary()); + if (System.currentTimeMillis() < EARLIEST_SUPPORTED_TIME) { // If a device's clock is before 1970 (before 0), a lot of // APIs crash dealing with negative numbers, notably -- cgit v1.2.3