summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.classpath1
-rw-r--r--make/build-common.xml2
-rw-r--r--make/build-test.xml7
-rw-r--r--make/build.xml34
-rw-r--r--make/resources/android/AndroidManifest-launcher.xml130
-rw-r--r--make/resources/android/AndroidManifest-test.xml83
-rw-r--r--make/resources/android/res-jogl/values/colors.xml (renamed from make/resources/android/res-launcher/values/colors.xml)0
-rw-r--r--make/resources/android/res-jogl/values/styles.xml (renamed from make/resources/android/res-launcher/values/styles.xml)0
-rw-r--r--make/resources/android/res-test/drawable-hdpi/icon.png (renamed from make/resources/android/res-launcher/drawable-hdpi/icon.png)bin2516 -> 2516 bytes
-rw-r--r--make/resources/android/res-test/drawable-ldpi/icon.png (renamed from make/resources/android/res-launcher/drawable-ldpi/icon.png)bin1172 -> 1172 bytes
-rw-r--r--make/resources/android/res-test/drawable-mdpi/icon.png (renamed from make/resources/android/res-launcher/drawable-mdpi/icon.png)bin1570 -> 1570 bytes
-rw-r--r--make/resources/android/res-test/layout/main.xml (renamed from make/resources/android/res-launcher/layout/main.xml)0
-rw-r--r--make/resources/android/res-test/values/strings.xml (renamed from make/resources/android/res-launcher/values/strings.xml)6
-rwxr-xr-xmake/scripts/adb-install-all-armv7.sh2
-rw-r--r--make/scripts/adb-launch-activity.sh11
-rw-r--r--make/scripts/adb-launch-main.sh69
-rwxr-xr-xmake/scripts/adb-uninstall-all.sh2
-rw-r--r--make/scripts/crosstest-java-android-armv7-rel.sh69
-rw-r--r--make/scripts/crosstest-launch-android-activity.sh17
-rwxr-xr-xmake/scripts/tests.sh4
-rw-r--r--src/android/com/jogamp/android/launcher/ClassLoaderUtil.java121
-rw-r--r--src/android/com/jogamp/android/launcher/LauncherTempFileCache.java477
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java252
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherElektronActivity.java15
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherGearsES1Activity.java15
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherGearsES2Activity.java15
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherGearsES2TransActivity.java15
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherGraphUI1pActivity.java15
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherGraphUI2pActivity.java15
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES1Activity.java15
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES2Activity.java15
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java132
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java8
-rw-r--r--src/test/com/jogamp/opengl/test/android/LauncherUtil.java320
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTElektronActivityLauncher.java45
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES1ActivityLauncher.java44
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java72
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivityLauncher.java49
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivityLauncher.java44
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivityLauncher.java44
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1ActivityLauncher.java44
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java21
42 files changed, 968 insertions, 1262 deletions
diff --git a/.classpath b/.classpath
index 3a9a4693f..bb012ba81 100644
--- a/.classpath
+++ b/.classpath
@@ -26,7 +26,6 @@
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="jogl/build/newt/obj"/>
</attributes>
</classpathentry>
- <classpathentry kind="src" path="src/android"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry combineaccessrules="false" kind="src" path="/gluegen"/>
diff --git a/make/build-common.xml b/make/build-common.xml
index e560cd8b9..c18cf89b4 100644
--- a/make/build-common.xml
+++ b/make/build-common.xml
@@ -466,7 +466,7 @@
<property name="junit_jogl_noawt.run.jars"
value="${junit.jar}${path.separator}${ant.jar}${path.separator}${ant-junit.jar}${path.separator}${gluegen-rt.jar}${path.separator}${jogl.all-noawt.jar}${path.separator}${jogl.test.jar}"/>
<property name="junit_jogl_noawt.run.remote.jars" value="${junit.jar}${path.separator}${env.TARGET_ANT_HOME}/lib/ant.jar${path.separator}${env.TARGET_ANT_HOME}/lib/ant-junit.jar${path.separator}${gluegen-rt.jar}${path.separator}${jogl.all-noawt.jar}${path.separator}${jogl.test.jar}"/>
- <property name="junit.run.remote.apks" value="${ant-junit-all.apk}${path.separator}${gluegen.root}/${rootrel.build}/gluegen-rt.apk${path.separator}${jogl.all-android.apk}${path.separator}${jogl.test.apk}"/>
+ <property name="junit.run.remote.apks" value="${gluegen.root}/${rootrel.build}/jogamp.android-launcher.apk${path.separator}${ant-junit-all.apk}${path.separator}${gluegen.root}/${rootrel.build}/gluegen-rt.apk${path.separator}${jogl.all-android.apk}${path.separator}${jogl.test.apk}"/>
<!-- Test Run w/ SWT .. -->
<path id="junit_jogl_swt.run.classpath">
diff --git a/make/build-test.xml b/make/build-test.xml
index 8a3bb3d24..3e33c2ff8 100644
--- a/make/build-test.xml
+++ b/make/build-test.xml
@@ -65,7 +65,7 @@
nativebasename="non-existing"
android.abi="${android.abi}"
androidmanifest.path="resources/android/AndroidManifest-test.xml"
- androidresources.path="resources/android/res-jogl"
+ androidresources.path="resources/android/res-test"
jarmanifest.path="${build.jogl}/manifest.mf"
version.code="${jogl_int_version}"
version.name="${jogl.version.plus}" />
@@ -110,7 +110,8 @@
<uptodate property="test.compile.skip">
<srcfiles dir= "." includes="*.xml"/>
<srcfiles dir= "${src.test}" includes="**"/>
- <srcfiles file="${gluegen.jar}" />
+ <srcfiles dir= "resources/android" includes="**/*.xml"/>
+ <srcfiles file="${gluegen-rt.jar}" />
<srcfiles dir="${src}/nativewindow" />
<srcfiles dir="${src}/jogl" />
<srcfiles dir="${src}/newt" />
@@ -850,7 +851,7 @@ ${line.separator}
chmod 0755 ${build.test}/targetcommand.sh ;
adb connect ${env.TARGET_IP}:${env.TARGET_ADB_PORT} ;
adb -s ${env.TARGET_IP}:${env.TARGET_ADB_PORT} push ${build.test}/targetcommand.sh ${env.TARGET_ROOT}/jogl-targetcommand.sh ;
- adb -s ${env.TARGET_IP}:${env.TARGET_ADB_PORT} shell ${env.TARGET_ROOT}/jogl-targetcommand.sh ;
+ adb -s ${env.TARGET_IP}:${env.TARGET_ADB_PORT} shell su -c ${env.TARGET_ROOT}/jogl-targetcommand.sh ;
adb -s ${env.TARGET_IP}:${env.TARGET_ADB_PORT} pull ${env.TARGET_ROOT}/${jogl.basename}/${env.NODE_LABEL}/make/${results.test}/ ${results.test}/ "'/>
</exec>
</target>
diff --git a/make/build.xml b/make/build.xml
index 5a17812e0..203132816 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -168,38 +168,6 @@
version.name="${jogl.version.plus}" />
</target>
- <target name="android.launcher.package" depends="init,gluegen.cpptasks.detect.os" if="isAndroid">
- <mkdir dir="${build}/android/classes" />
- <mkdir dir="${build}/android/lib" />
- <javac destdir="${build}/android/classes"
- includes="com/jogamp/android/launcher/**"
- fork="yes"
- includeAntRuntime="false"
- memoryMaximumSize="${javac.memorymax}"
- encoding="UTF-8"
- source="${target.sourcelevel}"
- target="${target.targetlevel}"
- bootclasspath="${target.rt.jar}"
- debug="${javacdebug}" debuglevel="${javacdebuglevel}">
- <src path="${project.root}/src/android" />
- <classpath location="${android.jar}"/>
- </javac>
- <jar destfile="${jar}/jogl.android-launcher.jar" filesonly="true">
- <fileset dir="${build}/android/classes"
- includes="com/jogamp/android/launcher/**"/>
- </jar>
- <aapt.signed
- jarbuilddir="${jar}"
- jarbasename="jogl.android-launcher"
- nativebuilddir="${build}/android/lib"
- nativebasename="non-existing"
- android.abi="${android.abi}"
- androidmanifest.path="resources/android/AndroidManifest-launcher.xml"
- androidresources.path="resources/android/res-launcher"
- version.code="1"
- version.name="version 1" />
- </target>
-
<target name="one.dir.skip.check" depends="init,gluegen.cpptasks.detect.os">
<uptodate property="one.dir.skip.native" targetfile="${jar}/jogl-all-natives-${os.and.arch}.jar">
<srcfiles dir="${lib}" includes="*.${native.library.suffix}" />
@@ -223,7 +191,7 @@
</condition>
</target>
- <target name="one.dir" depends="one.dir.skip.check, one.jar.dir, android.jogl.package, android.launcher.package"/>
+ <target name="one.dir" depends="one.dir.skip.check, one.jar.dir, android.jogl.package"/>
<target name="repack-jars" depends="one.jar.dir">
<!-- Re-pack jars we have the intent to compress later, after signing -->
diff --git a/make/resources/android/AndroidManifest-launcher.xml b/make/resources/android/AndroidManifest-launcher.xml
deleted file mode 100644
index dda42b4fd..000000000
--- a/make/resources/android/AndroidManifest-launcher.xml
+++ /dev/null
@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- sharedUserId="com.jogamp.Community"
- package="com.jogamp.android.launcher">
-
- <uses-permission android:name="android.permission.INTERNET" /> <!-- required for NV's perfhud -->
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- required for Android trace -->
-
- <uses-sdk android:minSdkVersion="9" />
- <uses-library android:name="com.jogamp.common" android:required="true" />
- <uses-library android:name="javax.media.opengl" android:required="true" />
- <uses-library android:name="com.jogamp.opengl.test" android:required="true" />
-
- <application android:icon="@drawable/icon"
- android:label="@string/app_name"
- android:description="@string/app_descr"
- android:persistent="false"
- >
-
- <!-- We use activities with ES1 and ES2,
- also setting the feature tag didn't fix the tegra issue.
- Leave it here for documentation, maybe later use.
- <uses-feature android:glEsVersion="0x00020000" />
- -->
- <activity android:name="com.jogamp.android.launcher.NEWTLauncherRedSquareES1Activity"
- android:finishOnTaskLaunch="true"
- android:launchMode="standard"
- android:configChanges="keyboardHidden|orientation"
- android:label="@string/activity_redsquarees1_name"
- android:description="@string/activity_redsquarees1_descr"
- >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name="com.jogamp.android.launcher.NEWTLauncherRedSquareES2Activity"
- android:finishOnTaskLaunch="true"
- android:launchMode="standard"
- android:configChanges="keyboardHidden|orientation"
- android:label="@string/activity_redsquarees2_name"
- android:description="@string/activity_redsquarees2_descr"
- >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name="com.jogamp.android.launcher.NEWTLauncherGearsES1Activity"
- android:finishOnTaskLaunch="true"
- android:launchMode="standard"
- android:configChanges="keyboardHidden|orientation"
- android:label="@string/activity_gearses1_name"
- android:description="@string/activity_gearses1_descr"
- android:exported="true"
- >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name="com.jogamp.android.launcher.NEWTLauncherGearsES2Activity"
- android:finishOnTaskLaunch="true"
- android:launchMode="standard"
- android:configChanges="keyboardHidden|orientation"
- android:label="@string/activity_gearses2_name"
- android:description="@string/activity_gearses2_descr"
- android:exported="true"
- >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name="com.jogamp.android.launcher.NEWTLauncherGearsES2TransActivity"
- android:finishOnTaskLaunch="true"
- android:launchMode="standard"
- android:configChanges="keyboardHidden|orientation"
- android:label="@string/activity_gearses2t_name"
- android:description="@string/activity_gearses2t_descr"
- android:exported="true"
- android:theme="@style/Theme.Transparent"
- >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name="com.jogamp.android.launcher.NEWTLauncherGraphUI1pActivity"
- android:finishOnTaskLaunch="true"
- android:launchMode="standard"
- android:configChanges="keyboardHidden|orientation"
- android:label="@string/activity_graphui1p_name"
- android:description="@string/activity_graphui1p_descr"
- android:exported="true"
- >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name="com.jogamp.android.launcher.NEWTLauncherGraphUI2pActivity"
- android:finishOnTaskLaunch="true"
- android:launchMode="standard"
- android:configChanges="keyboardHidden|orientation"
- android:label="@string/activity_graphui2p_name"
- android:description="@string/activity_graphui2p_descr"
- android:exported="true"
- >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <activity android:name="com.jogamp.android.launcher.NEWTLauncherElektronActivity"
- android:finishOnTaskLaunch="true"
- android:launchMode="standard"
- android:configChanges="keyboardHidden|orientation"
- android:label="@string/activity_elektro_name"
- android:description="@string/activity_elektro_descr"
- android:exported="true"
- >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
diff --git a/make/resources/android/AndroidManifest-test.xml b/make/resources/android/AndroidManifest-test.xml
index 80539cf26..ca3089098 100644
--- a/make/resources/android/AndroidManifest-test.xml
+++ b/make/resources/android/AndroidManifest-test.xml
@@ -12,6 +12,89 @@
android:description="@string/app_descr"
android:persistent="false"
>
+
+ <activity android:name="com.jogamp.opengl.test.android.NEWTRedSquareES1ActivityLauncher"
+ android:label="@string/activity_redsquarees1_name"
+ android:description="@string/activity_redsquarees1_descr"
+ android:theme="@android:style/Theme.NoDisplay"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="com.jogamp.opengl.test.android.NEWTRedSquareES2ActivityLauncher"
+ android:label="@string/activity_redsquarees2_name"
+ android:description="@string/activity_redsquarees2_descr"
+ android:theme="@android:style/Theme.NoDisplay"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name="com.jogamp.opengl.test.android.NEWTGearsES1ActivityLauncher"
+ android:label="@string/activity_gearses1_name"
+ android:description="@string/activity_gearses1_descr"
+ android:theme="@android:style/Theme.NoDisplay"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="com.jogamp.opengl.test.android.NEWTGearsES2ActivityLauncher"
+ android:label="@string/activity_gearses2_name"
+ android:description="@string/activity_gearses2_descr"
+ android:theme="@android:style/Theme.NoDisplay"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name="com.jogamp.opengl.test.android.NEWTGearsES2TransActivityLauncher"
+ android:label="@string/activity_gearses2t_name"
+ android:description="@string/activity_gearses2t_descr"
+ android:theme="@android:style/Theme.NoDisplay"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="com.jogamp.opengl.test.android.NEWTGraphUI1pActivityLauncher"
+ android:label="@string/activity_graphui1p_name"
+ android:description="@string/activity_graphui1p_descr"
+ android:theme="@android:style/Theme.NoDisplay"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="com.jogamp.opengl.test.android.NEWTGraphUI2pActivityLauncher"
+ android:label="@string/activity_graphui2p_name"
+ android:description="@string/activity_graphui2p_descr"
+ android:theme="@android:style/Theme.NoDisplay"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="com.jogamp.opengl.test.android.NEWTElektronActivityLauncher"
+ android:label="@string/activity_elektro_name"
+ android:description="@string/activity_elektro_descr"
+ android:theme="@android:style/Theme.NoDisplay"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
</application>
</manifest>
diff --git a/make/resources/android/res-launcher/values/colors.xml b/make/resources/android/res-jogl/values/colors.xml
index f4d188b25..f4d188b25 100644
--- a/make/resources/android/res-launcher/values/colors.xml
+++ b/make/resources/android/res-jogl/values/colors.xml
diff --git a/make/resources/android/res-launcher/values/styles.xml b/make/resources/android/res-jogl/values/styles.xml
index 5b7eb7e2e..5b7eb7e2e 100644
--- a/make/resources/android/res-launcher/values/styles.xml
+++ b/make/resources/android/res-jogl/values/styles.xml
diff --git a/make/resources/android/res-launcher/drawable-hdpi/icon.png b/make/resources/android/res-test/drawable-hdpi/icon.png
index 2148232c9..2148232c9 100644
--- a/make/resources/android/res-launcher/drawable-hdpi/icon.png
+++ b/make/resources/android/res-test/drawable-hdpi/icon.png
Binary files differ
diff --git a/make/resources/android/res-launcher/drawable-ldpi/icon.png b/make/resources/android/res-test/drawable-ldpi/icon.png
index c16211f36..c16211f36 100644
--- a/make/resources/android/res-launcher/drawable-ldpi/icon.png
+++ b/make/resources/android/res-test/drawable-ldpi/icon.png
Binary files differ
diff --git a/make/resources/android/res-launcher/drawable-mdpi/icon.png b/make/resources/android/res-test/drawable-mdpi/icon.png
index 1c26e3f83..1c26e3f83 100644
--- a/make/resources/android/res-launcher/drawable-mdpi/icon.png
+++ b/make/resources/android/res-test/drawable-mdpi/icon.png
Binary files differ
diff --git a/make/resources/android/res-launcher/layout/main.xml b/make/resources/android/res-test/layout/main.xml
index 3a5f117d3..3a5f117d3 100644
--- a/make/resources/android/res-launcher/layout/main.xml
+++ b/make/resources/android/res-test/layout/main.xml
diff --git a/make/resources/android/res-launcher/values/strings.xml b/make/resources/android/res-test/values/strings.xml
index 8b6928d9c..d66f6e4d7 100644
--- a/make/resources/android/res-launcher/values/strings.xml
+++ b/make/resources/android/res-test/values/strings.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="hello">Jogl Launcher</string>
- <string name="app_name">JogAmp\'s Jogl Launcher</string>
- <string name="app_descr">Launches Jogl Applications.</string>
+ <string name="hello">Jogl Tests</string>
+ <string name="app_name">Jogl Tests</string>
+ <string name="app_descr">Launches Jogl Tests.</string>
<string name="activity_redsquarees1_name">RedSqrES1</string>
<string name="activity_redsquarees1_descr">RedSquareES1</string>
<string name="activity_redsquarees2_name">RedSqrES2</string>
diff --git a/make/scripts/adb-install-all-armv7.sh b/make/scripts/adb-install-all-armv7.sh
index d48d0abba..503c6f2f7 100755
--- a/make/scripts/adb-install-all-armv7.sh
+++ b/make/scripts/adb-install-all-armv7.sh
@@ -1,4 +1,4 @@
+adb $* install ../../gluegen/build-android-armv7/jogamp.android-launcher.apk
adb $* install ../../gluegen/build-android-armv7/gluegen-rt.apk
adb $* install ../build-android-armv7/jar/jogl.all-android.apk
-adb $* install ../build-android-armv7/jar/jogl.android-launcher.apk
adb $* install ../build-android-armv7/jar/jogl.test.apk
diff --git a/make/scripts/adb-launch-activity.sh b/make/scripts/adb-launch-activity.sh
new file mode 100644
index 000000000..84399520e
--- /dev/null
+++ b/make/scripts/adb-launch-activity.sh
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+#ANAME="com.jogamp.opengl.test/com.jogamp.opengl.test.android.NEWTGenericActivity"
+#ANAME="com.jogamp.android.launcher/com.jogamp.android.launcher.NEWTLauncherActivity2"
+ANAME="com.jogamp.opengl.test/com.jogamp.opengl.test.android.NEWTGearsES2ActivityLauncher"
+
+adb $* shell "setprop log.redirect-stdio true ; setprop log.redirect-stderr true ; \
+ am start -a android.intent.action.MAIN -n $ANAME"
+
+
+
diff --git a/make/scripts/adb-launch-main.sh b/make/scripts/adb-launch-main.sh
new file mode 100644
index 000000000..7e32165d2
--- /dev/null
+++ b/make/scripts/adb-launch-main.sh
@@ -0,0 +1,69 @@
+#! /bin/bash
+
+export HOST_UID=jogamp
+# jogamp02 - 10.1.0.122
+export HOST_IP=10.1.0.122
+export HOST_RSYNC_ROOT=PROJECTS/JOGL
+
+export TARGET_UID=jogamp
+export TARGET_IP=panda02
+export TARGET_ADB_PORT=5555
+export TARGET_ROOT=/data/projects
+
+export BUILD_DIR=../build-android-armv7
+
+if [ -e /opt-linux-x86/android-sdk-linux_x86 ] ; then
+ export ANDROID_SDK_HOME=/opt-linux-x86/android-sdk-linux_x86
+ export PATH=$ANDROID_SDK_HOME/platform-tools:$PATH
+fi
+
+TSTCLASS=jogamp.android.launcher.LauncherUtil
+#TSTCLASS=com.jogamp.opengl.test.android.LauncherUtil
+#TSTCLASS=com.jogamp.android.launcher.NEWTLauncherMain
+#TSTCLASS=com.jogamp.nativewindow.NativeWindowVersion
+#TSTCLASS=com.jogamp.opengl.JoglVersion
+#TSTCLASS=com.jogamp.newt.NewtVersion
+#TSTCLASS=com.jogamp.newt.opengl.GLWindow
+#TSTCLASS=com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT
+#TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLSimple01NEWT
+#TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState01NEWT
+#TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT
+#TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestRulerNEWT01
+#TSTCLASS=com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo01
+#TSTCLASS=com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo02
+#TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.gl2es1.gears.newt.TestGearsGL2ES1NEWT
+
+LOGFILE=`basename $0 .sh`.log
+
+RSYNC_EXCLUDES="--delete-excluded \
+ --exclude 'build-x86*/' --exclude 'build-linux*/' --exclude 'build-win*/' --exclude 'build-mac*/' \
+ --exclude 'classes/' --exclude 'src/' --exclude '.git/' --exclude '*-java-src.zip' \
+ --exclude 'gensrc/' --exclude 'doc/' --exclude 'jnlp-files' --exclude 'archive/' \
+ --exclude 'android-sdk/' --exclude 'resources/' --exclude 'scripts/' \
+ --exclude 'stub_includes/' --exclude 'nbproject/' --exclude '*.log' --exclude '*.zip' --exclude '*.7z'"
+
+echo "#! /system/bin/sh" > $BUILD_DIR/jogl-targetcommand.sh
+
+echo "\
+rsync -av --delete --delete-after $RSYNC_EXCLUDES \
+ $HOST_UID@$HOST_IP::$HOST_RSYNC_ROOT/gluegen \
+ $HOST_UID@$HOST_IP::$HOST_RSYNC_ROOT/jogl \
+ $TARGET_ROOT ; \
+cd $TARGET_ROOT/jogl/make ;
+export LD_LIBRARY_PATH=/system/lib:$TARGET_ROOT/gluegen/make/$BUILD_DIR/obj:$TARGET_ROOT/jogl/make/$BUILD_DIR/lib ; \
+# export BOOTCLASSPATH=/system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
+dalvikvm \
+ -Xjnigreflimit:2000 \
+ -cp ../../gluegen/make/$BUILD_DIR/jogamp.android-launcher.apk:../../gluegen/make/lib/ant-junit-all.apk:../../gluegen/make/$BUILD_DIR/gluegen-rt.apk:$BUILD_DIR/jar/jogl.all-android.apk:$BUILD_DIR/jar/jogl.test.apk:$BUILD_DIR/jar/jogl.android-launcher.apk \
+ -Dgluegen.root=../../gluegen \
+ -Drootrel.build=build-android-armv7 \
+ com.android.internal.util.WithFramework \
+ $TSTCLASS \
+" >> $BUILD_DIR/jogl-targetcommand.sh
+
+chmod ugo+x $BUILD_DIR/jogl-targetcommand.sh
+adb connect $TARGET_IP:$TARGET_ADB_PORT
+adb -s $TARGET_IP:$TARGET_ADB_PORT push $BUILD_DIR/jogl-targetcommand.sh $TARGET_ROOT/jogl-targetcommand.sh
+adb -s $TARGET_IP:$TARGET_ADB_PORT shell su -c $TARGET_ROOT/jogl-targetcommand.sh 2>&1 | tee $LOGFILE
+
+
diff --git a/make/scripts/adb-uninstall-all.sh b/make/scripts/adb-uninstall-all.sh
index 3e65e128c..1605a0e35 100755
--- a/make/scripts/adb-uninstall-all.sh
+++ b/make/scripts/adb-uninstall-all.sh
@@ -1,4 +1,4 @@
+adb $* uninstall jogamp.android.launcher
adb $* uninstall com.jogamp.common
adb $* uninstall javax.media.opengl
-adb $* uninstall com.jogamp.android.launcher
adb $* uninstall com.jogamp.opengl.test
diff --git a/make/scripts/crosstest-java-android-armv7-rel.sh b/make/scripts/crosstest-java-android-armv7-rel.sh
deleted file mode 100644
index 8d9ae27f9..000000000
--- a/make/scripts/crosstest-java-android-armv7-rel.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#! /bin/bash
-
-export HOST_UID=sven
-export HOST_IP=192.168.0.52
-export HOST_RSYNC_ROOT=PROJECTS/JOGL
-
-export TARGET_UID=jogamp
-export TARGET_IP=beagle02
-export TARGET_ROOT=/projects
-
-export BUILD_DIR=../build-android-armv7
-
-if [ -e /opt-linux-x86/android-sdk-linux_x86 ] ; then
- export ANDROID_SDK_HOME=/opt-linux-x86/android-sdk-linux_x86
- export PATH=$ANDROID_SDK_HOME/platform-tools:$PATH
-fi
-
-#
-# orig android:
-# export LD_LIBRARY_PATH /system/lib
-# export BOOTCLASSPATH /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar
-#
-
-#TSTCLASS=com.jogamp.nativewindow.NativeWindowVersion
-#TSTCLASS=com.jogamp.opengl.JoglVersion
-#TSTCLASS=com.jogamp.newt.NewtVersion
-TSTCLASS=com.jogamp.newt.opengl.GLWindow
-#TSTCLASS=com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT
-#TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLSimple01NEWT
-#TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState01NEWT
-#TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestGLSLShaderState02NEWT
-#TSTCLASS=com.jogamp.opengl.test.junit.jogl.glsl.TestRulerNEWT01
-#TSTCLASS=com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo01
-#TSTCLASS=com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo02
-#TSTCLASS=com.jogamp.opengl.test.junit.jogl.demos.gl2es1.gears.newt.TestGearsGL2ES1NEWT
-
-
-LOGFILE=`basename $0 .sh`.log
-
-# -Djava.class.path=lib/junit.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-junit.jar:$BUILD_DIR/gluegen.jar:$BUILD_DIR/test/build/gluegen-test.jar \
-# -Djava.class.path=lib/ant-junit-all.apk:$BUILD_DIR/gluegen-rt.apk \
-# -Djava.library.path=/system/lib:$TARGET_ROOT/gluegen/make/$BUILD_DIR/obj:$BUILD_DIR/test/build/natives \
-
-RSYNC_EXCLUDES="--exclude 'build-x86*/' --exclude 'build-linux*/' --exclude 'build-win*/' --exclude 'build-mac*/' \
- --exclude 'classes/' --exclude 'src/' --exclude '.git/' --exclude 'jogl-java-src.zip' \
- --delete-excluded"
-
-echo "#! /system/bin/sh" > $BUILD_DIR/targetcommand.sh
-
-echo "\
-rsync -av --delete --delete-after $RSYNC_EXCLUDES $HOST_UID@$HOST_IP::$HOST_RSYNC_ROOT/gluegen $HOST_UID@$HOST_IP::$HOST_RSYNC_ROOT/jogl $TARGET_ROOT ; \
-cd $TARGET_ROOT/jogl/make ;
-export LD_LIBRARY_PATH=/system/lib:$TARGET_ROOT/gluegen/make/$BUILD_DIR/obj:$TARGET_ROOT/jogl/make/$BUILD_DIR/lib ; \
-export BOOTCLASSPATH=/system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar ; \
-dalvikvm \
- -Xjnigreflimit:2000 \
- -cp ../../gluegen/make/lib/ant-junit-all.apk:../../gluegen/make/$BUILD_DIR/gluegen-rt.apk:$BUILD_DIR/jar/jogl.all-android.apk:$BUILD_DIR/jar/jogl.test.jar \
- -Djogamp.debug.JNILibLoader=true \
- -Djogamp.debug.NativeLibrary=true \
- -Djogamp.debug.NativeLibrary.Lookup=true \
- -Djogl.debug=all \
- com.android.internal.util.WithFramework \
- $TSTCLASS \
-" >> $BUILD_DIR/targetcommand.sh
-
-chmod ugo+x $BUILD_DIR/targetcommand.sh
-adb push $BUILD_DIR/targetcommand.sh $TARGET_ROOT/targetcommand.sh
-adb shell $TARGET_ROOT/targetcommand.sh 2>&1 | tee $LOGFILE
-
diff --git a/make/scripts/crosstest-launch-android-activity.sh b/make/scripts/crosstest-launch-android-activity.sh
deleted file mode 100644
index c67cbfa11..000000000
--- a/make/scripts/crosstest-launch-android-activity.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#! /bin/sh
-
-#adb uninstall com.jogamp.common
-#adb install ../../gluegen/build-android-armv7/gluegen-rt.apk
-
-adb uninstall javax.media.opengl
-adb install ../build-android-armv7/jar/jogl.all-android.apk
-
-adb shell "setprop log.redirect-stdio true ; setprop log.redirect-stderr true ; \
- am start -a android.intent.action.MAIN -n javax.media.opengl/jogamp.newt.driver.android.NewtVersionActivity"
-
-#adb uninstall com.jogamp.android.launcher
-#adb install ../build-android-armv7/android/jar/jogllauncher.apk
-
-#adb shell "setprop log.redirect-stdio true ; setprop log.redirect-stderr true ; \
-# am start -a android.intent.action.MAIN -n com.jogamp.android.launcher/com.jogamp.android.launcher.NEWTLauncherVersionActivity"
-
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index c61b03fab..c0db411dc 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -205,7 +205,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestGearsES1NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
-testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestRedSquareES1NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestRedSquareES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestWindows01NEWT $*
@@ -214,7 +214,7 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows02NEWTAnimated $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle01NEWT
#testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle02NEWT
-#testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT $*
+testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting02NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode00NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode00bNEWT
diff --git a/src/android/com/jogamp/android/launcher/ClassLoaderUtil.java b/src/android/com/jogamp/android/launcher/ClassLoaderUtil.java
deleted file mode 100644
index 4f0bf46b8..000000000
--- a/src/android/com/jogamp/android/launcher/ClassLoaderUtil.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Copyright 2011 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-
-package com.jogamp.android.launcher;
-
-import java.io.File;
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.util.Log;
-import dalvik.system.DexClassLoader;
-
-public class ClassLoaderUtil {
- private static final String TAG = "JogampClassLoader";
-
- public static final String packageGlueGen = "com.jogamp.common";
- public static final String packageJogl = "javax.media.opengl";
-
- public static final String dexPathName= "jogampDex";
-
- private static LauncherTempFileCache tmpFileCache = null;
- private static ClassLoader jogAmpClassLoader = null;
-
- public static synchronized ClassLoader createJogampClassLoaderSingleton(Context ctx, String userPackageName) {
- if(null==jogAmpClassLoader) {
- if(null!=tmpFileCache) {
- throw new InternalError("XXX0");
- }
- if(!LauncherTempFileCache.initSingleton(ctx)) {
- throw new InternalError("TempFileCache initialization error");
- }
- tmpFileCache = new LauncherTempFileCache();
- if(!tmpFileCache.isValid()) {
- throw new InternalError("TempFileCache instantiation error");
- }
- final ApplicationInfo ai = ctx.getApplicationInfo();
- Log.d(TAG, "S: userPackageName: "+userPackageName+", dataDir: "+ai.dataDir+", nativeLibraryDir: "+ai.nativeLibraryDir);
-
- final String appDir = new File(ai.dataDir).getParent();
- final String libSub = ai.nativeLibraryDir.substring(ai.nativeLibraryDir.lastIndexOf('/')+1);
- Log.d(TAG, "S: appDir: "+appDir+", libSub: "+libSub);
-
- final String libPathName = appDir + "/" + packageGlueGen + "/" + libSub + "/:" +
- appDir + "/" + packageJogl + "/" + libSub + "/" ;
- Log.d(TAG, "S: libPath: "+libPathName);
-
- String apkGlueGen = null;
- String apkJogl = null;
-
- try {
- apkGlueGen = ctx.getPackageManager().getApplicationInfo(packageGlueGen,0).sourceDir;
- apkJogl = ctx.getPackageManager().getApplicationInfo(packageJogl,0).sourceDir;
- } catch (PackageManager.NameNotFoundException e) {
- Log.d(TAG, "error: "+e, e);
- }
- if(null == apkGlueGen || null == apkJogl) {
- Log.d(TAG, "not found: gluegen <"+apkGlueGen+">, jogl <"+apkJogl+">");
- return null;
- }
-
- final String cp = apkGlueGen + ":" + apkJogl ;
- Log.d(TAG, "jogamp cp: " + cp);
-
- final File dexPath = new File(tmpFileCache.getTempDir(), dexPathName);
- Log.d(TAG, "jogamp dexPath: " + dexPath.getAbsolutePath());
- dexPath.mkdir();
- jogAmpClassLoader = new DexClassLoader(cp, dexPath.getAbsolutePath(), libPathName, ctx.getClassLoader());
- } else {
- if(null==tmpFileCache) {
- throw new InternalError("XXX1");
- }
- }
-
- String apkUser = null;
- try {
- apkUser = ctx.getPackageManager().getApplicationInfo(userPackageName,0).sourceDir;
- } catch (PackageManager.NameNotFoundException e) {
- Log.d(TAG, "error: "+e, e);
- }
- if(null == apkUser) {
- Log.d(TAG, "not found: user apk <"+apkUser+">");
- return null;
- }
-
- Log.d(TAG, "user cp: " + apkUser);
- final File dexPath = new File(tmpFileCache.getTempDir(), userPackageName);
- Log.d(TAG, "user dexPath: " + dexPath.getAbsolutePath());
- dexPath.mkdir();
- ClassLoader cl = new DexClassLoader(apkUser, dexPath.getAbsolutePath(), null, jogAmpClassLoader);
- Log.d(TAG, "cl: " + cl);
- // setAPKClassLoader(dexLoader);
-
- return cl;
- }
-
-}
diff --git a/src/android/com/jogamp/android/launcher/LauncherTempFileCache.java b/src/android/com/jogamp/android/launcher/LauncherTempFileCache.java
deleted file mode 100644
index 9d98d07ff..000000000
--- a/src/android/com/jogamp/android/launcher/LauncherTempFileCache.java
+++ /dev/null
@@ -1,477 +0,0 @@
-/**
- * Copyright 2011 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-package com.jogamp.android.launcher;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileLock;
-
-import android.content.Context;
-
-public class LauncherTempFileCache {
- private static final boolean DEBUG = true;
-
- // Lifecycle: For all JVMs, ClassLoader and times.
- private static final String tmpDirPrefix = "jogamp.tmp.cache";
-
- // Get the value of the tmproot system property
- // Lifecycle: For all JVMs and ClassLoader
- /* package */ static final String tmpRootPropName = "jnlp.jogamp.tmp.cache.root";
-
- // Flag indicating that we got a fatal error in the static initializer.
- private static boolean staticInitError = false;
-
- private static File tmpBaseDir;
-
- // String representing the name of the temp root directory relative to the
- // tmpBaseDir. Its value is "jlnNNNNN", which is the unique filename created
- // by File.createTempFile() without the ".tmp" extension.
- //
- // Lifecycle: For all JVMs and ClassLoader
- //
- private static String tmpRootPropValue;
-
- private static File tmpRootDir;
-
- // Flag indicating that we got a fatal error in the initializer.
- private boolean initError = false;
-
- private File individualTmpDir;
-
- /**
- * Documented way to kick off static initialization
- * @return true is static initialization was successful
- */
- public static synchronized boolean initSingleton(Context ctx) {
- if(null == tmpRootDir && !staticInitError) {
- // Create / initialize the temp root directory, starting the Reaper
- // thread to reclaim old installations if necessary. If we get an
- // exception, set an error code.
- try {
- initTmpRoot(ctx);
- } catch (Exception ex) {
- ex.printStackTrace();
- staticInitError = true;
- }
- }
- return !staticInitError;
- }
-
- /**
- * This method is called by the static initializer to create / initialize
- * the temp root directory that will hold the temp directories for this
- * instance of the JVM. This is done as follows:
- *
- * 1. Synchronize on a global lock. Note that for this purpose we will
- * use System.out in the absence of a true global lock facility.
- * We are careful not to hold this lock too long.
- *
- * 2. Check for the existence of the "jnlp.applet.launcher.tmproot"
- * system property.
- *
- * a. If set, then some other thread in a different ClassLoader has
- * already created the tmprootdir, so we just need to
- * use it. The remaining steps are skipped.
- *
- * b. If not set, then we are the first thread in this JVM to run,
- * and we need to create the the tmprootdir.
- *
- * 3. Create the tmprootdir, along with the appropriate locks.
- * Note that we perform the operations in the following order,
- * prior to creating tmprootdir itself, to work around the fact that
- * the file creation and file lock steps are not atomic, and we need
- * to ensure that a newly-created tmprootdir isn't reaped by a
- * concurrently running JVM.
- *
- * create jlnNNNN.tmp using File.createTempFile()
- * lock jlnNNNN.tmp
- * create jlnNNNN.lck while holding the lock on the .tmp file
- * lock jlnNNNN.lck
- *
- * Since the Reaper thread will enumerate the list of *.lck files
- * before starting, we can guarantee that if there exists a *.lck file
- * for an active process, then the corresponding *.tmp file is locked
- * by that active process. This guarantee lets us avoid reaping an
- * active process' files.
- *
- * 4. Set the "jnlp.applet.launcher.tmproot" system property.
- *
- * 5. Add a shutdown hook to cleanup jlnNNNN.lck and jlnNNNN.tmp. We
- * don't actually expect that this shutdown hook will ever be called,
- * but the act of doing this, ensures that the locks never get
- * garbage-collected, which is necessary for correct behavior when
- * the first ClassLoader is later unloaded, while subsequent Applets
- * are still running.
- *
- * 6. Start the Reaper thread to cleanup old installations.
- */
- private static void initTmpRoot(Context ctx) throws IOException {
- if (DEBUG) {
- System.err.println("TempFileCache: Static Initialization ----------------------------------------------");
- System.err.println("TempFileCache: Thread: "+Thread.currentThread().getName()+", CL 0x"+Integer.toHexString(LauncherTempFileCache.class.getClassLoader().hashCode()));
- }
-
- synchronized (System.out) {
- // Get the name of the tmpbase directory.
- {
- final File tmpRoot = ctx.getDir("temp", Context.MODE_WORLD_READABLE);
- tmpBaseDir = new File(tmpRoot, tmpDirPrefix);
- }
- tmpRootPropValue = System.getProperty(tmpRootPropName);
-
- if (tmpRootPropValue == null) {
- // Create the tmpbase directory if it doesn't already exist
- tmpBaseDir.mkdir();
- if (!tmpBaseDir.isDirectory()) {
- throw new IOException("Cannot create directory " + tmpBaseDir);
- }
-
- // Create ${tmpbase}/jlnNNNN.tmp then lock the file
- File tmpFile = File.createTempFile("jln", ".tmp", tmpBaseDir);
- if (DEBUG) {
- System.err.println("TempFileCache: tmpFile = " + tmpFile.getAbsolutePath());
- }
- final FileOutputStream tmpOut = new FileOutputStream(tmpFile);
- final FileChannel tmpChannel = tmpOut.getChannel();
- final FileLock tmpLock = tmpChannel.lock();
-
- // Strip off the ".tmp" to get the name of the tmprootdir
- String tmpFileName = tmpFile.getAbsolutePath();
- String tmpRootName = tmpFileName.substring(0, tmpFileName.lastIndexOf(".tmp"));
-
- // create ${tmpbase}/jlnNNNN.lck then lock the file
- String lckFileName = tmpRootName + ".lck";
- File lckFile = new File(lckFileName);
- if (DEBUG) {
- System.err.println("TempFileCache: lckFile = " + lckFile.getAbsolutePath());
- }
- lckFile.createNewFile();
- final FileOutputStream lckOut = new FileOutputStream(lckFile);
- final FileChannel lckChannel = lckOut.getChannel();
- final FileLock lckLock = lckChannel.lock();
-
- // Create tmprootdir
- tmpRootDir = new File(tmpRootName);
- if (DEBUG) {
- System.err.println("TempFileCache: tmpRootDir = " + tmpRootDir.getAbsolutePath());
- }
- if (!tmpRootDir.mkdir()) {
- throw new IOException("Cannot create " + tmpRootDir);
- }
-
- // Add shutdown hook to cleanup the OutputStream, FileChannel,
- // and FileLock for the jlnNNNN.lck and jlnNNNN.lck files.
- // We do this so that the locks never get garbage-collected.
- Runtime.getRuntime().addShutdownHook(new Thread() {
- /* @Override */
- public void run() {
- // NOTE: we don't really expect that this code will ever
- // be called. If it does, we will close the output
- // stream, which will in turn close the channel.
- // We will then release the lock.
- try {
- tmpOut.close();
- tmpLock.release();
- lckOut.close();
- lckLock.release();
- } catch (IOException ex) {
- // Do nothing
- }
- }
- });
-
- // Set the system property...
- tmpRootPropValue = tmpRootName.substring(tmpRootName.lastIndexOf(File.separator) + 1);
- System.setProperty(tmpRootPropName, tmpRootPropValue);
- if (DEBUG) {
- System.err.println("TempFileCache: Setting " + tmpRootPropName + "=" + tmpRootPropValue);
- }
-
- // Start a new Reaper thread to do stuff...
- Thread reaperThread = new Thread() {
- /* @Override */
- public void run() {
- deleteOldTempDirs();
- }
- };
- reaperThread.setName("TempFileCache-Reaper");
- reaperThread.start();
- } else {
- // Make sure that the property is not set to an illegal value
- if (tmpRootPropValue.indexOf('/') >= 0 ||
- tmpRootPropValue.indexOf(File.separatorChar) >= 0) {
- throw new IOException("Illegal value of: " + tmpRootPropName);
- }
-
- // Set tmpRootDir = ${tmpbase}/${jnlp.applet.launcher.tmproot}
- if (DEBUG) {
- System.err.println("TempFileCache: Using existing value of: " +
- tmpRootPropName + "=" + tmpRootPropValue);
- }
- tmpRootDir = new File(tmpBaseDir, tmpRootPropValue);
- if (DEBUG) {
- System.err.println("TempFileCache: tmpRootDir = " + tmpRootDir.getAbsolutePath());
- }
- if (!tmpRootDir.isDirectory()) {
- throw new IOException("Cannot access " + tmpRootDir);
- }
- }
- }
- if (DEBUG) {
- System.err.println("------------------------------------------------------------------ (static ok: "+(!staticInitError)+")");
- }
- }
-
- /**
- * Called by the Reaper thread to delete old temp directories
- * Only one of these threads will run per JVM invocation.
- */
- private static void deleteOldTempDirs() {
- if (DEBUG) {
- System.err.println("TempFileCache: *** Reaper: deleteOldTempDirs in " +
- tmpBaseDir.getAbsolutePath());
- }
-
- // enumerate list of jnl*.lck files, ignore our own jlnNNNN file
- final String ourLockFile = tmpRootPropValue + ".lck";
- FilenameFilter lckFilter = new FilenameFilter() {
- /* @Override */
- public boolean accept(File dir, String name) {
- return name.endsWith(".lck") && !name.equals(ourLockFile);
- }
- };
-
- // For each file <file>.lck in the list we will first try to lock
- // <file>.tmp if that succeeds then we will try to lock <file>.lck
- // (which should always succeed unless there is a problem). If we can
- // get the lock on both files, then it must be an old installation, and
- // we will delete it.
- String[] fileNames = tmpBaseDir.list(lckFilter);
- if (fileNames != null) {
- for (int i = 0; i < fileNames.length; i++) {
- String lckFileName = fileNames[i];
- String tmpDirName = lckFileName.substring(0, lckFileName.lastIndexOf(".lck"));
- String tmpFileName = tmpDirName + ".tmp";
-
- File lckFile = new File(tmpBaseDir, lckFileName);
- File tmpFile = new File(tmpBaseDir, tmpFileName);
- File tmpDir = new File(tmpBaseDir, tmpDirName);
-
- if (lckFile.exists() && tmpFile.exists() && tmpDir.isDirectory()) {
- FileOutputStream tmpOut = null;
- FileChannel tmpChannel = null;
- FileLock tmpLock = null;
-
- try {
- tmpOut = new FileOutputStream(tmpFile);
- tmpChannel = tmpOut.getChannel();
- tmpLock = tmpChannel.tryLock();
- } catch (Exception ex) {
- // Ignore exceptions
- if (DEBUG) {
- ex.printStackTrace();
- }
- }
-
- if (tmpLock != null) {
- FileOutputStream lckOut = null;
- FileChannel lckChannel = null;
- FileLock lckLock = null;
-
- try {
- lckOut = new FileOutputStream(lckFile);
- lckChannel = lckOut.getChannel();
- lckLock = lckChannel.tryLock();
- } catch (Exception ex) {
- if (DEBUG) {
- ex.printStackTrace();
- }
- }
-
- if (lckLock != null) {
- // Recursively remove the old tmpDir and all of
- // its contents
- removeAll(tmpDir);
-
- // Close the streams and delete the .lck and .tmp
- // files. Note that there is a slight race condition
- // in that another process could open a stream at
- // the same time we are trying to delete it, which will
- // prevent deletion, but we won't worry about it, since
- // the worst that will happen is we might have an
- // occasional 0-byte .lck or .tmp file left around
- try {
- lckOut.close();
- } catch (IOException ex) {
- }
- lckFile.delete();
- try {
- tmpOut.close();
- } catch (IOException ex) {
- }
- tmpFile.delete();
- } else {
- try {
- // Close the file and channel for the *.lck file
- if (lckOut != null) {
- lckOut.close();
- }
- // Close the file/channel and release the lock
- // on the *.tmp file
- tmpOut.close();
- tmpLock.release();
- } catch (IOException ex) {
- if (DEBUG) {
- ex.printStackTrace();
- }
- }
- }
- }
- } else {
- if (DEBUG) {
- System.err.println("TempFileCache: Skipping: " + tmpDir.getAbsolutePath());
- }
- }
- }
- }
- }
-
- /**
- * Remove the specified file or directory. If "path" is a directory, then
- * recursively remove all entries, then remove the directory itself.
- */
- private static void removeAll(File path) {
- if (DEBUG) {
- System.err.println("TempFileCache: removeAll(" + path + ")");
- }
-
- if (path.isDirectory()) {
- // Recursively remove all files/directories in this directory
- File[] list = path.listFiles();
- if (list != null) {
- for (int i = 0; i < list.length; i++) {
- removeAll(list[i]);
- }
- }
- }
-
- path.delete();
- }
-
- public LauncherTempFileCache () {
- if (DEBUG) {
- System.err.println("TempFileCache: new TempFileCache() --------------------- (static ok: "+(!staticInitError)+")");
- System.err.println("TempFileCache: Thread: "+Thread.currentThread().getName()+", CL 0x"+Integer.toHexString(LauncherTempFileCache.class.getClassLoader().hashCode())+", this 0x"+Integer.toHexString(hashCode()));
- }
- if(!staticInitError) {
- try {
- createTmpDir();
- } catch (Exception ex) {
- ex.printStackTrace();
- initError = true;
- }
- }
- if (DEBUG) {
- System.err.println("tempDir: "+individualTmpDir+" (ok: "+(!initError)+")");
- System.err.println("----------------------------------------------------------");
- }
- }
-
- /**
- * @return true is static and object initialization was successful
- */
- public boolean isValid() { return !staticInitError && !initError; }
-
- /**
- * Base temp directory used by TempFileCache.
- * Lifecycle: For all JVMs, ClassLoader and times.
- *
- * This is set to:
- *
- * ${java.io.tmpdir}/<tmpDirPrefix>
- *
- *
- * @return
- */
- public File getBaseDir() { return tmpBaseDir; }
-
- /**
- * Root temp directory for this JVM instance. Used to store individual
- * directories.
- *
- * Lifecycle: For all JVMs and ClassLoader
- *
- * <tmpBaseDir>/<tmpRootPropValue>
- *
- * Use Case: Per ClassLoader files, eg. native libraries.
- *
- * Old temp directories are cleaned up the next time a JVM is launched that
- * uses TempFileCache.
- *
- *
- * @return
- */
- public File getRootDir() { return tmpRootDir; }
-
- /**
- * Temporary directory for individual files (eg. native libraries of one ClassLoader instance).
- * The directory name is:
- *
- * Lifecycle: Within each JVM .. use case dependent, ie. per ClassLoader
- *
- * <tmpRootDir>/jlnMMMMM
- *
- * where jlnMMMMM is the unique filename created by File.createTempFile()
- * without the ".tmp" extension.
- *
- *
- * @return
- */
- public File getTempDir() { return individualTmpDir; }
-
-
- /**
- * Create the temp directory in tmpRootDir. To do this, we create a temp
- * file with a ".tmp" extension, and then create a directory of the
- * same name but without the ".tmp". The temp file, directory, and all
- * files in the directory will be reaped the next time this is started.
- * We avoid deleteOnExit, because it doesn't work reliably.
- */
- private void createTmpDir() throws IOException {
- File tmpFile = File.createTempFile("jln", ".tmp", tmpRootDir);
- String tmpFileName = tmpFile.getAbsolutePath();
- String tmpDirName = tmpFileName.substring(0, tmpFileName.lastIndexOf(".tmp"));
- individualTmpDir = new File(tmpDirName);
- if (!individualTmpDir.mkdir()) {
- throw new IOException("Cannot create " + individualTmpDir);
- }
- }
-}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java
deleted file mode 100644
index 14f074c0c..000000000
--- a/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/**
- * Copyright 2011 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
- */
-package com.jogamp.android.launcher;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.widget.TextView;
-import android.util.Log;
-
-public abstract class NEWTLauncherActivity extends Activity {
- static final String TAG = "NEWTLauncherActivity";
- TextView tv = null;
- Method mOnCreate, mOnDestroy, mOnPause, mOnRestart, mOnResume,
- mOnStart, mOnStop, mSetIsInvokedByExternalActivity;
- Class<?> activityClazz = null;
- Object activityObject = null;
-
- public abstract String getUserActivityName();
- public abstract String getUserPackageName();
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- Log.d(TAG, "onCreate - S");
- super.onCreate(savedInstanceState);
-
- System.setProperty("jogamp.debug.JNILibLoader", "true");
- System.setProperty("jogamp.debug.NativeLibrary", "true");
- // System.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
- // System.setProperty("jogamp.debug.IOUtil", "true");
-
- // System.setProperty("nativewindow.debug", "all");
- System.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
-
- // System.setProperty("jogl.debug", "all");
- // System.setProperty("jogl.debug.GLProfile", "true");
- System.setProperty("jogl.debug.GLDrawable", "true");
- System.setProperty("jogl.debug.GLContext", "true");
- System.setProperty("jogl.debug.GLSLCode", "true");
- System.setProperty("jogl.debug.CapabilitiesChooser", "true");
-
- // System.setProperty("jogl.debug.GLSLState", "true");
- // System.setProperty("jogl.debug.DebugGL", "true");
- // System.setProperty("jogl.debug.TraceGL", "true");
-
- // System.setProperty("newt.debug", "all");
- System.setProperty("newt.debug.Window", "true");
- // System.setProperty("newt.debug.Window.MouseEvent", "true");
- // System.setProperty("newt.debug.Window.KeyEvent", "true");
-
- ClassLoader cl = ClassLoaderUtil.createJogampClassLoaderSingleton(this, getUserPackageName());
- if(null != cl) {
- try {
- activityClazz = Class.forName(getUserActivityName(), true, cl);
- Log.d(TAG, "Activity Clazz "+activityClazz);
- activityObject = createInstance(activityClazz, null);
- Log.d(TAG, "Activity Object "+activityObject);
- mOnCreate = activityClazz.getMethod("onCreate", Bundle.class);
- mOnDestroy = activityClazz.getMethod("onDestroy");
- mOnPause = activityClazz.getMethod("onPause");
- mOnRestart = activityClazz.getMethod("onRestart");
- mOnResume = activityClazz.getMethod("onResume");
- mOnStart = activityClazz.getMethod("onStart");
- mOnStop = activityClazz.getMethod("onStop");
- mSetIsInvokedByExternalActivity = activityClazz.getMethod("setIsInvokedByExternalActivity", Activity.class);
- } catch (Exception e) {
- Log.d(TAG, "error: "+e, e);
- throw new RuntimeException(e);
- }
- }
-
- if( null == mOnCreate || null == mOnDestroy || null == mOnPause ||
- null == mOnRestart || null == mOnResume ||
- null == mSetIsInvokedByExternalActivity ) {
- RuntimeException e = new RuntimeException("XXX - incomplete method set");
- Log.d(TAG, "error: "+e, e);
- throw e;
- }
-
- callMethod(activityObject, mSetIsInvokedByExternalActivity, this);
-
- callMethod(activityObject, mOnCreate, savedInstanceState);
- Log.d(TAG, "onCreate - X");
- }
-
- @Override
- public void onStart() {
- Log.d(TAG, "onStart - S");
- callMethod(activityObject, mOnStart);
- super.onStart();
- Log.d(TAG, "onStart - X");
- }
-
- @Override
- public void onRestart() {
- Log.d(TAG, "onRestart - S");
- callMethod(activityObject, mOnRestart);
- super.onRestart();
- Log.d(TAG, "onRestart - X");
- }
-
- @Override
- public void onResume() {
- Log.d(TAG, "onResume - S");
- callMethod(activityObject, mOnResume);
- super.onResume();
- Log.d(TAG, "onResume - X");
- }
-
- @Override
- public void onPause() {
- Log.d(TAG, "onPause - S");
- callMethod(activityObject, mOnPause);
- super.onPause();
- Log.d(TAG, "onPause - X");
- }
-
- @Override
- public void onStop() {
- Log.d(TAG, "onStop - S");
- callMethod(activityObject, mOnStop);
- super.onStop();
- Log.d(TAG, "onStop - X");
- }
-
- @Override
- public void onDestroy() {
- Log.d(TAG, "onDestroy - S");
- callMethod(activityObject, mOnDestroy);
- super.onDestroy();
- finish();
- Log.d(TAG, "onDestroy - X");
- }
-
- @Override
- public void finish() {
- Log.d(TAG, "finish - S");
- super.finish();
- Log.d(TAG, "finish - X");
- }
-
- /**
- * @throws JogampRuntimeException if the instance can not be created.
- */
- public static final Object createInstance(Class<?> clazz, Class<?>[] cstrArgTypes, Object ... cstrArgs)
- throws RuntimeException
- {
- return createInstance(getConstructor(clazz, cstrArgTypes), cstrArgs);
- }
-
- public static final Object createInstance(Constructor<?> cstr, Object ... cstrArgs)
- throws RuntimeException
- {
- try {
- return cstr.newInstance(cstrArgs);
- } catch (Exception e) {
- Throwable t = e;
- if (t instanceof InvocationTargetException) {
- t = ((InvocationTargetException) t).getTargetException();
- }
- if (t instanceof Error) {
- throw (Error) t;
- }
- if (t instanceof RuntimeException) {
- throw (RuntimeException) t;
- }
- throw new RuntimeException("can not create instance of "+cstr.getName(), t);
- }
- }
-
- /**
- * @throws JogampRuntimeException if the constructor can not be delivered.
- */
- protected static final Constructor<?> getConstructor(Class<?> clazz, Class<?> ... cstrArgTypes)
- throws RuntimeException {
- try {
- if(null == cstrArgTypes) {
- cstrArgTypes = zeroTypes;
- }
- return clazz.getDeclaredConstructor(cstrArgTypes);
- } catch (NoSuchMethodException ex) {
- throw new RuntimeException("Constructor: '" + clazz + "(" + asString(cstrArgTypes) + ")' not found", ex);
- }
- }
-
- protected static final Class<?>[] zeroTypes = new Class[0];
-
- protected static final String asString(Class<?>[] argTypes) {
- StringBuffer args = new StringBuffer();
- boolean coma = false;
- if(null != argTypes) {
- for (int i = 0; i < argTypes.length; i++) {
- if(coma) {
- args.append(", ");
- }
- args.append(argTypes[i].getName());
- coma = true;
- }
- }
- return args.toString();
- }
-
- protected static final Object callMethod(Object instance, Method method, Object ... args)
- throws RuntimeException
- {
- try {
- return method.invoke(instance, args);
- } catch (Exception e) {
- Throwable t = e;
- if (t instanceof InvocationTargetException) {
- t = ((InvocationTargetException) t).getTargetException();
- }
- if (t instanceof Error) {
- throw (Error) t;
- }
- if (t instanceof RuntimeException) {
- throw (RuntimeException) t;
- }
- throw new RuntimeException("calling "+method+" failed", t);
- }
- }
-
-
-}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherElektronActivity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherElektronActivity.java
deleted file mode 100644
index 85a751ea6..000000000
--- a/src/android/com/jogamp/android/launcher/NEWTLauncherElektronActivity.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.jogamp.android.launcher;
-
-public class NEWTLauncherElektronActivity extends NEWTLauncherActivity {
- static String demo = "com.jogamp.opengl.test.android.NEWTElektronActivity";
- static String pkg = "com.jogamp.opengl.test";
-
- @Override
- public String getUserActivityName() {
- return demo;
- }
- @Override
- public String getUserPackageName() {
- return pkg;
- }
-}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES1Activity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES1Activity.java
deleted file mode 100644
index 05b47544b..000000000
--- a/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES1Activity.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.jogamp.android.launcher;
-
-public class NEWTLauncherGearsES1Activity extends NEWTLauncherActivity {
- static String demo = "com.jogamp.opengl.test.android.NEWTGearsES1Activity";
- static String pkg = "com.jogamp.opengl.test";
-
- @Override
- public String getUserActivityName() {
- return demo;
- }
- @Override
- public String getUserPackageName() {
- return pkg;
- }
-}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES2Activity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES2Activity.java
deleted file mode 100644
index 78f2b7411..000000000
--- a/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES2Activity.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.jogamp.android.launcher;
-
-public class NEWTLauncherGearsES2Activity extends NEWTLauncherActivity {
- static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2Activity";
- static String pkg = "com.jogamp.opengl.test";
-
- @Override
- public String getUserActivityName() {
- return demo;
- }
- @Override
- public String getUserPackageName() {
- return pkg;
- }
-}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES2TransActivity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES2TransActivity.java
deleted file mode 100644
index c55620f4c..000000000
--- a/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES2TransActivity.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.jogamp.android.launcher;
-
-public class NEWTLauncherGearsES2TransActivity extends NEWTLauncherActivity {
- static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2TransActivity";
- static String pkg = "com.jogamp.opengl.test";
-
- @Override
- public String getUserActivityName() {
- return demo;
- }
- @Override
- public String getUserPackageName() {
- return pkg;
- }
-}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherGraphUI1pActivity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherGraphUI1pActivity.java
deleted file mode 100644
index 1af0de1f2..000000000
--- a/src/android/com/jogamp/android/launcher/NEWTLauncherGraphUI1pActivity.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.jogamp.android.launcher;
-
-public class NEWTLauncherGraphUI1pActivity extends NEWTLauncherActivity {
- static String demo = "com.jogamp.opengl.test.android.NEWTGraphUI1pActivity";
- static String pkg = "com.jogamp.opengl.test";
-
- @Override
- public String getUserActivityName() {
- return demo;
- }
- @Override
- public String getUserPackageName() {
- return pkg;
- }
-}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherGraphUI2pActivity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherGraphUI2pActivity.java
deleted file mode 100644
index 0a5f8d265..000000000
--- a/src/android/com/jogamp/android/launcher/NEWTLauncherGraphUI2pActivity.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.jogamp.android.launcher;
-
-public class NEWTLauncherGraphUI2pActivity extends NEWTLauncherActivity {
- static String demo = "com.jogamp.opengl.test.android.NEWTGraphUI2pActivity";
- static String pkg = "com.jogamp.opengl.test";
-
- @Override
- public String getUserActivityName() {
- return demo;
- }
- @Override
- public String getUserPackageName() {
- return pkg;
- }
-}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES1Activity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES1Activity.java
deleted file mode 100644
index af5270569..000000000
--- a/src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES1Activity.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.jogamp.android.launcher;
-
-public class NEWTLauncherRedSquareES1Activity extends NEWTLauncherActivity {
- static String demo = "com.jogamp.opengl.test.android.NEWTRedSquareES1Activity";
- static String pkg = "com.jogamp.opengl.test";
-
- @Override
- public String getUserActivityName() {
- return demo;
- }
- @Override
- public String getUserPackageName() {
- return pkg;
- }
-}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES2Activity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES2Activity.java
deleted file mode 100644
index 03e2ad7d3..000000000
--- a/src/android/com/jogamp/android/launcher/NEWTLauncherRedSquareES2Activity.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.jogamp.android.launcher;
-
-public class NEWTLauncherRedSquareES2Activity extends NEWTLauncherActivity {
- static String demo = "com.jogamp.opengl.test.android.NEWTRedSquareES2Activity";
- static String pkg = "com.jogamp.opengl.test";
-
- @Override
- public String getUserActivityName() {
- return demo;
- }
- @Override
- public String getUserPackageName() {
- return pkg;
- }
-}
diff --git a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java
index 5cef22a6c..26aa1a806 100644
--- a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java
+++ b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java
@@ -28,6 +28,10 @@
package jogamp.newt.driver.android;
+import java.lang.reflect.Constructor;
+import java.util.Arrays;
+
+import jogamp.common.os.android.StaticContext;
import jogamp.newt.driver.android.event.AndroidNewtEventFactory;
import javax.media.nativewindow.Capabilities;
@@ -39,6 +43,8 @@ import javax.media.nativewindow.util.Point;
import javax.media.opengl.GLCapabilitiesChooser;
import javax.media.opengl.GLCapabilitiesImmutable;
+import com.jogamp.common.JogampRuntimeException;
+import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
import com.jogamp.newt.event.MouseEvent;
@@ -59,8 +65,32 @@ import android.view.Window;
import android.view.WindowManager;
public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 {
+ private static final String[] androidWindowImplClassNames = { "android.policy.PhoneWindow", "com.android.internal.policy.impl.PhoneWindow" };
+ private static final Constructor<?> androidWindowImplCtor;
+
static {
AndroidDisplay.initSingleton();
+ final ClassLoader cl = AndroidWindow.class.getClassLoader();
+ Class<?> androidWindowImplClass = null;
+ int i;
+ for(i=0; i<androidWindowImplClassNames.length; i++) {
+ try {
+ androidWindowImplClass = ReflectionUtil.getClass(androidWindowImplClassNames[i], false, cl);
+ if(null != androidWindowImplClass) {
+ break;
+ }
+ } catch (JogampRuntimeException jre) { }
+ }
+ if(null == androidWindowImplClass) {
+ Log.d(MD.TAG, "Window Impl.: No class available: "+Arrays.asList(androidWindowImplClassNames));
+ androidWindowImplCtor = null;
+ } else {
+ androidWindowImplCtor = ReflectionUtil.getConstructor(androidWindowImplClass, new Class[] { android.content.Context.class } );
+ if(null == androidWindowImplCtor) {
+ throw new NativeWindowException("Constructor <"+androidWindowImplClassNames[i]+"(Context)> n/a.");
+ }
+ Log.d(MD.TAG, "Window Impl.: Found "+androidWindowImplClassNames[i]);
+ }
}
public static CapabilitiesImmutable fixCaps(boolean matchFormatPrecise, int format, CapabilitiesImmutable rCaps) {
@@ -155,9 +185,48 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 {
}
+ public static Class<?>[] getCustomConstructorArgumentTypes() {
+ return new Class<?>[] { Context.class } ;
+ }
+
+ public AndroidWindow() {
+ reset();
+ }
+
+ public AndroidWindow(android.view.Window awin) {
+ reset();
+ androidWindow = awin;
+ }
+
+ private void reset() {
+ androidWindow = null;
+ ownAndroidWindow = false;
+ androidView = null;
+ format = VisualIDHolder.VID_UNDEFINED;
+ capsByFormat = null;
+ surface = null;
+ surfaceHandle = 0;
+ eglSurface = 0;
+ }
+
@Override
protected void instantiationFinished() {
- androidView = new MSurfaceView(jogamp.common.os.android.StaticContext.getContext());
+ final Context ctx = StaticContext.getContext();
+ if(null == ctx) {
+ throw new NativeWindowException("No static [Application] Context has been set. Call StaticContext.setContext(Context) first.");
+ }
+ if(!getRequestedCapabilities().isBackgroundOpaque()) {
+ // FIXME: doesn't work, even though resource is avail, happens before creating the view and setContentView() !
+ final String frn = ctx.getPackageName()+":style/Theme.Transparent";
+ final int resID = ctx.getResources().getIdentifier("Theme.Transparent", "style", ctx.getPackageName());
+ if(0 == resID) {
+ Log.d(MD.TAG, "Resource n/a: "+frn);
+ } else {
+ Log.d(MD.TAG, "Setting style: "+frn+": 0x"+Integer.toHexString(resID));
+ ctx.setTheme(resID);
+ }
+ }
+ androidView = new MSurfaceView(ctx);
final AndroidEvents ae = new AndroidEvents();
androidView.setOnTouchListener(ae);
androidView.setClickable(false);
@@ -183,18 +252,47 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 {
public SurfaceView getAndroidView() { return androidView; }
- public void setAndroidWindow(android.view.Window window) {
- System.err.println("setandroidWindow: "+window+", "+getWidth()+"x"+getHeight());
+ public void becomeContentViewOf(android.view.Window window) {
+ if(null != androidWindow) {
+ throw new NativeWindowException("Android Window already set");
+ }
androidWindow = window;
- androidWindowConfigurationPreCreate();
- if(null != androidWindow && getWidth()>0 && getHeight()>0 && !isFullscreen()) {
+ ownAndroidWindow = null == androidWindow;
+ if(ownAndroidWindow) {
+ if(null == androidWindowImplCtor) {
+ throw new NativeWindowException("Android Window contructor n/a");
+ }
+ try {
+ androidWindow = (android.view.Window) androidWindowImplCtor.newInstance(new Object[]{StaticContext.getContext()});
+ } catch (Exception e) {
+ throw new NativeWindowException("Error while instantiating new Android Window", e);
+ }
+ }
+ Log.d(MD.TAG, "setAndroidWindow: own: "+ownAndroidWindow+", "+androidWindow+", "+getWidth()+"x"+getHeight());
+
+ if( isFullscreen() || isUndecorated() ) {
+ androidWindow.requestFeature(Window.FEATURE_NO_TITLE);
+ }
+ if( isFullscreen() ) {
+ androidWindow.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
+ } else {
+ androidWindow.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
+ androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ }
+
+ if(getWidth()>0 && getHeight()>0 && !isFullscreen()) {
androidWindow.setLayout(getWidth(), getHeight());
}
+ androidWindow.setContentView(androidView);
}
public android.view.Window getAndroidWindow() { return androidWindow; }
@Override
protected boolean canCreateNativeImpl() {
+ if(null == androidWindow) {
+ becomeContentViewOf(null); // make own window
+ }
final boolean b = 0 != surfaceHandle;
Log.d(MD.TAG, "canCreateNativeImpl: "+b);
return b;
@@ -256,21 +354,6 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 {
}
}
- protected void androidWindowConfigurationPreCreate() {
- if( null != androidWindow) {
- if( isFullscreen() || isUndecorated() ) {
- androidWindow.requestFeature(Window.FEATURE_NO_TITLE);
- }
- if( isFullscreen() ) {
- androidWindow.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
- androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
- } else {
- androidWindow.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
- androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
- }
- }
- }
-
protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
if( 0 != ( FLAG_CHANGE_FULLSCREEN & flags) ) {
Log.d(MD.TAG, "reconfigureWindowImpl.setFullscreen post creation (setContentView()) n/a");
@@ -368,13 +451,14 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 {
windowRepaint(0, 0, getWidth(), getHeight());
}
- private MSurfaceView androidView;
private android.view.Window androidWindow;
+ private boolean ownAndroidWindow;
+ private MSurfaceView androidView;
private int format; // stored current PixelFormat
private GLCapabilitiesImmutable capsByFormat; // fixed requestedCaps by PixelFormat
- private Surface surface = null;
- private volatile long surfaceHandle = 0;
- private long eglSurface = 0;
+ private Surface surface;
+ private volatile long surfaceHandle;
+ private long eglSurface;
class MSurfaceView extends SurfaceView {
public MSurfaceView (Context ctx) {
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
index 97309b352..5cdb64577 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
@@ -63,12 +63,7 @@ public class NewtBaseActivity extends Activity {
newtWindow = newtWindow.getDelegatedWindow();
if(newtWindow instanceof AndroidWindow) {
this.newtWindow = (AndroidWindow)newtWindow;
- this.newtWindow.setAndroidWindow(androidWindow);
- if(isInvokedByExternalActivity) {
- extActivity.setContentView(this.newtWindow.getAndroidView());
- } else {
- super.setContentView(this.newtWindow.getAndroidView());
- }
+ this.newtWindow.becomeContentViewOf(androidWindow);
} else {
throw new IllegalArgumentException("Given NEWT Window is not an Android Window: "+newtWindow.getClass());
}
@@ -97,7 +92,6 @@ public class NewtBaseActivity extends Activity {
} else {
jogamp.common.os.android.StaticContext.setContext(extActivity.getApplicationContext());
}
- extActivity.getWindow();
}
@Override
diff --git a/src/test/com/jogamp/opengl/test/android/LauncherUtil.java b/src/test/com/jogamp/opengl/test/android/LauncherUtil.java
new file mode 100644
index 000000000..f1f36589d
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/LauncherUtil.java
@@ -0,0 +1,320 @@
+/**
+ * Copyright 2012 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.test.android;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+
+/**
+ * Helper class to parse Uri's and programmatically add package names and properties to create an Uri or Intend.
+ * <p>
+ * The order of the Uri segments (any arguments) is preserved.
+ * </p>
+ */
+public class LauncherUtil {
+
+ /** Default launch mode. */
+ public static final String LAUNCH_ACTIVITY_NORMAL = "org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL";
+
+ /** Transparent launch mode. Note: This seems to be required to achieve translucency, since setTheme(..) doesn't work. */
+ public static final String LAUNCH_ACTIVITY_TRANSPARENT = "org.jogamp.launcher.action.LAUNCH_ACTIVITY_TRANSPARENT";
+
+ /** FIXME: TODO */
+ public static final String LAUNCH_MAIN = "org.jogamp.launcher.action.LAUNCH_MAIN";
+
+ /** FIXME: TODO */
+ public static final String LAUNCH_JUNIT = "org.jogamp.launcher.action.LAUNCH_JUNIT";
+
+ /** The protocol <code>launch</code> */
+ public static final String SCHEME = "launch";
+
+ /** The host <code>jogamp.org</code> */
+ public static final String HOST = "jogamp.org";
+
+ static final String PKG = "pkg";
+
+ public static abstract class BaseActivityLauncher extends Activity {
+ final OrderedProperties props = new OrderedProperties();
+
+ /**
+ * Returns the default {@link LauncherUtil#LAUNCH_ACTIVITY_NORMAL} action.
+ * <p>
+ * Should be overridden for other action, eg. {@link LauncherUtil#LAUNCH_ACTIVITY_TRANSPARENT}.
+ * </p>
+ */
+ public String getAction() { return LAUNCH_ACTIVITY_NORMAL; }
+
+ /**
+ * Returns the properties, which are being propagated to the target activity.
+ * <p>
+ * Maybe be used to set custom properties.
+ * </p>
+ */
+ public final OrderedProperties getProperties() { return props; }
+
+ /** Custom initialization hook which can be overriden to setup data, e.g. fill the properties retrieved by {@link #getProperties()}. */
+ public void init() { }
+
+ /** Returns true if this launcher activity shall end after starting the downstream activity. Defaults to <code>true</code>, override to change behavior. */
+ public boolean finishAfterDelegate() { return true; }
+
+ /** Must return the downstream Activity class name */
+ public abstract String getActivityName();
+
+ /** Must return a list of required packages, at least one. */
+ public abstract List<String> getPackages();
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ init();
+
+ final DataSet data = new DataSet();
+ data.setActivityName(getActivityName());
+ data.addAllPackages(getPackages());
+ data.addAllProperties(props);
+
+ final Intent intent = LauncherUtil.getIntent(getAction(), data);
+ Log.d(getClass().getSimpleName(), "Launching Activity: "+intent);
+ startActivity (intent);
+
+ if(finishAfterDelegate()) {
+ finish(); // done
+ }
+ }
+ }
+
+ public static class OrderedProperties {
+ HashMap<String, String> map = new HashMap<String, String>();
+ ArrayList<String> keyList = new ArrayList<String>();
+
+ public final void setProperty(String key, String value) {
+ if(key.equals(PKG)) {
+ throw new IllegalArgumentException("Illegal property key, '"+PKG+"' is reserved");
+ }
+ final String oval = map.put(key, value);
+ if(null != oval) {
+ map.put(key, oval); // restore
+ throw new IllegalArgumentException("Property overwriting not allowed: "+key+": "+oval+" -> "+value);
+ }
+ keyList.add(key); // new key
+ }
+
+ public final void addAll(OrderedProperties props) {
+ Iterator<String> argKeys = props.keyList.iterator();
+ while(argKeys.hasNext()) {
+ final String key = argKeys.next();
+ setProperty(key, props.map.get(key));
+ }
+ }
+
+ public final void setSystemProperties() {
+ Iterator<String> argKeys = keyList.iterator();
+ while(argKeys.hasNext()) {
+ final String key = argKeys.next();
+ System.setProperty(key, map.get(key));
+ }
+ }
+
+ public final String getProperty(String key) { return map.get(key); }
+ public final Map<String, String> getProperties() { return map; }
+
+ /** Returns the list of property keys in the order, as they were added. */
+ public final List<String> getPropertyKeys() { return keyList; }
+ }
+
+ public static class DataSet {
+ static final char SLASH = '/';
+ static final char QMARK = '?';
+ static final char AMPER = '&';
+ static final char ASSIG = '=';
+ static final String COLSLASH2 = "://";
+ static final String EMPTY = "";
+
+ String activityName = null;
+ ArrayList<String> packages = new ArrayList<String>();
+ OrderedProperties properties = new OrderedProperties();
+
+ public final void setActivityName(String name) { activityName = name; }
+ public final String getActivityName() { return activityName; }
+
+ public final void addPackage(String p) {
+ packages.add(p);
+ }
+ public final void addAllPackages(List<String> plist) {
+ packages.addAll(plist);
+ }
+ public final List<String> getPackages() { return packages; }
+
+ public final void setProperty(String key, String value) {
+ properties.setProperty(key, value);
+ }
+ public final void addAllProperties(OrderedProperties props) {
+ properties.addAll(props);
+ }
+ public final void setSystemProperties() {
+ properties.setSystemProperties();
+ }
+ public final String getProperty(String key) { return properties.getProperty(key); }
+ public final OrderedProperties getProperties() { return properties; }
+ public final List<String> getPropertyKeys() { return properties.getPropertyKeys(); }
+
+ public final Uri getUri() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(SCHEME).append(COLSLASH2).append(HOST).append(SLASH).append(getActivityName());
+ boolean needsSep = false;
+ if(packages.size()>0) {
+ sb.append(QMARK);
+ for(int i=0; i<packages.size(); i++) {
+ if(needsSep) {
+ sb.append(AMPER);
+ }
+ sb.append(PKG).append(ASSIG).append(packages.get(i));
+ needsSep = true;
+ }
+ }
+ Iterator<String> argKeys = properties.keyList.iterator();
+ while(argKeys.hasNext()) {
+ if(needsSep) {
+ sb.append(AMPER);
+ }
+ final String key = argKeys.next();
+ sb.append(key).append(ASSIG).append(properties.map.get(key));
+ needsSep = true;
+ }
+ return Uri.parse(sb.toString());
+ }
+
+ public static final DataSet create(Uri uri) {
+ if(!uri.getScheme().equals(SCHEME)) {
+ return null;
+ }
+ if(!uri.getHost().equals(HOST)) {
+ return null;
+ }
+ DataSet data = new DataSet();
+ {
+ String an = uri.getPath();
+ if(SLASH == an.charAt(0)) {
+ an = an.substring(1);
+ }
+ if(SLASH == an.charAt(an.length()-1)) {
+ an = an.substring(0, an.length()-1);
+ }
+ data.setActivityName(an);
+ }
+
+ final String q = uri.getQuery();
+ final int q_l = q.length();
+ int q_e = -1;
+ while(q_e < q_l) {
+ int q_b = q_e + 1; // next term
+ q_e = q.indexOf(AMPER, q_b);
+ if(0 == q_e) {
+ // single seperator
+ continue;
+ }
+ if(0 > q_e) {
+ // end
+ q_e = q_l;
+ }
+ // n-part
+ final String part = q.substring(q_b, q_e);
+ final int assignment = part.indexOf(ASSIG);
+ if(0 < assignment) {
+ // assignment
+ final String k = part.substring(0, assignment);
+ final String v = part.substring(assignment+1);
+ if(k.equals(PKG)) {
+ if(v.length()==0) {
+ throw new IllegalArgumentException("Empty package name: part <"+part+">, query <"+q+"> of "+uri);
+ }
+ data.addPackage(v);
+ } else {
+ data.setProperty(k, v);
+ }
+ } else {
+ // property key only
+ if(part.equals(PKG)) {
+ throw new IllegalArgumentException("Empty package name: part <"+part+">, query <"+q+"> of "+uri);
+ }
+ data.setProperty(part, EMPTY);
+ }
+ }
+ data.validate();
+ return data;
+ }
+
+ public final void validate() {
+ if(null == activityName) {
+ throw new RuntimeException("Activity is not NULL");
+ }
+ if(packages.size() == 0) {
+ throw new RuntimeException("Empty package list");
+ }
+ }
+ }
+
+ public final static Intent getIntent(String action, DataSet data) {
+ data.validate();
+ return new Intent(action, data.getUri());
+ }
+
+ public static void main(String[] args) {
+ if(args.length==0) {
+ args = new String[] {
+ SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+PKG+"=jogamp.pack1&"+PKG+"=javax.pack2&"+PKG+"=com.jogamp.pack3&jogamp.common.debug=true&com.jogamp.test=false",
+ SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+PKG+"=jogamp.pack1&jogamp.common.debug=true&com.jogamp.test=false",
+ SCHEME+"://"+HOST+"/com.jogamp.TestActivity?"+PKG+"=jogamp.pack1"
+ };
+ }
+ for(int i=0; i<args.length; i++) {
+ String uri_s = args[i];
+ Uri uri0 = Uri.parse(uri_s);
+ DataSet data = DataSet.create(uri0);
+ if(null == data) {
+ System.err.println("Error: NULL JogAmpLauncherUtil: <"+uri_s+"> -> "+uri0+" -> NULL");
+ }
+ Uri uri1 = data.getUri();
+ if(!uri0.equals(uri1)) {
+ System.err.println("Error: Not equal: <"+uri_s+"> -> "+uri0+" -> "+uri1);
+ }
+ }
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivityLauncher.java
new file mode 100644
index 000000000..33e05de8d
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivityLauncher.java
@@ -0,0 +1,45 @@
+package com.jogamp.opengl.test.android;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
+
+public class NEWTElektronActivityLauncher extends LauncherUtil.BaseActivityLauncher {
+
+ static String demo = "com.jogamp.opengl.test.android.NEWTElektronActivity";
+ static String[] pkgs = new String[] { "com.jogamp.opengl.test" };
+
+ @Override
+ public void init() {
+ final OrderedProperties props = getProperties();
+ // props.setProperty("jogamp.debug.JNILibLoader", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary", "true");
+ // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ // properties.setProperty("jogamp.debug.IOUtil", "true");
+ // properties.setProperty("nativewindow.debug", "all");
+ props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // properties.setProperty("jogl.debug", "all");
+ // properties.setProperty("jogl.debug.GLProfile", "true");
+ props.setProperty("jogl.debug.GLDrawable", "true");
+ props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // properties.setProperty("jogl.debug.GLSLState", "true");
+ // properties.setProperty("jogl.debug.DebugGL", "true");
+ // properties.setProperty("jogl.debug.TraceGL", "true");
+ // properties.setProperty("newt.debug", "all");
+ props.setProperty("newt.debug.Window", "true");
+ // properties.setProperty("newt.debug.Window.MouseEvent", "true");
+ // properties.setProperty("newt.debug.Window.KeyEvent", "true");
+ }
+
+ @Override
+ public String getActivityName() {
+ return demo;
+ }
+ @Override
+ public List<String> getPackages() {
+ return Arrays.asList(pkgs);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1ActivityLauncher.java
new file mode 100644
index 000000000..d0f6263f3
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1ActivityLauncher.java
@@ -0,0 +1,44 @@
+package com.jogamp.opengl.test.android;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
+
+public class NEWTGearsES1ActivityLauncher extends LauncherUtil.BaseActivityLauncher {
+ static String demo = "com.jogamp.opengl.test.android.NEWTGearsES1Activity";
+ static String[] pkgs = new String[] { "com.jogamp.opengl.test" };
+
+ @Override
+ public void init() {
+ final OrderedProperties props = getProperties();
+ // props.setProperty("jogamp.debug.JNILibLoader", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary", "true");
+ // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ // properties.setProperty("jogamp.debug.IOUtil", "true");
+ // properties.setProperty("nativewindow.debug", "all");
+ props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // properties.setProperty("jogl.debug", "all");
+ // properties.setProperty("jogl.debug.GLProfile", "true");
+ props.setProperty("jogl.debug.GLDrawable", "true");
+ props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // properties.setProperty("jogl.debug.GLSLState", "true");
+ // properties.setProperty("jogl.debug.DebugGL", "true");
+ // properties.setProperty("jogl.debug.TraceGL", "true");
+ // properties.setProperty("newt.debug", "all");
+ props.setProperty("newt.debug.Window", "true");
+ // properties.setProperty("newt.debug.Window.MouseEvent", "true");
+ // properties.setProperty("newt.debug.Window.KeyEvent", "true");
+ }
+
+ @Override
+ public String getActivityName() {
+ return demo;
+ }
+ @Override
+ public List<String> getPackages() {
+ return Arrays.asList(pkgs);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java
new file mode 100644
index 000000000..cdfaa956d
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java
@@ -0,0 +1,72 @@
+/**
+ * Copyright 2012 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.test.android;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
+
+public class NEWTGearsES2ActivityLauncher extends LauncherUtil.BaseActivityLauncher {
+
+ static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2Activity";
+ static String[] pkgs = new String[] { "com.jogamp.opengl.test" };
+
+ @Override
+ public void init() {
+ final OrderedProperties props = getProperties();
+ // props.setProperty("jogamp.debug.JNILibLoader", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary", "true");
+ // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ // properties.setProperty("jogamp.debug.IOUtil", "true");
+ // properties.setProperty("nativewindow.debug", "all");
+ props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // properties.setProperty("jogl.debug", "all");
+ // properties.setProperty("jogl.debug.GLProfile", "true");
+ props.setProperty("jogl.debug.GLDrawable", "true");
+ props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // properties.setProperty("jogl.debug.GLSLState", "true");
+ // properties.setProperty("jogl.debug.DebugGL", "true");
+ // properties.setProperty("jogl.debug.TraceGL", "true");
+ // properties.setProperty("newt.debug", "all");
+ props.setProperty("newt.debug.Window", "true");
+ // properties.setProperty("newt.debug.Window.MouseEvent", "true");
+ // properties.setProperty("newt.debug.Window.KeyEvent", "true");
+ }
+
+ @Override
+ public String getActivityName() {
+ return demo;
+ }
+ @Override
+ public List<String> getPackages() {
+ return Arrays.asList(pkgs);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivityLauncher.java
new file mode 100644
index 000000000..0501cf55e
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivityLauncher.java
@@ -0,0 +1,49 @@
+package com.jogamp.opengl.test.android;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
+
+public class NEWTGearsES2TransActivityLauncher extends LauncherUtil.BaseActivityLauncher {
+ static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2TransActivity";
+ static String[] pkgs = new String[] { "com.jogamp.opengl.test" };
+
+ @Override
+ public void init() {
+ final OrderedProperties props = getProperties();
+ // props.setProperty("jnlp.android.translucent", "true");
+ // props.setProperty("jogamp.debug.JNILibLoader", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary", "true");
+ // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ // properties.setProperty("jogamp.debug.IOUtil", "true");
+ // properties.setProperty("nativewindow.debug", "all");
+ props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // properties.setProperty("jogl.debug", "all");
+ // properties.setProperty("jogl.debug.GLProfile", "true");
+ props.setProperty("jogl.debug.GLDrawable", "true");
+ props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // properties.setProperty("jogl.debug.GLSLState", "true");
+ // properties.setProperty("jogl.debug.DebugGL", "true");
+ // properties.setProperty("jogl.debug.TraceGL", "true");
+ // properties.setProperty("newt.debug", "all");
+ props.setProperty("newt.debug.Window", "true");
+ // properties.setProperty("newt.debug.Window.MouseEvent", "true");
+ // properties.setProperty("newt.debug.Window.KeyEvent", "true");
+ }
+
+ @Override
+ public String getActivityName() {
+ return demo;
+ }
+ @Override
+ public List<String> getPackages() {
+ return Arrays.asList(pkgs);
+ }
+ @Override
+ public String getAction() {
+ return LauncherUtil.LAUNCH_ACTIVITY_TRANSPARENT;
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivityLauncher.java
new file mode 100644
index 000000000..c75c229a8
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivityLauncher.java
@@ -0,0 +1,44 @@
+package com.jogamp.opengl.test.android;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
+
+public class NEWTGraphUI1pActivityLauncher extends LauncherUtil.BaseActivityLauncher {
+ static String demo = "com.jogamp.opengl.test.android.NEWTGraphUI1pActivity";
+ static String[] pkgs = new String[] { "com.jogamp.opengl.test" };
+
+ @Override
+ public void init() {
+ final OrderedProperties props = getProperties();
+ // props.setProperty("jogamp.debug.JNILibLoader", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary", "true");
+ // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ // properties.setProperty("jogamp.debug.IOUtil", "true");
+ // properties.setProperty("nativewindow.debug", "all");
+ props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // properties.setProperty("jogl.debug", "all");
+ // properties.setProperty("jogl.debug.GLProfile", "true");
+ props.setProperty("jogl.debug.GLDrawable", "true");
+ props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // properties.setProperty("jogl.debug.GLSLState", "true");
+ // properties.setProperty("jogl.debug.DebugGL", "true");
+ // properties.setProperty("jogl.debug.TraceGL", "true");
+ // properties.setProperty("newt.debug", "all");
+ props.setProperty("newt.debug.Window", "true");
+ // properties.setProperty("newt.debug.Window.MouseEvent", "true");
+ // properties.setProperty("newt.debug.Window.KeyEvent", "true");
+ }
+
+ @Override
+ public String getActivityName() {
+ return demo;
+ }
+ @Override
+ public List<String> getPackages() {
+ return Arrays.asList(pkgs);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivityLauncher.java
new file mode 100644
index 000000000..8f6b51484
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivityLauncher.java
@@ -0,0 +1,44 @@
+package com.jogamp.opengl.test.android;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
+
+public class NEWTGraphUI2pActivityLauncher extends LauncherUtil.BaseActivityLauncher {
+ static String demo = "com.jogamp.opengl.test.android.NEWTGraphUI2pActivity";
+ static String[] pkgs = new String[] { "com.jogamp.opengl.test" };
+
+ @Override
+ public void init() {
+ final OrderedProperties props = getProperties();
+ // props.setProperty("jogamp.debug.JNILibLoader", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary", "true");
+ // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ // properties.setProperty("jogamp.debug.IOUtil", "true");
+ // properties.setProperty("nativewindow.debug", "all");
+ props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // properties.setProperty("jogl.debug", "all");
+ // properties.setProperty("jogl.debug.GLProfile", "true");
+ props.setProperty("jogl.debug.GLDrawable", "true");
+ props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // properties.setProperty("jogl.debug.GLSLState", "true");
+ // properties.setProperty("jogl.debug.DebugGL", "true");
+ // properties.setProperty("jogl.debug.TraceGL", "true");
+ // properties.setProperty("newt.debug", "all");
+ props.setProperty("newt.debug.Window", "true");
+ // properties.setProperty("newt.debug.Window.MouseEvent", "true");
+ // properties.setProperty("newt.debug.Window.KeyEvent", "true");
+ }
+
+ @Override
+ public String getActivityName() {
+ return demo;
+ }
+ @Override
+ public List<String> getPackages() {
+ return Arrays.asList(pkgs);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1ActivityLauncher.java
new file mode 100644
index 000000000..478fe65b7
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1ActivityLauncher.java
@@ -0,0 +1,44 @@
+package com.jogamp.opengl.test.android;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
+
+public class NEWTRedSquareES1ActivityLauncher extends LauncherUtil.BaseActivityLauncher {
+ static String demo = "com.jogamp.opengl.test.android.NEWTRedSquareES1Activity";
+ static String[] pkgs = new String[] { "com.jogamp.opengl.test" };
+
+ @Override
+ public void init() {
+ final OrderedProperties props = getProperties();
+ // props.setProperty("jogamp.debug.JNILibLoader", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary", "true");
+ // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ // properties.setProperty("jogamp.debug.IOUtil", "true");
+ // properties.setProperty("nativewindow.debug", "all");
+ props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // properties.setProperty("jogl.debug", "all");
+ // properties.setProperty("jogl.debug.GLProfile", "true");
+ props.setProperty("jogl.debug.GLDrawable", "true");
+ props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // properties.setProperty("jogl.debug.GLSLState", "true");
+ // properties.setProperty("jogl.debug.DebugGL", "true");
+ // properties.setProperty("jogl.debug.TraceGL", "true");
+ // properties.setProperty("newt.debug", "all");
+ props.setProperty("newt.debug.Window", "true");
+ // properties.setProperty("newt.debug.Window.MouseEvent", "true");
+ // properties.setProperty("newt.debug.Window.KeyEvent", "true");
+ }
+
+ @Override
+ public String getActivityName() {
+ return demo;
+ }
+ @Override
+ public List<String> getPackages() {
+ return Arrays.asList(pkgs);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java
new file mode 100644
index 000000000..b6265b72b
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2ActivityLauncher.java
@@ -0,0 +1,21 @@
+package com.jogamp.opengl.test.android;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+
+public class NEWTRedSquareES2ActivityLauncher extends Activity {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ final Uri uri = Uri.parse("launch://jogamp.org/com.jogamp.opengl.test.android.NEWTRedSquareES2Activity?pkg=com.jogamp.opengl.test");
+ final Intent intent = new Intent("org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL", uri);
+ Log.d(getClass().getSimpleName(), "Launching Activity: "+intent);
+ startActivity (intent);
+
+ finish(); // done
+ }
+}