title: How to Disable Home Button on Android TV Remote
body: <p>There are a couple of SO posts that have already discussed similar issues, but I find them not much relevant or too complex. I am working with an Android TV which has a remote controller, and it is supposed to be used in an enterprise environment. Users should not be able to have much control, so I have to restrict some of the functions available on the remote.<br>
  I created a simple app that overrides <code>onKeyDown()</code> and displays pressed keys using the following code:  </p>
  
  <pre><code>@Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
      //Read the input and display its code
      switch(keyCode) {
          case KeyEvent.KEYCODE_HOME:
              mTextView.setText("Home");
              break;
          default:
              char c = event.getDisplayLabel();
              String code = String.valueOf(keyCode);
              String displayText = c + " " + keyCode;
              mTextView.setText(displayText);
              mTextView.setBackgroundColor(mColor^=Color.GREEN);
  
      }
  
      return true;
  }
  </code></pre>
  
  <p>I am able to capture most of the keys and override their behaviors most notably 131, 132, 133, and 134 (used as Media, TV, Web, and App shortcuts respectively on the remote).<br>
  <a href="https://i.stack.imgur.com/Pl0Bu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pl0Bu.jpg" alt="enter image description here"></a><br>
  <a href="https://i.stack.imgur.com/Oxaqz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Oxaqz.jpg" alt="enter image description here"></a>   </p>
  
  <p>The only problem is the Home button which AOSP source code <code>(KeyEvent.java)</code> says is system-specific:    </p>
  
  <pre><code>* This key is handled by the framework and is never delivered to applications. */
      public static final int KEYCODE_HOME            = 3;
  </code></pre>
  
  <p>A solution that struck me was to extend <code>KeyEvent</code> and override the method <code>isSystem()</code> to return false when the selected key is <code>KEYCODE_HOME</code>. But, this method is defined final and I cannot override it.  Any ideas?     </p>