title: Window manager view is not allowing to go back
body: <p>I am adding a view from XML to Window Manager view, Everything is working fine but when i want to go back to previous activity back button is not working even i have removed the added view from window manager inside onBackPressed.</p>
  
  <pre><code>manager = ((WindowManager) getApplicationContext().getSystemService(
              Context.WINDOW_SERVICE));
  
      localLayoutParams = getWindow().getAttributes();
      localLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
      localLayoutParams.gravity = Gravity.TOP;
      localLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
              | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
              | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
      localLayoutParams.flags = 0x80000000 | localLayoutParams.flags;
      localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
      localLayoutParams.height =    WindowManager.LayoutParams.WRAP_CONTENT;
      localLayoutParams.format = PixelFormat.TRANSPARENT;
  
      localLayoutParams.screenBrightness = brightness / (float) 255;
  
      LayoutInflater inflater = getLayoutInflater();
      overlay = inflater.inflate(R.layout.activity_main, null);
  
      manager.addView(overlay, localLayoutParams);
  </code></pre>
  
  <p>And when i press the back button here is the code to remove the view</p>
  
  <pre><code>if(overlay!=null)
   manager.removeView(overlay);
  </code></pre>
  
  <p>Please help me out of this issue.</p>