13e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert/* 23e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * Copyright (C) 2009 The Android Open Source Project 33e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * 43e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * Licensed under the Apache License, Version 2.0 (the "License"); 53e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * you may not use this file except in compliance with the License. 63e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * You may obtain a copy of the License at 73e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * 83e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * http://www.apache.org/licenses/LICENSE-2.0 93e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * 103e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * Unless required by applicable law or agreed to in writing, software 113e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * distributed under the License is distributed on an "AS IS" BASIS, 123e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 133e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * See the License for the specific language governing permissions and 143e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * limitations under the License. 153e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert */ 163e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 173e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringertpackage com.android.quicksearchbox; 183e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 19f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwoodimport android.app.AlarmManager; 203e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringertimport android.content.Context; 2171f9f8ccd3c12d7d48e2fee4c55cd57e1970b797Bjorn Bringertimport android.net.Uri; 223e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringertimport android.os.Process; 233e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringertimport android.util.Log; 243e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 253e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringertimport java.util.HashSet; 263e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 273e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert/** 283e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * Provides values for configurable parameters in all of QSB. 293e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * 303e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * All the methods in this class return fixed default values. Subclasses may 313e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * make these values server-side settable. 323e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * 333e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert */ 343e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringertpublic class Config { 353e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 363e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert private static final String TAG = "QSB.Config"; 3709552c760ad82eb90795e98de96c65005d6ebafcMathew Inwood private static final boolean DBG = false; 383e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 39f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood protected static final long SECOND_MILLIS = 1000L; 40f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood protected static final long MINUTE_MILLIS = 60L * SECOND_MILLIS; 41f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood protected static final long DAY_MILLIS = 86400000L; 423e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 43fde948e69f59589cf0d217ea414af7947de600bbBjorn Bringert private static final int NUM_PROMOTED_SOURCES = 3; 443e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert private static final int MAX_RESULTS_PER_SOURCE = 50; 453e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert private static final long SOURCE_TIMEOUT_MILLIS = 10000; 463e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 473e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert private static final int QUERY_THREAD_PRIORITY = 483e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert Process.THREAD_PRIORITY_BACKGROUND + Process.THREAD_PRIORITY_MORE_FAVORABLE; 493e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 5087331ef11a1ac6c907c008354e3aab5eb6f87404Bjorn Bringert private static final long MAX_STAT_AGE_MILLIS = 30 * DAY_MILLIS; 513e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert private static final int MIN_CLICKS_FOR_SOURCE_RANKING = 3; 523e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 5372f9b08ce84d0e13daf2d1c112d4e6d1d3ada045Bjorn Bringert private static final int NUM_WEB_CORPUS_THREADS = 2; 5472f9b08ce84d0e13daf2d1c112d4e6d1d3ada045Bjorn Bringert 55f95ce100dcbc77794b79b0187c566bb58b5978d3Bjorn Bringert private static final int LATENCY_LOG_FREQUENCY = 1000; 56f95ce100dcbc77794b79b0187c566bb58b5978d3Bjorn Bringert 574ef1338a23b040df2ef180c48ff85e14a9d70906Bjorn Bringert private static final long TYPING_SUGGESTIONS_UPDATE_DELAY_MILLIS = 100; 58ced9f76b761536341d739e9a243c98a4bf90638cBjorn Bringert private static final long PUBLISH_RESULT_DELAY_MILLIS = 200; 594ef1338a23b040df2ef180c48ff85e14a9d70906Bjorn Bringert 60f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood private static final long VOICE_SEARCH_HINT_ACTIVE_PERIOD = 7L * DAY_MILLIS; 61f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood 62f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood private static final long VOICE_SEARCH_HINT_UPDATE_INTERVAL 63f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood = AlarmManager.INTERVAL_FIFTEEN_MINUTES; 64f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood 65f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood private static final long VOICE_SEARCH_HINT_SHOW_PERIOD_MILLIS 66f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood = AlarmManager.INTERVAL_HOUR * 2; 67f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood 68f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood private static final long VOICE_SEARCH_HINT_CHANGE_PERIOD = 2L * MINUTE_MILLIS; 69f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood 70f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood private static final long VOICE_SEARCH_HINT_VISIBLE_PERIOD = 6L * MINUTE_MILLIS; 71f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood 72cd4accc7899fa7b756e1c430d6b196525abd5c3cMathew Inwood private static final int HTTP_CONNECT_TIMEOUT_MILLIS = 4000; 73cd4accc7899fa7b756e1c430d6b196525abd5c3cMathew Inwood private static final int HTTP_READ_TIMEOUT_MILLIS = 4000; 74cd4accc7899fa7b756e1c430d6b196525abd5c3cMathew Inwood 75ef6dbc776667219ac89bd5f80c181f65260457acNarayan Kamath private static final String USER_AGENT = "Android/1.0"; 76ef6dbc776667219ac89bd5f80c181f65260457acNarayan Kamath 77af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert private final Context mContext; 78fde948e69f59589cf0d217ea414af7947de600bbBjorn Bringert private HashSet<String> mDefaultCorpora; 7996c7058210699c82445169048b7c0fdfb16f59eeBjorn Bringert private HashSet<String> mHiddenCorpora; 8009552c760ad82eb90795e98de96c65005d6ebafcMathew Inwood private HashSet<String> mDefaultCorporaSuggestUris; 813e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 823e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert /** 833e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * Creates a new config that uses hard-coded default values. 843e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert */ 853e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert public Config(Context context) { 863e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert mContext = context; 873e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert } 883e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 89af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert protected Context getContext() { 90af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert return mContext; 91af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert } 92af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert 93af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert /** 94af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert * Releases any resources used by the configuration object. 95af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert * 96af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert * Default implementation does nothing. 97af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert */ 98af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert public void close() { 99af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert } 100af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert 10196c7058210699c82445169048b7c0fdfb16f59eeBjorn Bringert private HashSet<String> loadResourceStringSet(int res) { 102ecf356c15143ab0583c64682de16d94a57f7dd1cMathew Inwood HashSet<String> set = new HashSet<String>(); 103ecf356c15143ab0583c64682de16d94a57f7dd1cMathew Inwood String[] items = mContext.getResources().getStringArray(res); 104ecf356c15143ab0583c64682de16d94a57f7dd1cMathew Inwood for (String item : items) { 105ecf356c15143ab0583c64682de16d94a57f7dd1cMathew Inwood set.add(item); 1063e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert } 107ecf356c15143ab0583c64682de16d94a57f7dd1cMathew Inwood return set; 10896c7058210699c82445169048b7c0fdfb16f59eeBjorn Bringert } 10996c7058210699c82445169048b7c0fdfb16f59eeBjorn Bringert 11096c7058210699c82445169048b7c0fdfb16f59eeBjorn Bringert /** 111af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert * The number of promoted sources. 112af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert */ 113af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert public int getNumPromotedSources() { 114af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert return NUM_PROMOTED_SOURCES; 115af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert } 116af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert 117af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert /** 11839bbcdc1a485ded93059de4a3f70bfda85e9f304Bryan Mawhinney * The number of suggestions visible above the onscreen keyboard. 11939bbcdc1a485ded93059de4a3f70bfda85e9f304Bryan Mawhinney */ 12039bbcdc1a485ded93059de4a3f70bfda85e9f304Bryan Mawhinney public int getNumSuggestionsAboveKeyboard() { 1211fe2cb3896fa2a051bc8b716fa97b2c8398b71f1Mathew Inwood // Get the list of default corpora from a resource, which allows vendor overlays. 1221fe2cb3896fa2a051bc8b716fa97b2c8398b71f1Mathew Inwood return mContext.getResources().getInteger(R.integer.num_suggestions_above_keyboard); 12339bbcdc1a485ded93059de4a3f70bfda85e9f304Bryan Mawhinney } 12439bbcdc1a485ded93059de4a3f70bfda85e9f304Bryan Mawhinney 12539bbcdc1a485ded93059de4a3f70bfda85e9f304Bryan Mawhinney /** 1263e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * The maximum number of suggestions to promote. 1273e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert */ 1283e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert public int getMaxPromotedSuggestions() { 1291fe2cb3896fa2a051bc8b716fa97b2c8398b71f1Mathew Inwood return mContext.getResources().getInteger(R.integer.max_promoted_suggestions); 1303e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert } 1313e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 1327a0c3a7c6fdabce949b59e0a2c6ec1d44a140c24Mathew Inwood public int getMaxPromotedResults() { 1337a0c3a7c6fdabce949b59e0a2c6ec1d44a140c24Mathew Inwood return mContext.getResources().getInteger(R.integer.max_promoted_results); 1347a0c3a7c6fdabce949b59e0a2c6ec1d44a140c24Mathew Inwood } 1357a0c3a7c6fdabce949b59e0a2c6ec1d44a140c24Mathew Inwood 1363e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert /** 1373e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * The number of results to ask each source for. 1383e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert */ 1393e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert public int getMaxResultsPerSource() { 1403e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert return MAX_RESULTS_PER_SOURCE; 1413e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert } 1423e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 1433e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert /** 14408ff0a7cb6b99db79508fa3124730eb81411bc56Bjorn Bringert * The maximum number of shortcuts to show for the web source in All mode. 14508ff0a7cb6b99db79508fa3124730eb81411bc56Bjorn Bringert */ 14608ff0a7cb6b99db79508fa3124730eb81411bc56Bjorn Bringert public int getMaxShortcutsPerWebSource() { 147af1ca2cc65a2c2fdf6f396126e235d64e4da0936Mathew Inwood return mContext.getResources().getInteger(R.integer.max_shortcuts_per_web_source); 14808ff0a7cb6b99db79508fa3124730eb81411bc56Bjorn Bringert } 14908ff0a7cb6b99db79508fa3124730eb81411bc56Bjorn Bringert 15008ff0a7cb6b99db79508fa3124730eb81411bc56Bjorn Bringert /** 15108ff0a7cb6b99db79508fa3124730eb81411bc56Bjorn Bringert * The maximum number of shortcuts to show for each non-web source in All mode. 15208ff0a7cb6b99db79508fa3124730eb81411bc56Bjorn Bringert */ 15308ff0a7cb6b99db79508fa3124730eb81411bc56Bjorn Bringert public int getMaxShortcutsPerNonWebSource() { 154af1ca2cc65a2c2fdf6f396126e235d64e4da0936Mathew Inwood return mContext.getResources().getInteger(R.integer.max_shortcuts_per_non_web_source); 15508ff0a7cb6b99db79508fa3124730eb81411bc56Bjorn Bringert } 15608ff0a7cb6b99db79508fa3124730eb81411bc56Bjorn Bringert 15708ff0a7cb6b99db79508fa3124730eb81411bc56Bjorn Bringert /** 15853aab8c4459f45664d04ec882d67094c52b78695Bjorn Bringert * Gets the maximum number of shortcuts that will be shown from the given source. 15953aab8c4459f45664d04ec882d67094c52b78695Bjorn Bringert */ 16053aab8c4459f45664d04ec882d67094c52b78695Bjorn Bringert public int getMaxShortcuts(String sourceName) { 16153aab8c4459f45664d04ec882d67094c52b78695Bjorn Bringert return getMaxShortcutsPerNonWebSource(); 16253aab8c4459f45664d04ec882d67094c52b78695Bjorn Bringert } 16353aab8c4459f45664d04ec882d67094c52b78695Bjorn Bringert 16453aab8c4459f45664d04ec882d67094c52b78695Bjorn Bringert /** 1653e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * The timeout for querying each source, in milliseconds. 1663e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert */ 1673e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert public long getSourceTimeoutMillis() { 1683e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert return SOURCE_TIMEOUT_MILLIS; 1693e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert } 1703e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 1713e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert /** 1723e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * The priority of query threads. 1733e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * 1743e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert * @return A thread priority, as defined in {@link Process}. 1753e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert */ 1763e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert public int getQueryThreadPriority() { 1773e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert return QUERY_THREAD_PRIORITY; 1783e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert } 1793e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 180af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert /** 181af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert * The maximum age of log data used for shortcuts. 182af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert */ 1833e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert public long getMaxStatAgeMillis(){ 1843e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert return MAX_STAT_AGE_MILLIS; 1853e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert } 1863e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 187af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert /** 188af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert * The minimum number of clicks needed to rank a source. 189af736c70f989ebd716e0e389a28c6604b218e14fBjorn Bringert */ 1903e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert public int getMinClicksForSourceRanking(){ 1913e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert return MIN_CLICKS_FOR_SOURCE_RANKING; 1923e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert } 1933e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert 19472f9b08ce84d0e13daf2d1c112d4e6d1d3ada045Bjorn Bringert public int getNumWebCorpusThreads() { 19572f9b08ce84d0e13daf2d1c112d4e6d1d3ada045Bjorn Bringert return NUM_WEB_CORPUS_THREADS; 19672f9b08ce84d0e13daf2d1c112d4e6d1d3ada045Bjorn Bringert } 19772f9b08ce84d0e13daf2d1c112d4e6d1d3ada045Bjorn Bringert 198f95ce100dcbc77794b79b0187c566bb58b5978d3Bjorn Bringert /** 199f95ce100dcbc77794b79b0187c566bb58b5978d3Bjorn Bringert * How often query latency should be logged. 200f95ce100dcbc77794b79b0187c566bb58b5978d3Bjorn Bringert * 201f95ce100dcbc77794b79b0187c566bb58b5978d3Bjorn Bringert * @return An integer in the range 0-1000. 0 means that no latency events 202f95ce100dcbc77794b79b0187c566bb58b5978d3Bjorn Bringert * should be logged. 1000 means that all latency events should be logged. 203f95ce100dcbc77794b79b0187c566bb58b5978d3Bjorn Bringert */ 204f95ce100dcbc77794b79b0187c566bb58b5978d3Bjorn Bringert public int getLatencyLogFrequency() { 205f95ce100dcbc77794b79b0187c566bb58b5978d3Bjorn Bringert return LATENCY_LOG_FREQUENCY; 206f95ce100dcbc77794b79b0187c566bb58b5978d3Bjorn Bringert } 2074ef1338a23b040df2ef180c48ff85e14a9d70906Bjorn Bringert 2084ef1338a23b040df2ef180c48ff85e14a9d70906Bjorn Bringert /** 2094ef1338a23b040df2ef180c48ff85e14a9d70906Bjorn Bringert * The delay in milliseconds before suggestions are updated while typing. 2104ef1338a23b040df2ef180c48ff85e14a9d70906Bjorn Bringert * If a new character is typed before this timeout expires, the timeout is reset. 2114ef1338a23b040df2ef180c48ff85e14a9d70906Bjorn Bringert */ 2124ef1338a23b040df2ef180c48ff85e14a9d70906Bjorn Bringert public long getTypingUpdateSuggestionsDelayMillis() { 2134ef1338a23b040df2ef180c48ff85e14a9d70906Bjorn Bringert return TYPING_SUGGESTIONS_UPDATE_DELAY_MILLIS; 2144ef1338a23b040df2ef180c48ff85e14a9d70906Bjorn Bringert } 215ced9f76b761536341d739e9a243c98a4bf90638cBjorn Bringert 21649fd8e0994577badc6194c2c3b5f771f2b793fe4Bjorn Bringert public boolean allowVoiceSearchHints() { 217e46ac8349b012ec2c649d4e20bc835fec9ec681fBjorn Bringert return true; 21849fd8e0994577badc6194c2c3b5f771f2b793fe4Bjorn Bringert } 219f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood 220f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood /** 221f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood * The period of time for which after installing voice search we should consider showing voice 222f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood * search hints. 2235d8047bba2e05cc0cc1ca6684a53f26656a60584Mathew Inwood * 224f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood * @return The period in milliseconds. 225f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood */ 226f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood public long getVoiceSearchHintActivePeriod() { 227f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood return VOICE_SEARCH_HINT_ACTIVE_PERIOD; 228f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood } 229f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood 230f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood /** 231f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood * The time interval at which we should consider whether or not to show some voice search hints. 2325d8047bba2e05cc0cc1ca6684a53f26656a60584Mathew Inwood * 233f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood * @return The period in milliseconds. 234f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood */ 235f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood public long getVoiceSearchHintUpdatePeriod() { 236f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood return VOICE_SEARCH_HINT_UPDATE_INTERVAL; 237f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood } 238f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood 239f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood /** 240f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood * The time interval at which, on average, voice search hints are displayed. 2415d8047bba2e05cc0cc1ca6684a53f26656a60584Mathew Inwood * 2425d8047bba2e05cc0cc1ca6684a53f26656a60584Mathew Inwood * @return The period in milliseconds. 243f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood */ 244f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood public long getVoiceSearchHintShowPeriod() { 245f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood return VOICE_SEARCH_HINT_SHOW_PERIOD_MILLIS; 246f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood } 247f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood 248f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood /** 249f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood * The amount of time for which voice search hints are displayed in one go. 2505d8047bba2e05cc0cc1ca6684a53f26656a60584Mathew Inwood * 251f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood * @return The period in milliseconds. 252f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood */ 253f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood public long getVoiceSearchHintVisibleTime() { 254f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood return VOICE_SEARCH_HINT_VISIBLE_PERIOD; 255f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood } 256f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood 257f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood /** 258f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood * The period that we change voice search hints at while they're being displayed. 2595d8047bba2e05cc0cc1ca6684a53f26656a60584Mathew Inwood * 260f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood * @return The period in milliseconds. 261f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood */ 262f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood public long getVoiceSearchHintChangePeriod() { 263f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood return VOICE_SEARCH_HINT_CHANGE_PERIOD; 264f695d6bf59f2a3b2d58ab2480f2178825e712effMathew Inwood } 265848fa7a19abedc372452073abaf52780c7b6d78dAmith Yamasani 266e15fe38f0142174d223bfda0cd87d1a749a85facMathew Inwood public boolean showSuggestionsForZeroQuery() { 2671fe2cb3896fa2a051bc8b716fa97b2c8398b71f1Mathew Inwood // Get the list of default corpora from a resource, which allows vendor overlays. 2681fe2cb3896fa2a051bc8b716fa97b2c8398b71f1Mathew Inwood return mContext.getResources().getBoolean(R.bool.show_zero_query_suggestions); 269e15fe38f0142174d223bfda0cd87d1a749a85facMathew Inwood } 270e15fe38f0142174d223bfda0cd87d1a749a85facMathew Inwood 271e15fe38f0142174d223bfda0cd87d1a749a85facMathew Inwood public boolean showShortcutsForZeroQuery() { 2721fe2cb3896fa2a051bc8b716fa97b2c8398b71f1Mathew Inwood // Get the list of default corpora from a resource, which allows vendor overlays. 2731fe2cb3896fa2a051bc8b716fa97b2c8398b71f1Mathew Inwood return mContext.getResources().getBoolean(R.bool.show_zero_query_shortcuts); 274e15fe38f0142174d223bfda0cd87d1a749a85facMathew Inwood } 275e15fe38f0142174d223bfda0cd87d1a749a85facMathew Inwood 276fdb80c2962c88ac62dcd7ee7f2fab1857b61506bMathew Inwood public boolean showScrollingSuggestions() { 2771fe2cb3896fa2a051bc8b716fa97b2c8398b71f1Mathew Inwood return mContext.getResources().getBoolean(R.bool.show_scrolling_suggestions); 278fdb80c2962c88ac62dcd7ee7f2fab1857b61506bMathew Inwood } 279fdb80c2962c88ac62dcd7ee7f2fab1857b61506bMathew Inwood 280f5a8912d5da80378d38b667eba4aaa0555aea7bdMathew Inwood public boolean showScrollingResults() { 281f5a8912d5da80378d38b667eba4aaa0555aea7bdMathew Inwood return mContext.getResources().getBoolean(R.bool.show_scrolling_results); 282f5a8912d5da80378d38b667eba4aaa0555aea7bdMathew Inwood } 283f5a8912d5da80378d38b667eba4aaa0555aea7bdMathew Inwood 28471f9f8ccd3c12d7d48e2fee4c55cd57e1970b797Bjorn Bringert public Uri getHelpUrl(String activity) { 28571f9f8ccd3c12d7d48e2fee4c55cd57e1970b797Bjorn Bringert return null; 2865eee22a4ec6fc45deb9706ba535039ccae51b90aBjorn Bringert } 2875eee22a4ec6fc45deb9706ba535039ccae51b90aBjorn Bringert 288cd4accc7899fa7b756e1c430d6b196525abd5c3cMathew Inwood public int getHttpConnectTimeout() { 289cd4accc7899fa7b756e1c430d6b196525abd5c3cMathew Inwood return HTTP_CONNECT_TIMEOUT_MILLIS; 290cd4accc7899fa7b756e1c430d6b196525abd5c3cMathew Inwood } 291cd4accc7899fa7b756e1c430d6b196525abd5c3cMathew Inwood 292cd4accc7899fa7b756e1c430d6b196525abd5c3cMathew Inwood public int getHttpReadTimeout() { 293cd4accc7899fa7b756e1c430d6b196525abd5c3cMathew Inwood return HTTP_READ_TIMEOUT_MILLIS; 294cd4accc7899fa7b756e1c430d6b196525abd5c3cMathew Inwood } 295cd4accc7899fa7b756e1c430d6b196525abd5c3cMathew Inwood 296ef6dbc776667219ac89bd5f80c181f65260457acNarayan Kamath public String getUserAgent() { 297ef6dbc776667219ac89bd5f80c181f65260457acNarayan Kamath return USER_AGENT; 298ef6dbc776667219ac89bd5f80c181f65260457acNarayan Kamath } 2993e44ff1f2a204db3f479698cf0b3eab3d451dec2Bjorn Bringert} 300