From 6bad2f2fefc44830e6e7019886a6fde42bec7223 Mon Sep 17 00:00:00 2001 From: satok Date: Mon, 17 Dec 2012 14:57:54 +0900 Subject: [PATCH] Handle "CODE_ALREADY_PRESENT" message from Settings app Bug: 7725834 Change-Id: I85c35e73978d606edf9687e2de76c6ffc3c3ee2b --- core/java/android/widget/Editor.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 84cde52f819a3..30d022ca39ea3 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -3849,16 +3849,20 @@ public class Editor { @Override public void handleMessage(Message msg) { - final int code = msg.what; - if (code == 0) { /* CODE_WORD_ADDED */ - if (!(msg.obj instanceof Bundle)) { - Log.w(TAG, "Illegal message. Abort handling onUserDictionaryAdded."); + switch(msg.what) { + case 0: /* CODE_WORD_ADDED */ + case 2: /* CODE_ALREADY_PRESENT */ + if (!(msg.obj instanceof Bundle)) { + Log.w(TAG, "Illegal message. Abort handling onUserDictionaryAdded."); + return; + } + final Bundle bundle = (Bundle)msg.obj; + final String originalWord = bundle.getString("originalWord"); + final String addedWord = bundle.getString("word"); + onUserDictionaryAdded(originalWord, addedWord); + return; + default: return; - } - final Bundle bundle = (Bundle)msg.obj; - final String originalWord = bundle.getString("originalWord"); - final String addedWord = bundle.getString("word"); - onUserDictionaryAdded(originalWord, addedWord); } }