summaryrefslogtreecommitdiffstats
path: root/core/java/android/service/dreams
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2012-08-10 01:19:03 -0400
committerDaniel Sandler <dsandler@android.com>2012-08-10 01:19:03 -0400
commita2fbe53f1e59a9b015d27213fbc8588883f4d408 (patch)
treee7052e603ad015ac54ac7e9f8c959148c9f521a8 /core/java/android/service/dreams
parent7c46e4380e6c50c30aad80807f87af25f000c7ff (diff)
downloadframeworks_base-a2fbe53f1e59a9b015d27213fbc8588883f4d408.zip
frameworks_base-a2fbe53f1e59a9b015d27213fbc8588883f4d408.tar.gz
frameworks_base-a2fbe53f1e59a9b015d27213fbc8588883f4d408.tar.bz2
More termination conditions for Dreams.
Default implementation of Dreams will finish() on KEYCODE_BACK. PhoneStatusBar will awaken() from any Dream when the Home key is pressed. Change-Id: I55e2a5d533a7fb93debc4c54514dba3b9098f009
Diffstat (limited to 'core/java/android/service/dreams')
-rw-r--r--core/java/android/service/dreams/Dream.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/java/android/service/dreams/Dream.java b/core/java/android/service/dreams/Dream.java
index 9a903e4..1aa7856 100644
--- a/core/java/android/service/dreams/Dream.java
+++ b/core/java/android/service/dreams/Dream.java
@@ -70,7 +70,13 @@ public class Dream extends Service implements Window.Callback {
// begin Window.Callback methods
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
- if (!mInteractive) {
+ // TODO: create more flexible version of mInteractive that allows use of KEYCODE_BACK
+ if (!mInteractive) {
+ if (DEBUG) Slog.v(TAG, "finishing on keyEvent");
+ finish();
+ return true;
+ } else if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
+ if (DEBUG) Slog.v(TAG, "finishing on back key");
finish();
return true;
}
@@ -80,6 +86,7 @@ public class Dream extends Service implements Window.Callback {
@Override
public boolean dispatchKeyShortcutEvent(KeyEvent event) {
if (!mInteractive) {
+ if (DEBUG) Slog.v(TAG, "finishing on keyShortcutEvent");
finish();
return true;
}
@@ -88,7 +95,10 @@ public class Dream extends Service implements Window.Callback {
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
+ // TODO: create more flexible version of mInteractive that allows clicks
+ // but finish()es on any other kind of activity
if (!mInteractive) {
+ if (DEBUG) Slog.v(TAG, "finishing on touchEvent");
finish();
return true;
}
@@ -97,7 +107,8 @@ public class Dream extends Service implements Window.Callback {
@Override
public boolean dispatchTrackballEvent(MotionEvent event) {
- if (!mInteractive) {
+ if (!mInteractive) {
+ if (DEBUG) Slog.v(TAG, "finishing on trackballEvent");
finish();
return true;
}
@@ -107,6 +118,7 @@ public class Dream extends Service implements Window.Callback {
@Override
public boolean dispatchGenericMotionEvent(MotionEvent event) {
if (!mInteractive) {
+ if (DEBUG) Slog.v(TAG, "finishing on genericMotionEvent");
finish();
return true;
}