From 1dc1ccaf5c8cc136b71537f310a3f13150aaef41 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 28 Jul 2009 17:51:07 -0700 Subject: Fix issue #1999179: search -> click result -> press home = search dialog is shown then hidden Re-arrange various things to ensure that the search dialog is told about system windows being closed before it is told about the navigation back to home. --- mid/com/android/internal/policy/impl/MidWindowManager.java | 7 +++---- phone/com/android/internal/policy/impl/PhoneWindow.java | 2 +- .../android/internal/policy/impl/PhoneWindowManager.java | 14 +++++++------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/mid/com/android/internal/policy/impl/MidWindowManager.java b/mid/com/android/internal/policy/impl/MidWindowManager.java index 6bf399f..2bff15b 100644 --- a/mid/com/android/internal/policy/impl/MidWindowManager.java +++ b/mid/com/android/internal/policy/impl/MidWindowManager.java @@ -973,11 +973,10 @@ public class MidWindowManager implements WindowManagerPolicy { } private void sendCloseSystemWindows(String reason) { - Intent intent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); - if (reason != null) { - intent.putExtra(SYSTEM_DIALOG_REASON_KEY, reason); + try { + ActivityManagerNative.getDefault().closeSystemDialogs(reason); + } catch (RemoteException e) { } - mContext.sendBroadcast(intent); } public int rotationForOrientationLw(int orientation, int lastRotation, diff --git a/phone/com/android/internal/policy/impl/PhoneWindow.java b/phone/com/android/internal/policy/impl/PhoneWindow.java index db43a9c..6341771 100644 --- a/phone/com/android/internal/policy/impl/PhoneWindow.java +++ b/phone/com/android/internal/policy/impl/PhoneWindow.java @@ -239,11 +239,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (!mKeycodeCameraTimeoutActive) return; mKeycodeCameraTimeoutActive = false; mDecor.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); + sendCloseSystemWindows(); // Broadcast an intent that the Camera button was longpressed Intent intent = new Intent(Intent.ACTION_CAMERA_BUTTON, null); intent.putExtra(Intent.EXTRA_KEY_EVENT, (KeyEvent) msg.obj); getContext().sendOrderedBroadcast(intent, null); - sendCloseSystemWindows(); } break; case MSG_SEARCH_LONG_PRESS_COMPLETE: { if (getKeyguardManager().inKeyguardRestrictedInputMode() || diff --git a/phone/com/android/internal/policy/impl/PhoneWindowManager.java b/phone/com/android/internal/policy/impl/PhoneWindowManager.java index 0392c7e..8140b3d 100644 --- a/phone/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/phone/com/android/internal/policy/impl/PhoneWindowManager.java @@ -954,8 +954,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { ActivityManagerNative.getDefault().stopAppSwitches(); } catch (RemoteException e) { } - mContext.startActivity(mHomeIntent); sendCloseSystemWindows(); + mContext.startActivity(mHomeIntent); } } }); @@ -965,8 +965,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { ActivityManagerNative.getDefault().stopAppSwitches(); } catch (RemoteException e) { } - mContext.startActivity(mHomeIntent); sendCloseSystemWindows(); + mContext.startActivity(mHomeIntent); } } @@ -1700,11 +1700,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { static void sendCloseSystemWindows(Context context, String reason) { if (ActivityManagerNative.isSystemReady()) { - Intent intent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); - if (reason != null) { - intent.putExtra(SYSTEM_DIALOG_REASON_KEY, reason); + try { + ActivityManagerNative.getDefault().closeSystemDialogs(reason); + } catch (RemoteException e) { } - context.sendBroadcast(intent); } } @@ -1816,12 +1815,14 @@ public class PhoneWindowManager implements WindowManagerPolicy { ActivityManagerNative.getDefault().stopAppSwitches(); } catch (RemoteException e) { } + sendCloseSystemWindows(); mContext.startActivity(mHomeIntent); } else { // This code brings home to the front or, if it is already // at the front, puts the device to sleep. try { ActivityManagerNative.getDefault().stopAppSwitches(); + sendCloseSystemWindows(); int result = ActivityManagerNative.getDefault() .startActivity(null, mHomeIntent, mHomeIntent.resolveTypeIfNeeded(mContext.getContentResolver()), @@ -1833,7 +1834,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { // bummer, the activity manager, which is in this process, is dead } } - sendCloseSystemWindows(); return true; } -- cgit v1.2.3