Merge remote-tracking branch 'goog/master' into mergescriptpackage
commit
f875374942
|
@ -16,16 +16,22 @@
|
||||||
|
|
||||||
package com.android.inputmethod.research;
|
package com.android.inputmethod.research;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.Dictionary;
|
import com.android.inputmethod.latin.Dictionary;
|
||||||
import com.android.inputmethod.latin.Suggest;
|
import com.android.inputmethod.latin.Suggest;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class MainLogBuffer extends LogBuffer {
|
public class MainLogBuffer extends LogBuffer {
|
||||||
|
private static final String TAG = MainLogBuffer.class.getSimpleName();
|
||||||
|
// For privacy reasons, be sure to set to "false" for production code.
|
||||||
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
// The size of the n-grams logged. E.g. N_GRAM_SIZE = 2 means to sample bigrams.
|
// The size of the n-grams logged. E.g. N_GRAM_SIZE = 2 means to sample bigrams.
|
||||||
private static final int N_GRAM_SIZE = 2;
|
private static final int N_GRAM_SIZE = 2;
|
||||||
// The number of words between n-grams to omit from the log.
|
// The number of words between n-grams to omit from the log.
|
||||||
private static final int DEFAULT_NUMBER_OF_WORDS_BETWEEN_SAMPLES = 18;
|
private static final int DEFAULT_NUMBER_OF_WORDS_BETWEEN_SAMPLES = DEBUG ? 2 : 18;
|
||||||
|
|
||||||
private final ResearchLog mResearchLog;
|
private final ResearchLog mResearchLog;
|
||||||
private Suggest mSuggest;
|
private Suggest mSuggest;
|
||||||
|
@ -61,6 +67,9 @@ public class MainLogBuffer extends LogBuffer {
|
||||||
mWordsUntilSafeToSample--;
|
mWordsUntilSafeToSample--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "shiftedIn " + (newLogUnit.hasWord() ? newLogUnit.getWord() : ""));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetWordCounter() {
|
public void resetWordCounter() {
|
||||||
|
|
|
@ -60,6 +60,7 @@ import com.android.inputmethod.keyboard.MainKeyboardView;
|
||||||
import com.android.inputmethod.latin.CollectionUtils;
|
import com.android.inputmethod.latin.CollectionUtils;
|
||||||
import com.android.inputmethod.latin.Constants;
|
import com.android.inputmethod.latin.Constants;
|
||||||
import com.android.inputmethod.latin.Dictionary;
|
import com.android.inputmethod.latin.Dictionary;
|
||||||
|
import com.android.inputmethod.latin.InputTypeUtils;
|
||||||
import com.android.inputmethod.latin.LatinIME;
|
import com.android.inputmethod.latin.LatinIME;
|
||||||
import com.android.inputmethod.latin.R;
|
import com.android.inputmethod.latin.R;
|
||||||
import com.android.inputmethod.latin.RichInputConnection;
|
import com.android.inputmethod.latin.RichInputConnection;
|
||||||
|
@ -687,7 +688,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
|
|
||||||
/* package for test */ void commitCurrentLogUnit() {
|
/* package for test */ void commitCurrentLogUnit() {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "commitCurrentLogUnit");
|
Log.d(TAG, "commitCurrentLogUnit" + (mCurrentLogUnit.hasWord() ?
|
||||||
|
": " + mCurrentLogUnit.getWord() : ""));
|
||||||
}
|
}
|
||||||
if (!mCurrentLogUnit.isEmpty()) {
|
if (!mCurrentLogUnit.isEmpty()) {
|
||||||
if (mMainLogBuffer != null) {
|
if (mMainLogBuffer != null) {
|
||||||
|
@ -791,8 +793,11 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
public static void latinIME_onStartInputViewInternal(final EditorInfo editorInfo,
|
public static void latinIME_onStartInputViewInternal(final EditorInfo editorInfo,
|
||||||
final SharedPreferences prefs) {
|
final SharedPreferences prefs) {
|
||||||
final ResearchLogger researchLogger = getInstance();
|
final ResearchLogger researchLogger = getInstance();
|
||||||
researchLogger.start();
|
|
||||||
if (editorInfo != null) {
|
if (editorInfo != null) {
|
||||||
|
final boolean isPassword = InputTypeUtils.isPasswordInputType(editorInfo.inputType)
|
||||||
|
|| InputTypeUtils.isVisiblePasswordInputType(editorInfo.inputType);
|
||||||
|
getInstance().setIsPasswordView(isPassword);
|
||||||
|
researchLogger.start();
|
||||||
final Context context = researchLogger.mInputMethodService;
|
final Context context = researchLogger.mInputMethodService;
|
||||||
try {
|
try {
|
||||||
final PackageInfo packageInfo;
|
final PackageInfo packageInfo;
|
||||||
|
@ -1059,7 +1064,6 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
keyboard.mOccupiedHeight,
|
keyboard.mOccupiedHeight,
|
||||||
keyboard.mKeys
|
keyboard.mKeys
|
||||||
};
|
};
|
||||||
getInstance().setIsPasswordView(isPasswordView);
|
|
||||||
getInstance().enqueueEvent(EVENTKEYS_MAINKEYBOARDVIEW_SETKEYBOARD, values);
|
getInstance().enqueueEvent(EVENTKEYS_MAINKEYBOARDVIEW_SETKEYBOARD, values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,14 @@
|
||||||
|
|
||||||
package com.android.inputmethod.research;
|
package com.android.inputmethod.research;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.Constants;
|
import com.android.inputmethod.latin.Constants;
|
||||||
|
|
||||||
public class Statistics {
|
public class Statistics {
|
||||||
|
private static final String TAG = Statistics.class.getSimpleName();
|
||||||
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
// Number of characters entered during a typing session
|
// Number of characters entered during a typing session
|
||||||
int mCharCount;
|
int mCharCount;
|
||||||
// Number of letter characters entered during a typing session
|
// Number of letter characters entered during a typing session
|
||||||
|
@ -103,6 +108,9 @@ public class Statistics {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordChar(int codePoint, long time) {
|
public void recordChar(int codePoint, long time) {
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.d(TAG, "recordChar() called");
|
||||||
|
}
|
||||||
final long delta = time - mLastTapTime;
|
final long delta = time - mLastTapTime;
|
||||||
if (codePoint == Constants.CODE_DELETE) {
|
if (codePoint == Constants.CODE_DELETE) {
|
||||||
mDeleteKeyCount++;
|
mDeleteKeyCount++;
|
||||||
|
|
Loading…
Reference in New Issue