aboutsummaryrefslogtreecommitdiffstats
path: root/src/org
diff options
context:
space:
mode:
authorKenny Root <kenny@the-b.org>2010-09-28 06:47:15 -0500
committerKenny Root <kenny@the-b.org>2010-09-28 14:50:03 -0500
commit0cac01d92a0a3e9a420047a30e4bc5e5a4f69c3d (patch)
tree36e69706204c123e3afed8eb714bc8470f875973 /src/org
parent7a35c56565153d4f269df0ee6ded15360e065548 (diff)
downloadconnectbot-0cac01d92a0a3e9a420047a30e4bc5e5a4f69c3d.tar.gz
connectbot-0cac01d92a0a3e9a420047a30e4bc5e5a4f69c3d.tar.bz2
connectbot-0cac01d92a0a3e9a420047a30e4bc5e5a4f69c3d.zip
Remove WAKE_LOCK permission; yay
Use window flags instead of a wake lock to keep the screen on. This allows us to make the WindowManager do all the wake lockey things that are annoying and error prone.
Diffstat (limited to 'src/org')
-rw-r--r--src/org/connectbot/ConsoleActivity.java17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/org/connectbot/ConsoleActivity.java b/src/org/connectbot/ConsoleActivity.java
index 2b5cbb4..f0d930f 100644
--- a/src/org/connectbot/ConsoleActivity.java
+++ b/src/org/connectbot/ConsoleActivity.java
@@ -44,7 +44,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
-import android.os.PowerManager;
import android.preference.PreferenceManager;
import android.text.ClipboardManager;
import android.util.Log;
@@ -99,8 +98,6 @@ public class ConsoleActivity extends Activity {
private SharedPreferences prefs = null;
- private PowerManager.WakeLock wakelock = null;
-
protected Uri requested;
protected ClipboardManager clipboard;
@@ -278,9 +275,6 @@ public class ConsoleActivity extends Activity {
// TODO find proper way to disable volume key beep if it exists.
setVolumeControlStream(AudioManager.STREAM_MUSIC);
- PowerManager manager = (PowerManager)getSystemService(Context.POWER_SERVICE);
- wakelock = manager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, TAG);
-
// handle requested console from incoming intent
requested = getIntent().getData();
@@ -817,10 +811,6 @@ 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);
}
@@ -832,8 +822,11 @@ public class ConsoleActivity extends Activity {
// 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();
+ if (prefs.getBoolean(PreferenceConstants.KEEP_ALIVE, true)) {
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ } else {
+ getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+ }
configureOrientation();