Merge "Add a preference item for metrics logging"

main
Yohei Yukawa 2014-06-04 05:07:03 +00:00 committed by Android (Google) Code Review
commit 5a3a7e3d8a
4 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2014, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<resources>
<!-- Description for option to enable sending usage statistics -->
<string name="enable_metrics_logging_summary" translatable="false"></string>
</resources>

View File

@ -87,6 +87,9 @@
<!-- Option name for enabling the use by the keyboards of sent/received messages, e-mail and typing history to improve suggestion accuracy [CHAR LIMIT=25] --> <!-- Option name for enabling the use by the keyboards of sent/received messages, e-mail and typing history to improve suggestion accuracy [CHAR LIMIT=25] -->
<string name="use_personalized_dicts">Personalized suggestions</string> <string name="use_personalized_dicts">Personalized suggestions</string>
<!-- Option to enable sending usage statistics -->
<string name="enable_metrics_logging">"Improve <xliff:g id="APPLICATION_NAME" example="Android Keyboard">%s</xliff:g>"</string>
<!-- Option name for enabling or disabling the double-space period feature that lets double tap on spacebar insert a period followed by a space [CHAR LIMIT=30] --> <!-- Option name for enabling or disabling the double-space period feature that lets double tap on spacebar insert a period followed by a space [CHAR LIMIT=30] -->
<string name="use_double_space_period">Double-space period</string> <string name="use_double_space_period">Double-space period</string>
<!-- Description for option enabling or disabling the double-space period feature that lets double tap on spacebar insert a period followed by a space [CHAR LIMIT=65] --> <!-- Description for option enabling or disabling the double-space period feature that lets double tap on spacebar insert a period followed by a space [CHAR LIMIT=65] -->

View File

@ -95,6 +95,12 @@
android:summary="@string/use_personalized_dicts_summary" android:summary="@string/use_personalized_dicts_summary"
android:persistent="true" android:persistent="true"
android:defaultValue="true" /> android:defaultValue="true" />
<!-- title will be set programmatically to embed application name -->
<CheckBoxPreference
android:key="pref_enable_metrics_logging"
android:summary="@string/enable_metrics_logging_summary"
android:persistent="true"
android:defaultValue="true" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:title="@string/gesture_typing_category" android:title="@string/gesture_typing_category"

View File

@ -41,6 +41,7 @@ import com.android.inputmethod.keyboard.KeyboardTheme;
import com.android.inputmethod.latin.AudioAndHapticFeedbackManager; import com.android.inputmethod.latin.AudioAndHapticFeedbackManager;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SubtypeSwitcher; import com.android.inputmethod.latin.SubtypeSwitcher;
import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.setup.LauncherIconVisibilityManager; import com.android.inputmethod.latin.setup.LauncherIconVisibilityManager;
import com.android.inputmethod.latin.userdictionary.UserDictionaryList; import com.android.inputmethod.latin.userdictionary.UserDictionaryList;
import com.android.inputmethod.latin.userdictionary.UserDictionarySettings; import com.android.inputmethod.latin.userdictionary.UserDictionarySettings;
@ -212,6 +213,20 @@ public final class SettingsFragment extends InputMethodSettingsFragment
textCorrectionGroup.removePreference(dictionaryLink); textCorrectionGroup.removePreference(dictionaryLink);
} }
if (ProductionFlag.IS_METRICS_LOGGING_SUPPORTED) {
final Preference enableMetricsLogging =
findPreference(Settings.PREF_ENABLE_METRICS_LOGGING);
if (enableMetricsLogging != null) {
final int applicationLabelRes = context.getApplicationInfo().labelRes;
final String applicationName = res.getString(applicationLabelRes);
final String enableMetricsLoggingTitle = res.getString(
R.string.enable_metrics_logging, applicationName);
enableMetricsLogging.setTitle(enableMetricsLoggingTitle);
}
} else {
removePreference(Settings.PREF_ENABLE_METRICS_LOGGING, textCorrectionGroup);
}
final Preference editPersonalDictionary = final Preference editPersonalDictionary =
findPreference(Settings.PREF_EDIT_PERSONAL_DICTIONARY); findPreference(Settings.PREF_EDIT_PERSONAL_DICTIONARY);
final Intent editPersonalDictionaryIntent = editPersonalDictionary.getIntent(); final Intent editPersonalDictionaryIntent = editPersonalDictionary.getIntent();