parent
f9ce9105ba
commit
853083627a
|
@ -59,7 +59,7 @@
|
||||||
android:persistent="true"
|
android:persistent="true"
|
||||||
android:entryValues="@array/keyboard_layout_modes_values"
|
android:entryValues="@array/keyboard_layout_modes_values"
|
||||||
android:entries="@array/keyboard_layout_modes"
|
android:entries="@array/keyboard_layout_modes"
|
||||||
android:defaultValue="2"
|
android:defaultValue="3"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
|
|
|
@ -46,6 +46,13 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
public static final int KEYBOARDMODE_IM = R.id.mode_im;
|
public static final int KEYBOARDMODE_IM = R.id.mode_im;
|
||||||
public static final int KEYBOARDMODE_WEB = R.id.mode_webentry;
|
public static final int KEYBOARDMODE_WEB = R.id.mode_webentry;
|
||||||
|
|
||||||
|
public static final String DEFAULT_LAYOUT_ID = "3";
|
||||||
|
public static final String PREF_KEYBOARD_LAYOUT = "keyboard_layout";
|
||||||
|
private static final int[] LAYOUTS = new int [] {
|
||||||
|
R.layout.input, R.layout.input2, R.layout.input3, R.layout.input4, R.layout.input5,
|
||||||
|
R.layout.input6
|
||||||
|
};
|
||||||
|
|
||||||
private static final int SYMBOLS_MODE_STATE_NONE = 0;
|
private static final int SYMBOLS_MODE_STATE_NONE = 0;
|
||||||
private static final int SYMBOLS_MODE_STATE_BEGIN = 1;
|
private static final int SYMBOLS_MODE_STATE_BEGIN = 1;
|
||||||
private static final int SYMBOLS_MODE_STATE_SYMBOL = 2;
|
private static final int SYMBOLS_MODE_STATE_SYMBOL = 2;
|
||||||
|
@ -57,12 +64,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
KEYBOARDMODE_EMAIL,
|
KEYBOARDMODE_EMAIL,
|
||||||
KEYBOARDMODE_IM,
|
KEYBOARDMODE_IM,
|
||||||
KEYBOARDMODE_WEB};
|
KEYBOARDMODE_WEB};
|
||||||
private static final String PREF_KEYBOARD_LAYOUT = "keyboard_layout";
|
|
||||||
private static final int[] LAYOUTS = new int [] {
|
|
||||||
R.layout.input, R.layout.input2, R.layout.input3, R.layout.input4, R.layout.input5,
|
|
||||||
R.layout.input6
|
|
||||||
};
|
|
||||||
private static final String DEFAULT_LAYOUT_ID = "0";
|
|
||||||
|
|
||||||
Context mContext;
|
Context mContext;
|
||||||
LatinIME mInputMethodService;
|
LatinIME mInputMethodService;
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
// DEFAULT_LOG_ENABLED should be false when released to public.
|
// DEFAULT_LOG_ENABLED should be false when released to public.
|
||||||
private static final boolean DEFAULT_LOG_ENABLED = true;
|
private static final boolean DEFAULT_LOG_ENABLED = true;
|
||||||
|
|
||||||
private static final long MINIMUMSENDINTERVAL = 60 * DateUtils.SECOND_IN_MILLIS; // 60 sec
|
private static final long MINIMUMSENDINTERVAL = 300 * DateUtils.SECOND_IN_MILLIS; // 300 sec
|
||||||
private static final long MINIMUMCOUNTINTERVAL = 20 * DateUtils.SECOND_IN_MILLIS; // 20 sec
|
private static final long MINIMUMCOUNTINTERVAL = 20 * DateUtils.SECOND_IN_MILLIS; // 20 sec
|
||||||
private static final char SEPARATER = ';';
|
private static final char SEPARATER = ';';
|
||||||
private static final int ID_CLICKSUGGESTION = 0;
|
private static final int ID_CLICKSUGGESTION = 0;
|
||||||
|
@ -42,6 +42,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
private static final int ID_DELETE_COUNT = 4;
|
private static final int ID_DELETE_COUNT = 4;
|
||||||
private static final int ID_WORD_COUNT = 5;
|
private static final int ID_WORD_COUNT = 5;
|
||||||
private static final int ID_ACTUAL_CHAR_COUNT = 6;
|
private static final int ID_ACTUAL_CHAR_COUNT = 6;
|
||||||
|
private static final int ID_THEME_ID = 7;
|
||||||
|
|
||||||
private static final String PREF_ENABLE_LOG = "enable_log";
|
private static final String PREF_ENABLE_LOG = "enable_log";
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
private long mLastTimeSend;
|
private long mLastTimeSend;
|
||||||
private long mLastTimeCountEntry;
|
private long mLastTimeCountEntry;
|
||||||
|
|
||||||
|
private String mThemeId;
|
||||||
private int mDeleteCount;
|
private int mDeleteCount;
|
||||||
private int mInputCount;
|
private int mInputCount;
|
||||||
private int mWordCount;
|
private int mWordCount;
|
||||||
|
@ -103,6 +105,8 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
mPrivacyLogBuffer = new ArrayList<LogEntry>();
|
mPrivacyLogBuffer = new ArrayList<LogEntry>();
|
||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
sLogEnabled = prefs.getBoolean(PREF_ENABLE_LOG, DEFAULT_LOG_ENABLED);
|
sLogEnabled = prefs.getBoolean(PREF_ENABLE_LOG, DEFAULT_LOG_ENABLED);
|
||||||
|
mThemeId = prefs.getString(KeyboardSwitcher.PREF_KEYBOARD_LAYOUT,
|
||||||
|
KeyboardSwitcher.DEFAULT_LAYOUT_ID);
|
||||||
prefs.registerOnSharedPreferenceChangeListener(this);
|
prefs.registerOnSharedPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,9 +144,8 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCountEntry(long time) {
|
private void addCountEntry(long time) {
|
||||||
mLogBuffer.add(
|
mLogBuffer.add(new LogEntry (time, ID_DELETE_COUNT,
|
||||||
new LogEntry (time, ID_DELETE_COUNT,
|
new String[] {String.valueOf(mDeleteCount)}));
|
||||||
new String[] {String.valueOf(mDeleteCount)}));
|
|
||||||
mLogBuffer.add(new LogEntry (time, ID_INPUT_COUNT,
|
mLogBuffer.add(new LogEntry (time, ID_INPUT_COUNT,
|
||||||
new String[] {String.valueOf(mInputCount)}));
|
new String[] {String.valueOf(mInputCount)}));
|
||||||
mLogBuffer.add(new LogEntry (time, ID_WORD_COUNT,
|
mLogBuffer.add(new LogEntry (time, ID_WORD_COUNT,
|
||||||
|
@ -155,6 +158,11 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
mActualCharCount = 0;
|
mActualCharCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addThemeIdEntry(long time) {
|
||||||
|
mLogBuffer.add(new LogEntry (time, ID_THEME_ID,
|
||||||
|
new String[] {mThemeId}));
|
||||||
|
}
|
||||||
|
|
||||||
private void flushPrivacyLogSafely() {
|
private void flushPrivacyLogSafely() {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
Collections.sort(mPrivacyLogBuffer);
|
Collections.sort(mPrivacyLogBuffer);
|
||||||
|
@ -176,6 +184,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
if (mLastTimeActive - mLastTimeCountEntry > MINIMUMCOUNTINTERVAL
|
if (mLastTimeActive - mLastTimeCountEntry > MINIMUMCOUNTINTERVAL
|
||||||
|| (mDeleteCount == 0 && mInputCount == 0)) {
|
|| (mDeleteCount == 0 && mInputCount == 0)) {
|
||||||
addCountEntry(mLastTimeActive);
|
addCountEntry(mLastTimeActive);
|
||||||
|
addThemeIdEntry(mLastTimeActive);
|
||||||
}
|
}
|
||||||
mDeleteCount += (Integer)data;
|
mDeleteCount += (Integer)data;
|
||||||
break;
|
break;
|
||||||
|
@ -183,6 +192,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
if (mLastTimeActive - mLastTimeCountEntry > MINIMUMCOUNTINTERVAL
|
if (mLastTimeActive - mLastTimeCountEntry > MINIMUMCOUNTINTERVAL
|
||||||
|| (mDeleteCount == 0 && mInputCount == 0)) {
|
|| (mDeleteCount == 0 && mInputCount == 0)) {
|
||||||
addCountEntry(mLastTimeActive);
|
addCountEntry(mLastTimeActive);
|
||||||
|
addThemeIdEntry(mLastTimeActive);
|
||||||
}
|
}
|
||||||
mInputCount += (Integer)data;
|
mInputCount += (Integer)data;
|
||||||
break;
|
break;
|
||||||
|
@ -223,14 +233,16 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
|
|
||||||
private void commitInternal() {
|
private void commitInternal() {
|
||||||
flushPrivacyLogSafely();
|
flushPrivacyLogSafely();
|
||||||
addCountEntry(System.currentTimeMillis());
|
long now = System.currentTimeMillis();
|
||||||
|
addCountEntry(now);
|
||||||
|
addThemeIdEntry(now);
|
||||||
String s = LogSerializer.createStringFromEntries(mLogBuffer);
|
String s = LogSerializer.createStringFromEntries(mLogBuffer);
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
Log.d(TAG, "Commit log: " + s);
|
Log.d(TAG, "Commit log: " + s);
|
||||||
}
|
}
|
||||||
mDropBox.addText(TAG, s);
|
mDropBox.addText(TAG, s);
|
||||||
reset();
|
reset();
|
||||||
mLastTimeSend = System.currentTimeMillis();
|
mLastTimeSend = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void sendLogToDropBox(int tag, Object s) {
|
private synchronized void sendLogToDropBox(int tag, Object s) {
|
||||||
|
@ -260,6 +272,9 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
} else {
|
} else {
|
||||||
sLogEnabled = false;
|
sLogEnabled = false;
|
||||||
}
|
}
|
||||||
|
} else if (KeyboardSwitcher.PREF_KEYBOARD_LAYOUT.equals(key)) {
|
||||||
|
mThemeId = sharedPreferences.getString(KeyboardSwitcher.PREF_KEYBOARD_LAYOUT,
|
||||||
|
KeyboardSwitcher.DEFAULT_LAYOUT_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue