Androidz指定情况下禁用和启用休眠屏幕或锁屏

在指定情况下(开始录制视频时)禁止屏幕休眠,(在结束录制视频时)启用休眠功能,该用什么方法?网上找到以下方法,可以实现此功能吗?能否解释下这两个方法是什么意思?

  public void unlock(){
                mContentResolver = getContentResolver();  
                setLockPatternEnabled(android.provider.Settings.Secure.LOCK_PATTERN_ENABLED,false);  
        }  
  private void setLockPatternEnabled(String systemSettingKey, boolean enabled) { 
     android.provider.Settings.Secure.putInt(mContentResolver, systemSettingKey,enabled ? 1 : 0);  
        }