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

Commit ff3f119c authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Consume KEYCODE_BACK event when drawer is open

Bug: 34343480

Test: press non-arrow/tab keys when drawer is open and make sure
      search mode is not activated; press BACK button on phone or
      ESC button on physical keyboard when drawer is open and make
      sure drawer is closed.

Change-Id: Id9c584c4dff16afd9e6c50bfcad25ec6a4972105
parent 80fa9171
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -760,9 +760,12 @@ public class PeopleActivity extends AppCompatContactsActivity implements

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // Only consume the event if the drawer is closed. Otherwise, key events will activate
        // search mode when drawer is open.
        // If the drawer is open, consume KEYCODE_BACK event only.
        if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
            if (keyCode == KeyEvent.KEYCODE_BACK) {
                // Should eventually go to onBackPressed().
                return super.onKeyDown(keyCode, event);
            }
            return false;
        }
        // Bring up the search UI if the user starts typing