No logging of passwords.

Bug: 6188932
Change-Id: Ibf60ec99c50da3675bf89858624218e6cc3eb1d2
This commit is contained in:
Kurt Partridge 2012-06-13 16:37:20 -07:00
parent 687b662cf7
commit 1cef91e481

View file

@ -94,6 +94,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
private static final int LOGGING_STATE_OFF = 0; private static final int LOGGING_STATE_OFF = 0;
private static final int LOGGING_STATE_ON = 1; private static final int LOGGING_STATE_ON = 1;
private static final int LOGGING_STATE_STOPPING = 2; private static final int LOGGING_STATE_STOPPING = 2;
private boolean mIsPasswordView = false;
// set when LatinIME should ignore an onUpdateSelection() callback that // set when LatinIME should ignore an onUpdateSelection() callback that
// arises from operations in this class // arises from operations in this class
@ -313,6 +314,14 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
latinIME.showOptionDialog(builder.create()); latinIME.showOptionDialog(builder.create());
} }
private void setIsPasswordView(boolean isPasswordView) {
mIsPasswordView = isPasswordView;
}
private boolean isAllowedToLog() {
return mLoggingState == LOGGING_STATE_ON && !mIsPasswordView;
}
private static final String CURRENT_TIME_KEY = "_ct"; private static final String CURRENT_TIME_KEY = "_ct";
private static final String UPTIME_KEY = "_ut"; private static final String UPTIME_KEY = "_ut";
private static final String EVENT_TYPE_KEY = "_ty"; private static final String EVENT_TYPE_KEY = "_ty";
@ -329,7 +338,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
*/ */
private synchronized void writeEvent(final String[] keys, final Object[] values) { private synchronized void writeEvent(final String[] keys, final Object[] values) {
assert values.length + 1 == keys.length; assert values.length + 1 == keys.length;
if (mLoggingState == LOGGING_STATE_ON) { if (isAllowedToLog()) {
mLoggingHandler.post(new Runnable() { mLoggingHandler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -729,6 +738,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
public static void latinKeyboardView_setKeyboard(final Keyboard keyboard) { public static void latinKeyboardView_setKeyboard(final Keyboard keyboard) {
if (keyboard != null) { if (keyboard != null) {
final KeyboardId kid = keyboard.mId; final KeyboardId kid = keyboard.mId;
boolean isPasswordView = kid.passwordInput();
final Object[] values = { final Object[] values = {
KeyboardId.elementIdToName(kid.mElementId), KeyboardId.elementIdToName(kid.mElementId),
kid.mLocale + ":" + kid.mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET), kid.mLocale + ":" + kid.mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET),
@ -739,7 +749,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
kid.navigateNext(), kid.navigateNext(),
kid.navigatePrevious(), kid.navigatePrevious(),
kid.mClobberSettingsKey, kid.mClobberSettingsKey,
kid.passwordInput(), isPasswordView,
kid.mShortcutKeyEnabled, kid.mShortcutKeyEnabled,
kid.mHasShortcutKey, kid.mHasShortcutKey,
kid.mLanguageSwitchKeyEnabled, kid.mLanguageSwitchKeyEnabled,
@ -749,6 +759,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
keyboard.mKeys keyboard.mKeys
}; };
getInstance().writeEvent(EVENTKEYS_LATINKEYBOARDVIEW_SETKEYBOARD, values); getInstance().writeEvent(EVENTKEYS_LATINKEYBOARDVIEW_SETKEYBOARD, values);
getInstance().setIsPasswordView(isPasswordView);
} }
} }