Creating a system overlay where the home buttons still work?
<p>I am trying to create a button that is always on the screen.</p>

<ol>
<li>The button should be clickable and
anything directly under the button
should not be activated on a press.    </li>
<li>The activity or home screen running
behind the button should still work,
meaning the user should still be
able to interact with the home
screen or application. </li>
<li>The soft key
buttons should still work: home,
back, menu, etc</li>
</ol>

<p>The following code does #1 and #2 but the soft key buttons no longer work:</p>

<pre><code>WindowManager.LayoutParams params = new WindowManager.LayoutParams(
        WindowManager.LayoutParams.WRAP_CONTENT,
        WindowManager.LayoutParams.WRAP_CONTENT,
        WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
        WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
        WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
        PixelFormat.TRANSLUCENT);
</code></pre>

<p>Changing it to this disables the overlay from clicks but #2 and #3 work:</p>

<pre><code>WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
</code></pre>

<p>Finally in this example the overlay and what is directly behind it gets clicked:</p>

<pre><code>WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
</code></pre>

<p>How can I change this so that the overlay is clickable, whats directly under it is not clickable, and everything outside of the overlay works including the home buttons?</p>

<p>An example application that performs all of this is Super Manager.</p>

<p>UPDATE: I've found that the following allows the home button to be used, but still not the other buttons:</p>

<pre><code>        WindowManager.LayoutParams.TYPE_SYSTEM_ALERT | 
            WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
        WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
            WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
</code></pre>

<p>,</p>
