From 8192b4a6efe568b7809cb7c39392dac7f3924932 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Sat, 2 Feb 2013 15:16:43 +0900 Subject: [PATCH] [B9] Pass the client id parameter for dict info requests Bug: 6789534 Change-Id: Ie3ea75b19ae4da2dea531e0077c58742a9502bc6 --- java/res/values/donottranslate.xml | 1 + .../latin/BinaryDictionaryFileDumper.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml index edf615acc..798d615a1 100644 --- a/java/res/values/donottranslate.xml +++ b/java/res/values/donottranslate.xml @@ -213,5 +213,6 @@ com.google.android.inputmethod.latin.dictionarypack com.google.android.inputmethod.latin.dictionarypack.DictionarySettingsActivity + com.android.inputmethod.latin Attention! You are using the special keyboard for research purposes. diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java index ef440c5df..d4cdc6c5c 100644 --- a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java +++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java @@ -62,6 +62,13 @@ public final class BinaryDictionaryFileDumper { private static final String QUERY_PARAMETER_SUCCESS = "success"; private static final String QUERY_PARAMETER_FAILURE = "failure"; + // Using protocol version 2 to communicate with the dictionary pack + private static final String QUERY_PARAMETER_PROTOCOL = "protocol"; + private static final String QUERY_PARAMETER_PROTOCOL_VALUE = "2"; + + // The path fragment to append after the client ID for dictionary info requests. + private static final String QUERY_PATH_DICT_INFO = "dict"; + // Prevents this class to be accidentally instantiated. private BinaryDictionaryFileDumper() { } @@ -85,7 +92,11 @@ public final class BinaryDictionaryFileDumper { private static List getWordListWordListInfos(final Locale locale, final Context context, final boolean hasDefaultWordList) { final ContentResolver resolver = context.getContentResolver(); - final Uri.Builder builder = getProviderUriBuilder(locale.toString()); + final String clientId = context.getString(R.string.dictionary_pack_client_id); + final Uri.Builder builder = getProviderUriBuilder(clientId); + builder.appendPath(QUERY_PATH_DICT_INFO); + builder.appendPath(locale.toString()); + builder.appendQueryParameter(QUERY_PARAMETER_PROTOCOL, QUERY_PARAMETER_PROTOCOL_VALUE); if (!hasDefaultWordList) { builder.appendQueryParameter(QUERY_PARAMETER_MAY_PROMPT_USER, QUERY_PARAMETER_TRUE); }