summaryrefslogtreecommitdiffstats
path: root/core/java/android/view
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-09-23 22:20:11 -0700
committerDianne Hackborn <hackbod@google.com>2009-09-23 23:17:07 -0700
commitffa424800d0338b8b894aef2ea1e3e3344cbda7a (patch)
tree93a2e14b145042fe8fdd9fccef26303c55341272 /core/java/android/view
parentf11cc96ee837f8b0d530f3a5dd78ffc358727411 (diff)
downloadframeworks_base-ffa424800d0338b8b894aef2ea1e3e3344cbda7a.zip
frameworks_base-ffa424800d0338b8b894aef2ea1e3e3344cbda7a.tar.gz
frameworks_base-ffa424800d0338b8b894aef2ea1e3e3344cbda7a.tar.bz2
Fix issue #2133206: dialogs/menus should auto-dismiss when screen turns off
Lot of infrastructure for more things to go away when "clear system dialogs" happens, and now do this when we turn on the lock screen. Change-Id: I567130296fe47ce82df065ed58ef21b37416ceaf
Diffstat (limited to 'core/java/android/view')
-rw-r--r--core/java/android/view/IWindow.aidl2
-rw-r--r--core/java/android/view/IWindowManager.aidl2
-rw-r--r--core/java/android/view/View.java7
-rw-r--r--core/java/android/view/ViewRoot.java20
4 files changed, 31 insertions, 0 deletions
diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl
index b7953af..7977578 100644
--- a/core/java/android/view/IWindow.aidl
+++ b/core/java/android/view/IWindow.aidl
@@ -57,6 +57,8 @@ oneway interface IWindow {
*/
void windowFocusChanged(boolean hasFocus, boolean inTouchMode);
+ void closeSystemDialogs(String reason);
+
/**
* Called for wallpaper windows when their offsets change.
*/
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index 3e6cdc2..7d1872a 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -90,6 +90,8 @@ interface IWindowManager
void exitKeyguardSecurely(IOnKeyguardExitResult callback);
boolean inKeyguardRestrictedInputMode();
+ void closeSystemDialogs(String reason);
+
// These can only be called with the SET_ANIMATON_SCALE permission.
float getAnimationScale(int which);
float[] getAnimationScales();
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 6ff0fc8..642f0fa 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -8099,6 +8099,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
}
/**
+ * This needs to be a better API (NOT ON VIEW) before it is exposed. If
+ * it is ever exposed at all.
+ */
+ public void onCloseSystemDialogs(String reason) {
+ }
+
+ /**
* Given a Drawable whose bounds have been set to draw into this view,
* update a Region being computed for {@link #gatherTransparentRegion} so
* that any non-transparent parts of the Drawable are removed from the
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index c6937a3..398abf8 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -1610,6 +1610,7 @@ public final class ViewRoot extends Handler implements ViewParent,
public final static int DISPATCH_KEY_FROM_IME = 1011;
public final static int FINISH_INPUT_CONNECTION = 1012;
public final static int CHECK_FOCUS = 1013;
+ public final static int CLOSE_SYSTEM_DIALOGS = 1014;
@Override
public void handleMessage(Message msg) {
@@ -1867,6 +1868,11 @@ public final class ViewRoot extends Handler implements ViewParent,
imm.checkFocus();
}
} break;
+ case CLOSE_SYSTEM_DIALOGS: {
+ if (mView != null) {
+ mView.onCloseSystemDialogs((String)msg.obj);
+ }
+ } break;
}
}
@@ -2630,6 +2636,13 @@ public final class ViewRoot extends Handler implements ViewParent,
sendMessage(msg);
}
+ public void dispatchCloseSystemDialogs(String reason) {
+ Message msg = Message.obtain();
+ msg.what = CLOSE_SYSTEM_DIALOGS;
+ msg.obj = reason;
+ sendMessage(msg);
+ }
+
/**
* The window is getting focus so if there is anything focused/selected
* send an {@link AccessibilityEvent} to announce that.
@@ -2869,6 +2882,13 @@ public final class ViewRoot extends Handler implements ViewParent,
}
}
+ public void closeSystemDialogs(String reason) {
+ final ViewRoot viewRoot = mViewRoot.get();
+ if (viewRoot != null) {
+ viewRoot.dispatchCloseSystemDialogs(reason);
+ }
+ }
+
public void dispatchWallpaperOffsets(float x, float y, boolean sync) {
if (sync) {
try {