From ffa424800d0338b8b894aef2ea1e3e3344cbda7a Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Wed, 23 Sep 2009 22:20:11 -0700 Subject: [PATCH] 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 --- api/current.xml | 35 +++++++++++++++++++ .../java/android/content/pm/ActivityInfo.java | 10 +++++- .../android/content/pm/PackageParser.java | 6 ++++ core/java/android/view/IWindow.aidl | 2 ++ core/java/android/view/IWindowManager.aidl | 2 ++ core/java/android/view/View.java | 7 ++++ core/java/android/view/ViewRoot.java | 20 +++++++++++ .../android/internal/view/BaseIWindow.java | 3 ++ core/res/AndroidManifest.xml | 1 + core/res/res/anim/task_close_enter.xml | 11 ++++-- core/res/res/anim/task_close_exit.xml | 11 ++---- core/res/res/anim/task_open_enter.xml | 11 ++---- core/res/res/anim/task_open_exit.xml | 11 ++++-- core/res/res/values/attrs_manifest.xml | 7 ++++ core/res/res/values/config.xml | 2 +- core/res/res/values/public.xml | 1 + core/res/res/values/styles.xml | 14 -------- .../android/server/WindowManagerService.java | 14 ++++++++ .../server/am/ActivityManagerService.java | 10 ++++++ .../com/android/layoutlib/bridge/Bridge.java | 12 ++++++- 20 files changed, 151 insertions(+), 39 deletions(-) diff --git a/api/current.xml b/api/current.xml index 36a82a8151d1f..b5352d111debd 100644 --- a/api/current.xml +++ b/api/current.xml @@ -3573,6 +3573,17 @@ visibility="public" > + + + + + + + + diff --git a/core/res/res/anim/task_close_enter.xml b/core/res/res/anim/task_close_enter.xml index 303cfd6827381..c42ad830db901 100644 --- a/core/res/res/anim/task_close_enter.xml +++ b/core/res/res/anim/task_close_enter.xml @@ -18,9 +18,14 @@ --> + android:interpolator="@anim/decelerate_interpolator" + android:zAdjustment="top"> + + diff --git a/core/res/res/anim/task_close_exit.xml b/core/res/res/anim/task_close_exit.xml index a28ac3ba902a6..66d34808ddcd3 100644 --- a/core/res/res/anim/task_close_exit.xml +++ b/core/res/res/anim/task_close_exit.xml @@ -18,12 +18,7 @@ --> - - + android:interpolator="@anim/decelerate_interpolator"> + diff --git a/core/res/res/anim/task_open_enter.xml b/core/res/res/anim/task_open_enter.xml index 234abb23cbcda..66adf9fa6801c 100644 --- a/core/res/res/anim/task_open_enter.xml +++ b/core/res/res/anim/task_open_enter.xml @@ -18,12 +18,7 @@ --> - - + android:interpolator="@anim/decelerate_interpolator"> + diff --git a/core/res/res/anim/task_open_exit.xml b/core/res/res/anim/task_open_exit.xml index db331b156c98b..4a2cef431031b 100644 --- a/core/res/res/anim/task_open_exit.xml +++ b/core/res/res/anim/task_open_exit.xml @@ -18,9 +18,14 @@ --> + android:interpolator="@anim/decelerate_interpolator" + android:zAdjustment="top"> + + diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 365363a4f41cd..85f5ce315c0d6 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -288,6 +288,12 @@ ignored and the activity simply finished. --> + + + - 250 + 200 400 diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 305e415e793cb..257e0f25f3a00 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1171,6 +1171,7 @@ + diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 6426080f7b6bc..47c68adee937e 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -58,19 +58,6 @@ @anim/activity_open_exit @anim/activity_close_enter @anim/activity_close_exit - @anim/activity_open_enter - @anim/activity_open_exit - @anim/activity_close_enter - @anim/activity_close_exit - @anim/activity_open_enter - @anim/activity_open_exit - @anim/activity_close_enter - @anim/activity_close_exit - - - @anim/wallpaper_open_enter @anim/wallpaper_open_exit @anim/wallpaper_close_enter diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index f742f9fa023e0..2c39c2a688ebe 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -3913,6 +3913,20 @@ public class WindowManagerService extends IWindowManager.Stub return mPolicy.inKeyguardRestrictedKeyInputMode(); } + public void closeSystemDialogs(String reason) { + synchronized(mWindowMap) { + for (int i=mWindows.size()-1; i>=0; i--) { + WindowState w = (WindowState)mWindows.get(i); + if (w.mSurface != null) { + try { + w.mClient.closeSystemDialogs(reason); + } catch (RemoteException e) { + } + } + } + } + } + static float fixScale(float scale) { if (scale < 0) scale = 0; else if (scale > 20) scale = 20; diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 8ea222178b222..750c44e4d2dd0 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -4957,6 +4957,16 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } mWatchers.finishBroadcast(); + mWindowManager.closeSystemDialogs(reason); + + for (i=mHistory.size()-1; i>=0; i--) { + HistoryRecord r = (HistoryRecord)mHistory.get(i); + if ((r.info.flags&ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS) != 0) { + finishActivityLocked(r, i, + Activity.RESULT_CANCELED, null, "close-sys"); + } + } + broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null, false, false, -1, uid); } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java index e4ff4942e1bc8..d28a15149ec9b 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java @@ -1067,7 +1067,12 @@ public final class Bridge implements ILayoutBridge { public void wallpaperOffsetsComplete(IBinder window) { // pass for now. } - + + @SuppressWarnings("unused") + public void closeSystemDialogs(String reason) { + // pass for now. + } + public IBinder asBinder() { // pass for now. return null; @@ -1126,6 +1131,11 @@ public final class Bridge implements ILayoutBridge { // pass for now. } + @SuppressWarnings("unused") + public void closeSystemDialogs(String reason) { + // pass for now. + } + public IBinder asBinder() { // pass for now. return null;