Log version of IME

Change-Id: I6e6dc751da05cdc94d38a2a819f659b9f1885414
main
satok 2010-05-31 20:37:27 +09:00
parent bfccd09079
commit 7c00957e46
1 changed files with 18 additions and 0 deletions

View File

@ -18,6 +18,8 @@ package com.android.inputmethod.latin;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.DropBoxManager; import android.os.DropBoxManager;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.TextUtils; import android.text.TextUtils;
@ -46,6 +48,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
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 int ID_THEME_ID = 7;
private static final int ID_SETTING_AUTO_COMPLETE = 8; private static final int ID_SETTING_AUTO_COMPLETE = 8;
private static final int ID_VERSION = 9;
private static final String PREF_ENABLE_LOG = "enable_logging"; private static final String PREF_ENABLE_LOG = "enable_logging";
private static final String PREF_DEBUG_MODE = "debug_mode"; private static final String PREF_DEBUG_MODE = "debug_mode";
@ -180,6 +183,20 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
mContext.getResources().getBoolean(R.bool.enable_autocorrect)))})); mContext.getResources().getBoolean(R.bool.enable_autocorrect)))}));
} }
private void addVersionNameEntry(long time) {
if (sDBG) {
Log.d(TAG, "Log Version. (1)");
}
try {
PackageInfo info = mContext.getPackageManager().getPackageInfo(
mContext.getPackageName(), 0);
mLogBuffer.add(new LogEntry (time, ID_VERSION,
new String[] {String.valueOf(info.versionCode), info.versionName}));
} catch (NameNotFoundException e) {
Log.e(TAG, "Could not find version name.");
}
}
private void flushPrivacyLogSafely() { private void flushPrivacyLogSafely() {
if (sDBG) { if (sDBG) {
Log.d(TAG, "Log theme Id. (" + mPrivacyLogBuffer.size() + ")"); Log.d(TAG, "Log theme Id. (" + mPrivacyLogBuffer.size() + ")");
@ -270,6 +287,7 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
addCountEntry(now); addCountEntry(now);
addThemeIdEntry(now); addThemeIdEntry(now);
addSettingsEntry(now); addSettingsEntry(now);
addVersionNameEntry(now);
String s = LogSerializer.createStringFromEntries(mLogBuffer); String s = LogSerializer.createStringFromEntries(mLogBuffer);
if (!TextUtils.isEmpty(s)) { if (!TextUtils.isEmpty(s)) {
if (sDBG) { if (sDBG) {