OSDN Git Service

Don't enforce that search dialog is a singleton.
authorBjorn Bringert <bringert@android.com>
Mon, 8 Jun 2009 22:20:15 +0000 (23:20 +0100)
committerBjorn Bringert <bringert@android.com>
Mon, 8 Jun 2009 22:20:15 +0000 (23:20 +0100)
There was code in PhoneWindowManager from last time when
the search dialog was a system dialog that caused an exception
if the search was added to the window manager twice.
Generally there should only be one search bar, but because
window manager calls are asynchronous and don't execute in order,
we can't be sure that a call to stopSearch() has removed the search
dialog before a subsequent call to startSearch() tries to add it again.

SearchManagerTest.testSearchManagerFastInvocations() crashed the system
process before this change.

phone/com/android/internal/policy/impl/PhoneWindowManager.java

index 6c66b3f..afad7bb 100644 (file)
@@ -160,7 +160,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
     
     boolean mSafeMode;
     WindowState mStatusBar = null;
-    WindowState mSearchBar = null;
     WindowState mKeyguard = null;
     KeyguardViewMediator mKeyguardMediator;
     GlobalActions mGlobalActions;
@@ -702,7 +701,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
      * Currently enforces that three window types are singletons:
      * <ul>
      * <li>STATUS_BAR_TYPE</li>
-     * <li>SEARCH_BAR_TYPE</li>
      * <li>KEYGUARD_TYPE</li>
      * </ul>
      * 
@@ -719,12 +717,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                 }
                 mStatusBar = win;
                 break;
-            case TYPE_SEARCH_BAR:
-                if (mSearchBar != null) {
-                    return WindowManagerImpl.ADD_MULTIPLE_SINGLETON;
-                }
-                mSearchBar = win;
-                break;
             case TYPE_KEYGUARD:
                 if (mKeyguard != null) {
                     return WindowManagerImpl.ADD_MULTIPLE_SINGLETON;
@@ -740,9 +732,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
         if (mStatusBar == win) {
             mStatusBar = null;
         }
-        else if (mSearchBar == win) {
-            mSearchBar = null;
-        }
         else if (mKeyguard == win) {
             mKeyguard = null;
         }