aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/jogamp/android/launcher/ActivityLauncher.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-01-31 21:15:32 +0100
committerSven Gothel <[email protected]>2013-01-31 21:15:32 +0100
commitb47d0d92dd222999bf38633de1cec8de6a7ad369 (patch)
tree764afc7741b6cb5cf3a11f5d4a8d3c117b3b5f0e /src/java/jogamp/android/launcher/ActivityLauncher.java
parentc8de8fbf5d080b674b509763fbb7374c21ee705b (diff)
Android: Cleanup ClassLoaderUtil/LauncherUtil - Using cached parent ClassLoader for SYS-Packages w/ native libs, and non cached child ClassLoader for USR-Packages
Android's Dalvik VM, like a JVM, cannot load a native library from one location by multiple ClassLoader. Since we don't like to hardcode the system-packages, as it was before, i.e. "com.jogamp.common", "javax.media.opengl", we need to either copy the libs or use parenting of cached ClassLoader. The latter is chosen, since it's faster and uses less resources. - System-packages are passed through from the user 'List<String> LauncherUtil.BaseActivityLauncher::getSysPackages()' to the ActivityLauncher, which instantiates the ClassLoader. - No more hard-reference the system-packages in ClassLoaderUtil ("com.jogamp.common", "javax.media.opengl"), just use the new user provided system-packages. - The system-packages denominate a hash-key for caching, a new ClassLoader is created and mapped if it does not yet exist. - A non-chached user-packages ClassLoader is created using the cached system-packages ClassLoader as it's parent.
Diffstat (limited to 'src/java/jogamp/android/launcher/ActivityLauncher.java')
-rw-r--r--src/java/jogamp/android/launcher/ActivityLauncher.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/java/jogamp/android/launcher/ActivityLauncher.java b/src/java/jogamp/android/launcher/ActivityLauncher.java
index 0ac940e..6e2f261 100644
--- a/src/java/jogamp/android/launcher/ActivityLauncher.java
+++ b/src/java/jogamp/android/launcher/ActivityLauncher.java
@@ -55,7 +55,7 @@ public class ActivityLauncher extends Activity {
data = LauncherUtil.DataSet.create(uri);
data.setSystemProperties();
- ClassLoader cl = ClassLoaderUtil.createClassLoader(this, data.getPackages(), false, null);
+ ClassLoader cl = ClassLoaderUtil.createClassLoader(this, data.getSysPackages(), data.getUsrPackages(), null);
if(null != cl) {
try {
activityClazz = Class.forName(data.getActivityName(), true, cl);
@@ -135,8 +135,18 @@ public class ActivityLauncher extends Activity {
Log.d(TAG, "onDestroy - S");
callMethod(activityObject, mOnDestroy);
if(null != data) {
+ activityObject=null;
+ mOnCreate=null;
+ mOnDestroy=null;
+ mOnPause=null;
+ mOnRestart=null;
+ mOnResume=null;
+ mOnStart=null;
+ mOnStop=null;
+ mSetRootActivity=null;
+ activityClazz = null;
data.clearSystemProperties();
- data = null;
+ data = null;
}
super.onDestroy();
Log.d(TAG, "onDestroy - X");