Log the current launguage and enabled languages
Change-Id: Ie504961be7c90bdcabe73ca3bddf98cac61f3d3bmain
parent
d5d61c3485
commit
b373d460c7
|
@ -65,6 +65,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
|||
private static final int ID_MANUALSUGGESTIONCOUNT = 11;
|
||||
private static final int ID_AUTOSUGGESTIONCANCELLEDCOUNT = 12;
|
||||
private static final int ID_AUTOSUGGESTIONCOUNT = 13;
|
||||
private static final int ID_LANGUAGES = 14;
|
||||
|
||||
private static final String PREF_ENABLE_LOG = "enable_logging";
|
||||
private static final String PREF_DEBUG_MODE = "debug_mode";
|
||||
|
@ -92,6 +93,8 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
|||
private long mLastTimeCountEntry;
|
||||
|
||||
private String mThemeId;
|
||||
private String mSelectedLanguages;
|
||||
private String mCurrentLanguage;
|
||||
private int mDeleteCount;
|
||||
private int mInputCount;
|
||||
private int mWordCount;
|
||||
|
@ -143,6 +146,8 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
|||
sLogEnabled = prefs.getBoolean(PREF_ENABLE_LOG, DEFAULT_LOG_ENABLED);
|
||||
mThemeId = prefs.getString(KeyboardSwitcher.PREF_KEYBOARD_LAYOUT,
|
||||
KeyboardSwitcher.DEFAULT_LAYOUT_ID);
|
||||
mSelectedLanguages = prefs.getString(LatinIME.PREF_SELECTED_LANGUAGES, "");
|
||||
mCurrentLanguage = prefs.getString(LatinIME.PREF_INPUT_LANGUAGE, "");
|
||||
sLOGPRINT = prefs.getBoolean(PREF_DEBUG_MODE, sLOGPRINT);
|
||||
sDBG = sLOGPRINT;
|
||||
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||
|
@ -233,6 +238,19 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
|||
new String[] {mThemeId}));
|
||||
}
|
||||
|
||||
private void addLanguagesEntry(long time) {
|
||||
if (sLOGPRINT) {
|
||||
Log.d(TAG, "Log language settings. (1)");
|
||||
}
|
||||
// CurrentLanguage and SelectedLanguages will be blank if user doesn't use multi-language
|
||||
// switching.
|
||||
if (TextUtils.isEmpty(mCurrentLanguage)) {
|
||||
mCurrentLanguage = mContext.getResources().getConfiguration().locale.toString();
|
||||
}
|
||||
mLogBuffer.add(new LogEntry (time, ID_LANGUAGES,
|
||||
new String[] {mCurrentLanguage , mSelectedLanguages}));
|
||||
}
|
||||
|
||||
private void addSettingsEntry(long time) {
|
||||
if (sLOGPRINT) {
|
||||
Log.d(TAG, "Log settings. (1)");
|
||||
|
@ -363,6 +381,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
|||
long now = System.currentTimeMillis();
|
||||
addCountEntry(now);
|
||||
addThemeIdEntry(now);
|
||||
addLanguagesEntry(now);
|
||||
addSettingsEntry(now);
|
||||
addVersionNameEntry(now);
|
||||
addSuggestionCountEntry(now);
|
||||
|
@ -432,6 +451,11 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
|||
} else if (PREF_DEBUG_MODE.equals(key)) {
|
||||
sLOGPRINT = sharedPreferences.getBoolean(PREF_DEBUG_MODE, sLOGPRINT);
|
||||
sDBG = sLOGPRINT;
|
||||
} else if (LatinIME.PREF_INPUT_LANGUAGE.equals(key)) {
|
||||
mCurrentLanguage = sharedPreferences.getString(LatinIME.PREF_INPUT_LANGUAGE, "");
|
||||
addLanguagesEntry(mLastTimeActive);
|
||||
} else if (LatinIME.PREF_INPUT_LANGUAGE.equals(key)) {
|
||||
mSelectedLanguages = sharedPreferences.getString(LatinIME.PREF_SELECTED_LANGUAGES, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue