From: Dmitri Plotnikov Date: Fri, 2 Apr 2010 02:33:24 +0000 (-0700) Subject: Absorbing extra key events on contact search. X-Git-Tag: android-x86-2.2~20^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=95020ca857e5355e970181d661eb6019eafefc86;p=android-x86%2Fpackages-apps-Contacts.git Absorbing extra key events on contact search. When contact search is started from a keyboard, we start a search activity, but subsequent key events are still coming to the original activity and it just keeps launching new search activities. Discussed this with Dianne. The only available solution in FroYo is to swallow the extra events. This CL does just that. Bug: 2565998 Change-Id: Ib9318ad4832e950172af5a3999194bc14321938b --- diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java index 6fd03f7..aeb4014 100644 --- a/src/com/android/contacts/ContactsListActivity.java +++ b/src/com/android/contacts/ContactsListActivity.java @@ -452,6 +452,7 @@ public class ContactsListActivity extends ListActivity implements View.OnCreateC private boolean mShowNumberOfContacts; private boolean mShowSearchSnippets; + private boolean mSearchInitiated; private String mInitialFilter; @@ -1058,6 +1059,7 @@ public class ContactsListActivity extends ListActivity implements View.OnCreateC startQuery(); } mJustCreated = false; + mSearchInitiated = false; } /** @@ -1651,9 +1653,10 @@ public class ContactsListActivity extends ListActivity implements View.OnCreateC * bringing up the search UI first. */ public boolean onKey(View v, int keyCode, KeyEvent event) { - if (!mSearchMode && (mMode & MODE_MASK_NO_FILTER) == 0) { + if (!mSearchMode && (mMode & MODE_MASK_NO_FILTER) == 0 && !mSearchInitiated) { int unicodeChar = event.getUnicodeChar(); if (unicodeChar != 0) { + mSearchInitiated = true; startSearch(new String(new int[]{unicodeChar}, 0, 1), false, null, false); return true; }