title: Switching between TYPE_SYSTEM_ALERT AND TYPE_SYSTEM_OVERLAY , and capturing the touch events not working properly
body: <p>I made a View in service which runs always on top of every application in android. </p>
  
  <p>Initially, the behaviour of service is TYPE_SYSTEM_ALERT .</p>
  
  <pre><code>WindowManager.LayoutParams layparams = new WindowManager.LayoutParams(
   WindowManager.LayoutParams.WRAP_CONTENT,WindowManager.LayoutParams.WRAP_CONTENT, 
   WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
   WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
   PixelFormat.TRANSLUCENT);
   layparams .gravity = Gravity.CENTER_VERTICAL| Gravity.CENTER_HORIZONTAL;
   wm = (WindowManager) getSystemService(WINDOW_SERVICE);
   wm.addView(serviceView, layparams );
  </code></pre>
  
  <p>I am changing the behaviour of service at run time means switching between TYPE_SYSTEM_ALERT AND TYPE_SYSTEM_OVERLAY on touch. Switch take place when I touch outside the view parameters and when touch inside the view  parameters. </p>
  
  <pre><code>layparams .type = WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY;
  Using updateViewLayout(serviceView, layparams )
  </code></pre>
  
  <p><strong>PROBLEM:</strong> Is when I touch outside of view , the first touch just activate TYPE_SYSTEM_OVERLAY and after then outside app works fine. When TYPE_SYSTEM_OVERLAY  is working , after that when you touch within the view it will trigger the action of object behind the view not the action of the view. But when u once touch the view TYPE_SYSTEM_ALERT will be applied and now the View will behave normally . </p>
  
  <p><strong>Current Implementation</strong> : I have to touch twice to work that particular thing when switch take place between layout parameters.</p>