title: How to properly override a dispatchKeyEvent in Android
body: <p>I get</p>
  
  <pre><code>D/InputEventConsistencyVerifier( 2144): KeyEvent: ACTION_UP but key was not down.`
  D/InputEventConsistencyVerifier( 2144): in com.android.internal.policy.impl.PhoneWindow$DecorView@41689658
  </code></pre>
  
  <p>warnings all over when I try to do this in my activity: </p>
  
  <pre><code>@Override
  public boolean dispatchKeyEvent(KeyEvent event) {
      if ((/*some boolean checks*/) &amp;&amp; (event.getAction() == KeyEvent.ACTION_DOWN)) {
              /*some custom functions*/
              return true;
          }
      }
      return super.dispatchKeyEvent(event);
  }
  </code></pre>
  
  <p>What is the correct way of overriding <code>dispatchKeyEvent</code> in the activity level? Are these warnings fine? Should I do corresponding changes in the <code>onKeyUp</code> and <code>onKeyDown</code> of my views?</p>