diff options
author | Sven Gothel <[email protected]> | 2013-03-28 17:36:12 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-03-28 17:36:12 +0100 |
commit | a121055f9e4ac039fa820f06e9e81e5ce72e5e24 (patch) | |
tree | 0030f173e31770497ba537381c8f6ba8886eddfc /src | |
parent | a211a2e84e3f69d511a43e8673b6beda779c6a12 (diff) |
NEWTGearsES2Activity*: Adding property to enable 'process kill' behavior (memory and killSelf)
Diffstat (limited to 'src')
-rw-r--r-- | src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java | 34 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java | 4 |
2 files changed, 37 insertions, 1 deletions
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java index e45df5eae..542912c08 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java @@ -27,6 +27,10 @@ */ package com.jogamp.opengl.test.android; +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.util.ArrayList; + import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; @@ -49,6 +53,7 @@ public class NEWTGearsES2Activity extends NewtBaseActivity { static final String forceRGBA5650 = "demo.force.rgba5650"; static final String forceECT = "demo.force.ect"; + static final String forceKillProcessTest = "demo.force.killProcessTest"; @Override public void onCreate(Bundle savedInstanceState) { @@ -76,6 +81,35 @@ public class NEWTGearsES2Activity extends NewtBaseActivity { System.err.println("ScreenMode Changed: "+sm); } }); + if( null != System.getProperty(forceKillProcessTest) ) { + Log.d(TAG, "forceKillProcessTest"); + glWindow.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + if( e.getPointerCount() == 3 ) { + Log.d(TAG, "MemoryHog"); + new Thread(new Runnable() { + public void run() { + ArrayList<Buffer> buffers = new ArrayList<Buffer>(); + while(true) { + final int halfMB = 512 * 1024; + final float osizeMB = buffers.size() * 0.5f; + final float nsizeMB = osizeMB + 0.5f; + System.err.println("MemoryHog: ****** +4k: "+osizeMB+" MB +"+nsizeMB+" MB - Try"); + buffers.add(ByteBuffer.allocateDirect(halfMB)); // 0.5 MB each + System.err.println("MemoryHog: ****** +4k: "+osizeMB+" MB +"+nsizeMB+" MB - Done"); + try { + Thread.sleep(500); + } catch (Exception e) {}; + } + } }, "MemoryHog").start(); + } else if( e.getPointerCount() == 4 ) { + Log.d(TAG, "ForceKill"); + android.os.Process.killProcess( android.os.Process.myPid() ); + } + } + }); + } Animator animator = new Animator(glWindow); // animator.setRunAsFastAsPossible(true); // glWindow.setSkipContextReleaseThread(animator.getThread()); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java index af5b70776..5e7a5c489 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java @@ -60,7 +60,9 @@ public class NEWTGearsES2ActivityLauncher extends LauncherUtil.BaseActivityLaunc props.setProperty("newt.debug.Window", "true"); props.setProperty("newt.debug.Window.MouseEvent", "true"); props.setProperty("newt.debug.Window.KeyEvent", "true"); - // props.setProperty("newt.debug.Android.MouseEvent", "true"); + // props.setProperty("newt.debug.Android.MouseEvent", "true"); + + // props.setProperty("demo.force.killProcessTest", "true"); } @Override |