diff --git a/toolkit/components/search/nsSearchService.js b/toolkit/components/search/nsSearchService.js index 82bdcfe1df4..c6053a991df 100644 --- a/toolkit/components/search/nsSearchService.js +++ b/toolkit/components/search/nsSearchService.js @@ -2504,10 +2504,35 @@ Engine.prototype = { this._lazySerializeToFile(); }, +#ifdef ANDROID + get _defaultMobileResponseType() { + let type = URLTYPE_SEARCH_HTML; + + let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2); + let isTablet = sysInfo.get("tablet"); + if (isTablet && this.supportsResponseType("application/x-moz-tabletsearch")) { + // Check for a tablet-specific search URL override + type = "application/x-moz-tabletsearch"; + } else if (!isTablet && this.supportsResponseType("application/x-moz-phonesearch")) { + // Check for a phone-specific search URL override + type = "application/x-moz-phonesearch"; + } + + delete this._defaultMobileResponseType; + return this._defaultMobileResponseType = type; + }, +#endif + // from nsISearchEngine getSubmission: function SRCH_ENG_getSubmission(aData, aResponseType, aPurpose) { - if (!aResponseType) +#ifdef ANDROID + if (!aResponseType) { + aResponseType = this._defaultMobileResponseType; + } +#endif + if (!aResponseType) { aResponseType = URLTYPE_SEARCH_HTML; + } var url = this._getURLOfType(aResponseType);