diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-20 11:15:05 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-05-20 11:15:05 -0700 |
commit | 40f5a4ea3bc90e43a442ab336f2342020bba86b3 (patch) | |
tree | e7f61f821d549fd73f1b535ba65d6860bd674993 | |
parent | a5ca3425f9cbb930dc62559893590432ed29c961 (diff) | |
parent | a48a5af931f2fb43c948416180b85dfe9ecdc9a1 (diff) | |
download | frameworks_base-40f5a4ea3bc90e43a442ab336f2342020bba86b3.zip frameworks_base-40f5a4ea3bc90e43a442ab336f2342020bba86b3.tar.gz frameworks_base-40f5a4ea3bc90e43a442ab336f2342020bba86b3.tar.bz2 |
Merge change 2089 into donut
* changes:
Update searchables list in getSearchablesInGlobalSearch().
-rw-r--r-- | core/java/android/server/search/SearchManagerService.java | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/core/java/android/server/search/SearchManagerService.java b/core/java/android/server/search/SearchManagerService.java index 03623d6..952372f 100644 --- a/core/java/android/server/search/SearchManagerService.java +++ b/core/java/android/server/search/SearchManagerService.java @@ -37,9 +37,6 @@ public class SearchManagerService extends ISearchManager.Stub // general debugging support private static final String TAG = "SearchManagerService"; private static final boolean DEBUG = false; - - // configuration choices - private static final boolean IMMEDIATE_SEARCHABLES_UPDATE = true; // class maintenance and general shared data private final Context mContext; @@ -70,9 +67,7 @@ public class SearchManagerService extends ISearchManager.Stub // After startup settles down, preload the searchables list, // which will reduce the delay when the search UI is invoked. - if (IMMEDIATE_SEARCHABLES_UPDATE) { - mHandler.post(mRunUpdateSearchable); - } + mHandler.post(mRunUpdateSearchable); } /** @@ -91,9 +86,7 @@ public class SearchManagerService extends ISearchManager.Stub action.equals(Intent.ACTION_PACKAGE_REMOVED) || action.equals(Intent.ACTION_PACKAGE_CHANGED)) { mSearchablesDirty = true; - if (IMMEDIATE_SEARCHABLES_UPDATE) { - mHandler.post(mRunUpdateSearchable); - } + mHandler.post(mRunUpdateSearchable); return; } } @@ -104,9 +97,7 @@ public class SearchManagerService extends ISearchManager.Stub */ private Runnable mRunUpdateSearchable = new Runnable() { public void run() { - if (mSearchablesDirty) { - updateSearchables(); - } + updateSearchablesIfDirty(); } }; @@ -120,6 +111,15 @@ public class SearchManagerService extends ISearchManager.Stub } /** + * Updates the list of searchables if needed. + */ + private void updateSearchablesIfDirty() { + if (mSearchablesDirty) { + updateSearchables(); + } + } + + /** * Returns the SearchableInfo for a given activity * * @param launchActivity The activity from which we're launching this search. @@ -131,11 +131,7 @@ public class SearchManagerService extends ISearchManager.Stub * or null if no searchable metadata was available. */ public SearchableInfo getSearchableInfo(ComponentName launchActivity, boolean globalSearch) { - // final check. however we should try to avoid this, because - // it slows down the entry into the UI. - if (mSearchablesDirty) { - updateSearchables(); - } + updateSearchablesIfDirty(); SearchableInfo si = null; if (globalSearch) { si = mSearchables.getDefaultSearchable(); @@ -150,6 +146,7 @@ public class SearchManagerService extends ISearchManager.Stub * Returns a list of the searchable activities that can be included in global search. */ public List<SearchableInfo> getSearchablesInGlobalSearch() { + updateSearchablesIfDirty(); return mSearchables.getSearchablesInGlobalSearchList(); } |