diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index 7dc9a365e..d6b7486ee 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -59,7 +59,7 @@ android:persistent="true" android:entryValues="@array/keyboard_layout_modes_values" android:entries="@array/keyboard_layout_modes" - android:defaultValue="2" + android:defaultValue="3" /> (); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); sLogEnabled = prefs.getBoolean(PREF_ENABLE_LOG, DEFAULT_LOG_ENABLED); + mThemeId = prefs.getString(KeyboardSwitcher.PREF_KEYBOARD_LAYOUT, + KeyboardSwitcher.DEFAULT_LAYOUT_ID); prefs.registerOnSharedPreferenceChangeListener(this); } @@ -140,9 +144,8 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang } private void addCountEntry(long time) { - mLogBuffer.add( - new LogEntry (time, ID_DELETE_COUNT, - new String[] {String.valueOf(mDeleteCount)})); + mLogBuffer.add(new LogEntry (time, ID_DELETE_COUNT, + new String[] {String.valueOf(mDeleteCount)})); mLogBuffer.add(new LogEntry (time, ID_INPUT_COUNT, new String[] {String.valueOf(mInputCount)})); mLogBuffer.add(new LogEntry (time, ID_WORD_COUNT, @@ -155,6 +158,11 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang mActualCharCount = 0; } + private void addThemeIdEntry(long time) { + mLogBuffer.add(new LogEntry (time, ID_THEME_ID, + new String[] {mThemeId})); + } + private void flushPrivacyLogSafely() { long now = System.currentTimeMillis(); Collections.sort(mPrivacyLogBuffer); @@ -176,6 +184,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang if (mLastTimeActive - mLastTimeCountEntry > MINIMUMCOUNTINTERVAL || (mDeleteCount == 0 && mInputCount == 0)) { addCountEntry(mLastTimeActive); + addThemeIdEntry(mLastTimeActive); } mDeleteCount += (Integer)data; break; @@ -183,6 +192,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang if (mLastTimeActive - mLastTimeCountEntry > MINIMUMCOUNTINTERVAL || (mDeleteCount == 0 && mInputCount == 0)) { addCountEntry(mLastTimeActive); + addThemeIdEntry(mLastTimeActive); } mInputCount += (Integer)data; break; @@ -223,14 +233,16 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang private void commitInternal() { flushPrivacyLogSafely(); - addCountEntry(System.currentTimeMillis()); + long now = System.currentTimeMillis(); + addCountEntry(now); + addThemeIdEntry(now); String s = LogSerializer.createStringFromEntries(mLogBuffer); if (DBG) { Log.d(TAG, "Commit log: " + s); } mDropBox.addText(TAG, s); reset(); - mLastTimeSend = System.currentTimeMillis(); + mLastTimeSend = now; } private synchronized void sendLogToDropBox(int tag, Object s) { @@ -260,6 +272,9 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang } else { sLogEnabled = false; } + } else if (KeyboardSwitcher.PREF_KEYBOARD_LAYOUT.equals(key)) { + mThemeId = sharedPreferences.getString(KeyboardSwitcher.PREF_KEYBOARD_LAYOUT, + KeyboardSwitcher.DEFAULT_LAYOUT_ID); } }