title: Android setting screen brightness to 0 turns off the screen - how to avoid
body: <p>In Android 2.3.3, I'm trying to set the screen brightness to 0 with this code:</p>
  
  <pre><code>Window myWindow = getWindow();
  WindowManager.LayoutParams winParams = myWindow.getAttributes();
  winParams.screenBrightness = 0.0f;
  myWindow.setAttributes(winParams);
  </code></pre>
  
  <p>and scheduling a Handler.postDelayed() to launch a Runnable in 1 sec to set the brightness back to full like this:</p>
  
  <pre><code>Window myWindow = getWindow();
  WindowManager.LayoutParams winParams = myWindow.getAttributes();
  winParams.screenBrightness = 1.0f;
  myWindow.setAttributes(winParams);
  </code></pre>
  
  <p>However, the screen seems to be completely off and nothing happens after this 1 sec. Putting some trace into the Runnable clearly shows that it is launched by Handler.</p>
  
  <p>I've also tried enclosing these two calls into a PARTIAL_WAKE_LOCK, with no result. Anyway, the Runnable works, so not much use of wake locks here.</p>
  
  <p>Also, if the brightness set to 0.01f not to 0f, it works fine - after 1 sec it goes back to full.</p>
  
  <p>Could anyone please advise how to make the brightness go back to full again after setting it to 0?</p>