Remove checks for Activity Context when creating SearchManager

Since https://android-git.corp.google.com/g/3880
all activities create a SearchManager object, to handle
saving and restoring the search dialog. This broke
ActivityUnitTestCase, since ApplicationContext.getSearchManager()
threw an exception in non-activity contexts.
This change removes the activity context check from
getSearchManager(). Since SearchManager is now just a thin
wrapper for SearchManagerService, there shouldn't be anything
activity-specific in it.

Fixes http://b/issue?id=1926254
This commit is contained in:
Bjorn Bringert
2009-06-22 10:03:21 +01:00
parent 3e3324bae4
commit a68ca641e6

View File

@@ -1037,11 +1037,6 @@ class ApplicationContext extends Context {
}
private SearchManager getSearchManager() {
// This is only useable in Activity Contexts
if (getActivityToken() == null) {
throw new AndroidRuntimeException(
"Acquiring SearchManager objects only valid in Activity Contexts.");
}
synchronized (mSync) {
if (mSearchManager == null) {
mSearchManager = new SearchManager(getOuterContext(), mMainThread.getHandler());