Merge change 2089 into donut
* changes: Update searchables list in getSearchablesInGlobalSearch().
This commit is contained in:
@@ -37,9 +37,6 @@ public class SearchManagerService extends ISearchManager.Stub
|
|||||||
// general debugging support
|
// general debugging support
|
||||||
private static final String TAG = "SearchManagerService";
|
private static final String TAG = "SearchManagerService";
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
// configuration choices
|
|
||||||
private static final boolean IMMEDIATE_SEARCHABLES_UPDATE = true;
|
|
||||||
|
|
||||||
// class maintenance and general shared data
|
// class maintenance and general shared data
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
@@ -70,9 +67,7 @@ public class SearchManagerService extends ISearchManager.Stub
|
|||||||
|
|
||||||
// After startup settles down, preload the searchables list,
|
// After startup settles down, preload the searchables list,
|
||||||
// which will reduce the delay when the search UI is invoked.
|
// 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_REMOVED) ||
|
||||||
action.equals(Intent.ACTION_PACKAGE_CHANGED)) {
|
action.equals(Intent.ACTION_PACKAGE_CHANGED)) {
|
||||||
mSearchablesDirty = true;
|
mSearchablesDirty = true;
|
||||||
if (IMMEDIATE_SEARCHABLES_UPDATE) {
|
mHandler.post(mRunUpdateSearchable);
|
||||||
mHandler.post(mRunUpdateSearchable);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,9 +97,7 @@ public class SearchManagerService extends ISearchManager.Stub
|
|||||||
*/
|
*/
|
||||||
private Runnable mRunUpdateSearchable = new Runnable() {
|
private Runnable mRunUpdateSearchable = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mSearchablesDirty) {
|
updateSearchablesIfDirty();
|
||||||
updateSearchables();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -119,6 +110,15 @@ public class SearchManagerService extends ISearchManager.Stub
|
|||||||
mSearchablesDirty = false;
|
mSearchablesDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the list of searchables if needed.
|
||||||
|
*/
|
||||||
|
private void updateSearchablesIfDirty() {
|
||||||
|
if (mSearchablesDirty) {
|
||||||
|
updateSearchables();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the SearchableInfo for a given activity
|
* Returns the SearchableInfo for a given activity
|
||||||
*
|
*
|
||||||
@@ -131,11 +131,7 @@ public class SearchManagerService extends ISearchManager.Stub
|
|||||||
* or null if no searchable metadata was available.
|
* or null if no searchable metadata was available.
|
||||||
*/
|
*/
|
||||||
public SearchableInfo getSearchableInfo(ComponentName launchActivity, boolean globalSearch) {
|
public SearchableInfo getSearchableInfo(ComponentName launchActivity, boolean globalSearch) {
|
||||||
// final check. however we should try to avoid this, because
|
updateSearchablesIfDirty();
|
||||||
// it slows down the entry into the UI.
|
|
||||||
if (mSearchablesDirty) {
|
|
||||||
updateSearchables();
|
|
||||||
}
|
|
||||||
SearchableInfo si = null;
|
SearchableInfo si = null;
|
||||||
if (globalSearch) {
|
if (globalSearch) {
|
||||||
si = mSearchables.getDefaultSearchable();
|
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.
|
* Returns a list of the searchable activities that can be included in global search.
|
||||||
*/
|
*/
|
||||||
public List<SearchableInfo> getSearchablesInGlobalSearch() {
|
public List<SearchableInfo> getSearchablesInGlobalSearch() {
|
||||||
|
updateSearchablesIfDirty();
|
||||||
return mSearchables.getSearchablesInGlobalSearchList();
|
return mSearchables.getSearchablesInGlobalSearchList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user