summaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-08-23 21:09:23 +0200
committerSven Gothel <[email protected]>2012-08-23 21:09:23 +0200
commit8516fe0358805e8549a96cde785dfa7ac2576e87 (patch)
treef4d4a3d50b4da5ff7cc750fa43246f007611d7e7 /src/newt/classes/jogamp
parentab3ec08822e7958943686a7ba5157a4ff314e7ac (diff)
Fix Android Power-suspend and Power-resume
NewtBaseActivity onPause()/onResume(): add setVisible(..) allowing recreation and avoid usage of unavail resources - crucial for power suspend/resume, which itself calls activity onPause()/onResume(), this ensures resources are not used onPause(). - Animator suspend is not sufficient due to surfaceRedrawNeeded(..) hook etc .. - iff power suspend leads to surfaceDestroyed(..), recreation is now possible due to setVisible(true) on onResume() even though I have not observed this on Android 2.3 and 4.0.1 Tested on Android 2.3 and Android 4.0.1
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
index 91c589beb..28c4da72f 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
@@ -265,16 +265,17 @@ public class NewtBaseActivity extends Activity {
if(!isDelegatedActivity()) {
super.onResume();
}
- if(null != animator) {
- animator.resume();
- animator.resetFPSCounter();
- }
- for(int i=newtWindows.size()-1; i>=0; i--) {
+ for(int i=0; i<newtWindows.size(); i++) {
final Window win = newtWindows.get(i);
+ win.setVisible(true);
if(win instanceof FPSCounter) {
((FPSCounter)win).resetFPSCounter();
}
}
+ if(null != animator) {
+ animator.resume();
+ animator.resetFPSCounter();
+ }
}
@Override
@@ -283,6 +284,10 @@ public class NewtBaseActivity extends Activity {
if(null != animator) {
animator.pause();
}
+ for(int i=0; i<newtWindows.size(); i++) {
+ final Window win = newtWindows.get(i);
+ win.setVisible(false);
+ }
if(!isDelegatedActivity()) {
super.onPause();
}