Ejemplo n.º 1
0
class SystemProperty(object):

    def __init__(self):
        self.adbCmd = AdbCommand()

    def currentActivityName(self):
        time.sleep(2.0)
        sub = self.adbCmd.adbShell('dumpsys window -a|%s mCurrentFocus'%(INFO.GREP))
        strList = sub.stdout.readlines()
        strTemp = strList[len(strList)-1]
        if strTemp.find('/')<0:
            return ''
        strTemp = strTemp.split('/')[1]
        strTemp = strTemp.split('}')[0]
        strTemp = strTemp.split(' ')[0]
        return strTemp
        
    def displayWidth(self):
        x,y = self.getDisplay().split('x')
        if int(x) > int(y):
            return y
        return x

    def displayHeight(self):
        x,y = self.getDisplay().split('x')
        if int(x) > int(y):
            return x
        return y
    
    
    def getDisplay(self):
        sub = self.adbCmd.adbShell('dumpsys window|%s init'%(INFO.GREP))
        strTemp = sub.stdout.readline()
        strTemp = strTemp.split('=')[1]
        strTemp = strTemp.split(' ')[0]
        return strTemp.strip()
        
Ejemplo n.º 2
0
 def __init__(self):
     '''
     '''
     self.adbCmd = AdbCommand()
Ejemplo n.º 3
0
 def __init__(self):
     self.adbCmd = AdbCommand()
Ejemplo n.º 4
0
class MonkeyDevice(object):
    def __init__(self):
        self.adbCmd = AdbCommand()
    
    def press(self,keycode):
        self.adbCmd.press(keycode)
        
    def touch(self, x, y):
        self.adbCmd.touch(x,y)

    def drag(self, x, y, toX, toY, duration=''):
        self.adbCmd.drag(x, y, toX, toY, duration)
    
    def startActivity(self, component=''):
        self.adbCmd.startActivity(component)
    
    def takeSnapshot(self, fileName, pathName):
        self.adbCmd.takeSnapshot(fileName, pathName)
    
    def installPackage(self, path):
        self.adbCmd.installPackage(path)
    
    def uninstallPackage(self, packageName):
        self.adbCmd.uninstallPackage(packageName)
        
    def shell(self, cmd):
        return self.adbCmd.shell(cmd)
    
    def input(self,text):
        self.adbCmd.input(text)
        
    def clearLog(self):
        self.adbCmd.clearLog()
        
    def clearAppData(self, packageName):
        self.adbCmd.clearAppData(packageName)
    
    def getLogCat(self, logPath):
        self.adbCmd.getLogCat(logPath)
    
    def getDeviceSerial(self):
        return self.adbCmd.getDeviceSerial()
    
    def getDeviceName(self):
        return self.adbCmd.getDeviceName()
    
    def getLogPath(self,scriptPath):
        return self.adbCmd.getLogPath(scriptPath)

    def closeApp(self, packageName):
        self.adbCmd.closeApp(packageName)
    
    def getSystemProp(self, value):
        return self.adbCmd.getSystemProp(value)
    
    def screenIsLock(self):
        """"""
        return self.adbCmd.screenIsLock()
Ejemplo n.º 5
0
class MonkeyDevice(object):
    def __init__(self):
        self.adbCmd = AdbCommand()

    def press(self, keycode):
        self.adbCmd.press(keycode)

    def touch(self, x, y):
        self.adbCmd.touch(x, y)

    def drag(self, x, y, toX, toY, duration=''):
        self.adbCmd.drag(x, y, toX, toY, duration)

    def startActivity(self, component=''):
        self.adbCmd.startActivity(component)

    def takeSnapshot(self, fileName, pathName):
        self.adbCmd.takeSnapshot(fileName, pathName)

    def installPackage(self, path):
        self.adbCmd.installPackage(path)

    def uninstallPackage(self, packageName):
        self.adbCmd.uninstallPackage(packageName)

    def shell(self, cmd):
        return self.adbCmd.shell(cmd)

    def input(self, text):
        self.adbCmd.input(text)

    def clearLog(self):
        self.adbCmd.clearLog()

    def clearAppData(self, packageName):
        self.adbCmd.clearAppData(packageName)

    def getLogCat(self, logPath):
        self.adbCmd.getLogCat(logPath)

    def getDeviceSerial(self):
        return self.adbCmd.getDeviceSerial()

    def getDeviceName(self):
        return self.adbCmd.getDeviceName()

    def getLogPath(self, scriptPath):
        return self.adbCmd.getLogPath(scriptPath)

    def closeApp(self, packageName):
        self.adbCmd.closeApp(packageName)

    def getSystemProp(self, value):
        return self.adbCmd.getSystemProp(value)

    def screenIsLock(self):
        """"""
        return self.adbCmd.screenIsLock()