Example usage for android.app KeyguardManager inKeyguardRestrictedInputMode

List of usage examples for android.app KeyguardManager inKeyguardRestrictedInputMode

Introduction

In this page you can find the example usage for android.app KeyguardManager inKeyguardRestrictedInputMode.

Prototype

public boolean inKeyguardRestrictedInputMode() 

Source Link

Usage

From source file:com.android.app.MediaPlaybackActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    if (mService == null)
        return false;
    MenuItem item = menu.findItem(PARTY_SHUFFLE);
    if (item != null) {
        int shuffle = MusicUtils.getCurrentShuffleMode();
        if (shuffle == MediaPlaybackService.SHUFFLE_AUTO) {
            item.setIcon(R.drawable.ic_menu_party_shuffle);
            item.setTitle(R.string.party_shuffle_off);
        } else {//from   w  ww  .j  a va  2  s. c  o  m
            item.setIcon(R.drawable.ic_menu_party_shuffle);
            item.setTitle(R.string.party_shuffle);
        }
    }

    item = menu.findItem(ADD_TO_PLAYLIST);
    if (item != null) {
        SubMenu sub = item.getSubMenu();
        MusicUtils.makePlaylistMenu(this, sub);
    }

    KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
    menu.setGroupVisible(1, !km.inKeyguardRestrictedInputMode());

    return true;
}

From source file:org.videolan.vlc.gui.video.VideoPlayerActivity.java

@Override
protected void onResume() {
    super.onResume();
    //Begin delete share image
    //End delete share image

    AudioServiceController.getInstance().bindAudioService(this);
    load();/*from w ww  . j  ava 2 s  . co m*/
    /*
     * if the activity has been paused by pressing the power button,
     * pressing it again will show the lock screen.
     * But onResume will also be called, even if vlc-android is still in the background.
     * To workaround that, pause playback if the lockscreen is displayed
     */
    mHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
            if (mLibVLC != null && mLibVLC.isPlaying()) {
                KeyguardManager km = (KeyguardManager) getSystemService(KEYGUARD_SERVICE);
                if (km.inKeyguardRestrictedInputMode())
                    mLibVLC.pause();
            }
        }
    }, 500);

    showOverlay();

    // Add any selected subtitle file from the file picker
    if (mSubtitleSelectedFiles.size() > 0) {
        for (String file : mSubtitleSelectedFiles) {
            Log.i(TAG, "Adding user-selected subtitle " + file);
            mLibVLC.addSubtitleTrack(file);
        }
        /** FIXME remove when #7540 ES are not updated mid-stream
        *  a.k.a. subtitle events is fixed
        */
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                setESTrackLists(true);

                mHandler.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        setESTrackLists(true);
                    }
                }, 1200);
            }
        }, 1000);
    }
}

From source file:com.sentaroh.android.SMBSync.SMBSyncMain.java

static final private boolean isKeyguardEffective(Context mContext) {
    KeyguardManager keyguardMgr = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
    boolean result = keyguardMgr.inKeyguardRestrictedInputMode();
    return result;
}