Example usage for android.os PowerManager isWakeLockLevelSupported

List of usage examples for android.os PowerManager isWakeLockLevelSupported

Introduction

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

Prototype

public boolean isWakeLockLevelSupported(int level) 

Source Link

Document

Returns true if the specified wake lock level is supported.

Usage

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

/**
 * Initialize variables which are activity-independent and state-independent.
 *//* ww  w.ja v  a2s. c o  m*/
protected VoicemailPlaybackPresenter(Activity activity) {
    Context context = activity.getApplicationContext();
    mAsyncTaskExecutor = AsyncTaskExecutors.createAsyncTaskExecutor();
    mVoicemailAudioManager = new VoicemailAudioManager(context, this);
    mVoicemailAsyncTaskUtil = new VoicemailAsyncTaskUtil(context.getContentResolver());
    PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
    if (powerManager.isWakeLockLevelSupported(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK)) {
        mProximityWakeLock = powerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, TAG);
    }
}