Example usage for android.os PowerManager RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY

List of usage examples for android.os PowerManager RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY

Introduction

In this page you can find the example usage for android.os PowerManager RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY.

Prototype

int RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY

To view the source code for android.os PowerManager RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY.

Click Source Link

Document

Flag for WakeLock#release WakeLock.release(int) : Defer releasing a #PROXIMITY_SCREEN_OFF_WAKE_LOCK wake lock until the proximity sensor indicates that an object is not in close proximity.

Usage

From source file:com.android.dialer.voicemail.VoicemailPlaybackPresenter.java

private void disableProximitySensor(boolean waitForFarState) {
    if (mProximityWakeLock == null) {
        return;/*w  w w  . j  av a2 s. c  om*/
    }
    if (mProximityWakeLock.isHeld()) {
        Log.i(TAG, "Releasing proximity wake lock");
        int flags = waitForFarState ? PowerManager.RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY : 0;
        mProximityWakeLock.release(flags);
    } else {
        Log.i(TAG, "Proximity wake lock already released");
    }
}