NPE in SearchManager.triggerSearch

mAssociatedPackage field is never initialized and cause NPE.

Change-Id: Ibf0d44b2170b7cbfe4a883008254a086e03579c5
This commit is contained in:
You Kim
2013-08-29 02:44:56 +09:00
parent f39abeb4c4
commit eb7b408ac7

View File

@@ -435,11 +435,6 @@ public class SearchManager
private final Context mContext;
/**
* The package associated with this seach manager.
*/
private String mAssociatedPackage;
// package private since they are used by the inner class SearchManagerCallback
/* package */ final Handler mHandler;
/* package */ OnDismissListener mDismissListener = null;
@@ -633,10 +628,6 @@ public class SearchManager
public void triggerSearch(String query,
ComponentName launchActivity,
Bundle appSearchData) {
if (!mAssociatedPackage.equals(launchActivity.getPackageName())) {
throw new IllegalArgumentException("invoking app search on a different package " +
"not associated with this search manager");
}
if (query == null || TextUtils.getTrimmedLength(query) == 0) {
Log.w(TAG, "triggerSearch called with empty query, ignoring.");
return;