title: Turn Screen Off using proximity sensor
body: <p>I have an issue when using the proximity sensor to turn the screen off. When My Device is using the SDK version 21 or upper I can use this code to turn off the Screen when a user put the phone near something. (Capturing the events of the SensorEventListener)</p>
  
  <pre><code>public void turnOnScreen(){
      // turn on screen
      Log.v("ProximityActivity", "ON!");
      mWakeLock = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "tag");
      mWakeLock.acquire();
  }
  
  @TargetApi(21) //Suppress lint error for PROXIMITY_SCREEN_OFF_WAKE_LOCK
  public void turnOffScreen(){
      // turn off screen
      Log.v("ProximityActivity", "OFF!");
      mWakeLock = mPowerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "tag");
      mWakeLock.acquire();
  }
  </code></pre>
  
  <p>Now, the problem is that I don't know how to get the same behavior before API 21. I would like to put the screen in Black and disable all the events on it.</p>
  
  <p>Thank you in advance.</p>