From e0dfc54c5b72244bc05fac902b9ceb9848132009 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 9 Dec 2011 12:40:43 +0900 Subject: [PATCH] Show usability study mode for research purposes Bug: 5722703 Change-Id: I27acc374c5d4b52707708b83689dea5d78a573d7 --- java/res/values/donottranslate.xml | 1 + .../inputmethod/latin/LatinImeLogger.java | 4 ++++ .../android/inputmethod/latin/Settings.java | 21 +++++++++++++------ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/java/res/values/donottranslate.xml b/java/res/values/donottranslate.xml index aefaec9ef..1f7736d9c 100644 --- a/java/res/values/donottranslate.xml +++ b/java/res/values/donottranslate.xml @@ -166,4 +166,5 @@ com.google.android.inputmethod.latin.dictionarypack com.google.android.inputmethod.latin.dictionarypack.DictionarySettingsActivity ms + Attention! You are using the special keyboard for research purposes. diff --git a/java/src/com/android/inputmethod/latin/LatinImeLogger.java b/java/src/com/android/inputmethod/latin/LatinImeLogger.java index ae8eb374b..9903209dd 100644 --- a/java/src/com/android/inputmethod/latin/LatinImeLogger.java +++ b/java/src/com/android/inputmethod/latin/LatinImeLogger.java @@ -78,4 +78,8 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang public static void onPrintAllUsabilityStudyLogs() { } + + public static boolean isResearcherPackage() { + return false; + } } diff --git a/java/src/com/android/inputmethod/latin/Settings.java b/java/src/com/android/inputmethod/latin/Settings.java index 7d6efa584..0985d4507 100644 --- a/java/src/com/android/inputmethod/latin/Settings.java +++ b/java/src/com/android/inputmethod/latin/Settings.java @@ -457,12 +457,21 @@ public class Settings extends InputMethodSettingsActivity textCorrectionGroup.removePreference(dictionaryLink); } - final boolean showUsabilityModeStudyOption = res.getBoolean( - R.bool.config_enable_usability_study_mode_option); - if (!showUsabilityModeStudyOption || !ENABLE_EXPERIMENTAL_SETTINGS) { - final Preference pref = findPreference(PREF_USABILITY_STUDY_MODE); - if (pref != null) { - miscSettings.removePreference(pref); + final boolean isResearcherPackage = LatinImeLogger.isResearcherPackage(); + final boolean showUsabilityStudyModeOption = + res.getBoolean(R.bool.config_enable_usability_study_mode_option) + || isResearcherPackage || ENABLE_EXPERIMENTAL_SETTINGS; + final Preference usabilityStudyPref = findPreference(PREF_USABILITY_STUDY_MODE); + if (!showUsabilityStudyModeOption) { + if (usabilityStudyPref != null) { + miscSettings.removePreference(usabilityStudyPref); + } + } + if (isResearcherPackage) { + if (usabilityStudyPref instanceof CheckBoxPreference) { + CheckBoxPreference checkbox = (CheckBoxPreference)usabilityStudyPref; + checkbox.setChecked(prefs.getBoolean(PREF_USABILITY_STUDY_MODE, true)); + checkbox.setSummary(R.string.settings_warning_researcher_mode); } }