diff options
author | Kenny Root <kenny@the-b.org> | 2010-05-04 13:12:57 +0000 |
---|---|---|
committer | Kenny Root <kenny@the-b.org> | 2010-05-04 13:12:57 +0000 |
commit | f5d392e3a334d230fb782a1faff37bda8153750f (patch) | |
tree | 1743c7a0556713e2005a766967a1650f4d94c52d /src | |
parent | b8ec5e60fd3231c1fe96c3fc7dbd9cc2e640ce4d (diff) | |
download | connectbot-f5d392e3a334d230fb782a1faff37bda8153750f.tar.gz connectbot-f5d392e3a334d230fb782a1faff37bda8153750f.tar.bz2 connectbot-f5d392e3a334d230fb782a1faff37bda8153750f.zip |
Proper use of wakelocks in pause/resume
git-svn-id: https://connectbot.googlecode.com/svn/trunk/connectbot@501 df292f66-193f-0410-a5fc-6d59da041ff2
Diffstat (limited to 'src')
-rw-r--r-- | src/org/connectbot/ConsoleActivity.java | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java index 7dd336b..0240131 100644 --- a/src/org/connectbot/ConsoleActivity.java +++ b/src/org/connectbot/ConsoleActivity.java @@ -20,8 +20,6 @@ package org.connectbot; import java.lang.ref.WeakReference; import java.util.List; -import org.connectbot.bean.HostBean; -import org.connectbot.bean.PortForwardBean; import org.connectbot.bean.SelectionArea; import org.connectbot.service.PromptHelper; import org.connectbot.service.TerminalBridge; @@ -780,11 +778,6 @@ public class ConsoleActivity extends Activity { // connect with manager service to find all bridges // when connected it will insert all views bindService(new Intent(this, TerminalManager.class), connection, Context.BIND_AUTO_CREATE); - - // make sure we dont let the screen fall asleep - // this also keeps the wifi chipset from disconnecting us - if(wakelock != null && prefs.getBoolean(PreferenceConstants.KEEP_ALIVE, true)) - wakelock.acquire(); } @Override @@ -792,6 +785,10 @@ public class ConsoleActivity extends Activity { super.onPause(); Log.d(TAG, "onPause called"); + // Allow the screen to dim and fall asleep. + if (wakelock != null && wakelock.isHeld()) + wakelock.release(); + if (forcedOrientation && bound != null) bound.setResizeAllowed(false); } @@ -801,6 +798,11 @@ public class ConsoleActivity extends Activity { super.onResume(); Log.d(TAG, "onResume called"); + // Make sure we don't let the screen fall asleep. + // This also keeps the Wi-Fi chipset from disconnecting us. + if (wakelock != null && prefs.getBoolean(PreferenceConstants.KEEP_ALIVE, true)) + wakelock.acquire(); + configureOrientation(); if (forcedOrientation && bound != null) @@ -860,10 +862,6 @@ public class ConsoleActivity extends Activity { super.onStop(); unbindService(connection); - - // allow the screen to dim and fall asleep - if(wakelock != null && wakelock.isHeld()) - wakelock.release(); } protected void shiftCurrentTerminal(final int direction) { |