Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95020ca8 authored by Dmitri Plotnikov's avatar Dmitri Plotnikov
Browse files

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
parent ffadc878
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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;
            }