def current_app(self):
        """Return the current app."""
        current_focus = self.adb_shell(CURRENT_APP_CMD)
        if current_focus is None:
            return None

        current_focus = current_focus.replace("\r", "")
        matches = WINDOW_REGEX.search(current_focus)

        # case 1: current app was successfully found
        if matches:
            (pkg, activity) = matches.group("package", "activity")
            return {"package": pkg, "activity": activity}

        # case 2: current app could not be found
        logging.warning("Couldn't get current app, reply was %s", current_focus)
        return None
def current_app ( self ) : current_focus = self . adb_shell ( CURRENT_APP_CMD ) if current_focus is None : return None current_focus = current_focus . replace ( "\r" , "" ) matches = WINDOW_REGEX . search ( current_focus ) if matches : ( pkg , activity ) = matches . group ( "package" , "activity" ) return { "package" : pkg , "activity" : activity } logging . warning ( "Couldn't get current app, reply was %s" , current_focus ) return None
Return the current app.