researchLog records versionCode, versionName
Bug: 6188932 Change-Id: I3d8502a5397035be5287ea720599e3fda4c669d6
This commit is contained in:
parent
eea34598bf
commit
73c5dbd9d2
1 changed files with 26 additions and 8 deletions
|
@ -19,9 +19,12 @@ package com.android.inputmethod.latin;
|
||||||
import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.KEYBOARD_LAYOUT_SET;
|
import static com.android.inputmethod.latin.Constants.Subtype.ExtraValue.KEYBOARD_LAYOUT_SET;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.SharedPreferences.Editor;
|
import android.content.SharedPreferences.Editor;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.inputmethodservice.InputMethodService;
|
import android.inputmethodservice.InputMethodService;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
@ -101,6 +104,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
private Suggest mSuggest;
|
private Suggest mSuggest;
|
||||||
private Dictionary mDictionary;
|
private Dictionary mDictionary;
|
||||||
private KeyboardSwitcher mKeyboardSwitcher;
|
private KeyboardSwitcher mKeyboardSwitcher;
|
||||||
|
private Context mContext;
|
||||||
|
|
||||||
private ResearchLogger() {
|
private ResearchLogger() {
|
||||||
}
|
}
|
||||||
|
@ -115,6 +119,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
if (ims == null) {
|
if (ims == null) {
|
||||||
Log.w(TAG, "IMS is null; logging is off");
|
Log.w(TAG, "IMS is null; logging is off");
|
||||||
} else {
|
} else {
|
||||||
|
mContext = ims;
|
||||||
mFilesDir = ims.getFilesDir();
|
mFilesDir = ims.getFilesDir();
|
||||||
if (mFilesDir == null || !mFilesDir.exists()) {
|
if (mFilesDir == null || !mFilesDir.exists()) {
|
||||||
Log.w(TAG, "IME storage directory does not exist.");
|
Log.w(TAG, "IME storage directory does not exist.");
|
||||||
|
@ -678,18 +683,31 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
|
|
||||||
private static final String[] EVENTKEYS_LATINIME_ONSTARTINPUTVIEWINTERNAL = {
|
private static final String[] EVENTKEYS_LATINIME_ONSTARTINPUTVIEWINTERNAL = {
|
||||||
"LatinIMEOnStartInputViewInternal", "uuid", "packageName", "inputType", "imeOptions",
|
"LatinIMEOnStartInputViewInternal", "uuid", "packageName", "inputType", "imeOptions",
|
||||||
"fieldId", "display", "model", "prefs", "outputFormatVersion"
|
"fieldId", "display", "model", "prefs", "versionCode", "versionName", "outputFormatVersion"
|
||||||
};
|
};
|
||||||
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();
|
||||||
|
researchLogger.start();
|
||||||
if (editorInfo != null) {
|
if (editorInfo != null) {
|
||||||
final Object[] values = {
|
final Context context = researchLogger.mContext;
|
||||||
getInstance().mUUIDString, editorInfo.packageName,
|
try {
|
||||||
Integer.toHexString(editorInfo.inputType),
|
final PackageInfo packageInfo;
|
||||||
Integer.toHexString(editorInfo.imeOptions), editorInfo.fieldId, Build.DISPLAY,
|
packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(),
|
||||||
Build.MODEL, prefs, OUTPUT_FORMAT_VERSION
|
0);
|
||||||
};
|
final Integer versionCode = packageInfo.versionCode;
|
||||||
getInstance().enqueueEvent(EVENTKEYS_LATINIME_ONSTARTINPUTVIEWINTERNAL, values);
|
final String versionName = packageInfo.versionName;
|
||||||
|
final Object[] values = {
|
||||||
|
researchLogger.mUUIDString, editorInfo.packageName,
|
||||||
|
Integer.toHexString(editorInfo.inputType),
|
||||||
|
Integer.toHexString(editorInfo.imeOptions), editorInfo.fieldId,
|
||||||
|
Build.DISPLAY, Build.MODEL, prefs, versionCode, versionName,
|
||||||
|
OUTPUT_FORMAT_VERSION
|
||||||
|
};
|
||||||
|
researchLogger.enqueueEvent(EVENTKEYS_LATINIME_ONSTARTINPUTVIEWINTERNAL, values);
|
||||||
|
} catch (NameNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue