def isLocked(self):
        '''
        Checks if the device screen is locked.

        @return True if the device screen is locked
        '''

        self.__checkTransport()
        lockScreenRE = re.compile('mShowingLockscreen=(true|false)')
        dwp = self.shell('dumpsys window policy')
        m = lockScreenRE.search(dwp)
        if m:
            return m.group(1) == 'true'
        dreamingLockscreenRE = re.compile('mDreamingLockscreen=(true|false)')
        m = dreamingLockscreenRE.search(dwp)
        if m:
            return m.group(1) == 'true'
        raise RuntimeError("Couldn't determine screen lock state")
def isLocked ( self ) : self . __checkTransport ( ) lockScreenRE = re . compile ( 'mShowingLockscreen=(true|false)' ) dwp = self . shell ( 'dumpsys window policy' ) m = lockScreenRE . search ( dwp ) if m : return m . group ( 1 ) == 'true' dreamingLockscreenRE = re . compile ( 'mDreamingLockscreen=(true|false)' ) m = dreamingLockscreenRE . search ( dwp ) if m : return m . group ( 1 ) == 'true' raise RuntimeError ( "Couldn't determine screen lock state" )
Checks if the device screen is locked.

        @return True if the device screen is locked