Example #1
0
 def root(self):
     cmd = "%sroot " % self._target()
     L.debug(str(self._adb(cmd)))
     self.kill()
     if self.WIFI: self.tcpip()
     else: self.usb()
     self.connect()
Example #2
0
 def am(self, cmd):
     """
         Interface of Android 'am' Command.
         :arg string cmd: android command.
         :return string: adb result
     """
     if "am" in cmd:
         L.debug("command include [am]. : %s" % cmd)
     cmd = "am %s" % cmd
     return self._adb.shell(cmd)
Example #3
0
 def getprop(self, prop):
     """
         Interface of Android 'getprop' Command.
         :arg string prop: property name. ex) ro.secure
         :return string: adb result.
     """
     if "getprop" in prop:
         L.debug("command include [getprop]. : %s" % prop)
     cmd = "getprop %s" % prop
     return self._adb.shell(cmd)
Example #4
0
 def input(self, cmd):
     """
         Interface of Android Input Command.
         :arg string cmd: command.
         :return string: adb result.
     """
     if "input" in cmd:
         L.debug("command include [input]. : %s" % cmd)
     cmd = "input %s" % cmd
     return self._adb.shell(cmd)
Example #5
0
 def setprop(self, prop, value):
     """
         Interface of Android 'setprop' Command.
         :arg string prop: property name
         :arg string value: property value
         :return string: adb result.
     """
     if "setprop" in prop:
         L.debug("command include [setprop]. : %s" % prop)
     cmd = "setprop %s %s" % (prop, value)
     return self._adb.shell(cmd)
Example #6
0
 def _set_profile(self, name):
     class_name = "_" + name
     for fdn in os.listdir(PROFILE_PATH):
         try:
             if fdn.endswith("__init__.py"):
                 pass
             elif fdn.endswith(".py") and (name in fdn):
                 prof = fdn.replace(".py", "")
                 f,n,d = imp.find_module(str(prof))
                 module = imp.load_module(prof,f,n,d)
                 self.profile = getattr(module, class_name)
                 self.profile.SERIAL = name
         except Exception as e:
             L.debug('=== Error Exception ===')
             L.debug('type     : ' + str(type(e)))
             L.debug('args     : ' + str(e.args))
             L.debug('message  : ' + e.message)
             L.debug('e        : ' + str(e))
Example #7
0
 def shell(self, cmd, timeout=TIMEOUT):
     if "shell" in cmd:
         L.debug("command include [shell]. : %s" % cmd)
     cmd = "%sshell %s" % (self._target(), cmd)
     return self._adb(cmd, timeout)
Example #8
0
 def pull(self, src, dst):
     L.debug("[pull]. : %s -> %s" % (src, dst))
     cmd = "%spull %s %s" % (self._target(), src, dst)
     return self._adb(cmd)
Example #9
0
 def _adb(self, cmd, timeout=TIMEOUT):
     if "adb" in cmd:
         L.debug("command include [adb]. : %s" % cmd)
     cmd = "adb %s" % cmd
     return self.__exec(cmd, timeout)
Example #10
0
 def _text(self, cmd):
     if "text" in cmd:
         L.debug("command include [text]. : %s" % cmd)
     cmd = "text %s" % cmd
     return self.input(cmd)
Example #11
0
 def remount(self):
     L.info(self._adb.remount());time.sleep(5)
Example #12
0
 def remount(self):
     cmd = "%sremount " % self._target()
     L.debug(self._adb(cmd))
Example #13
0
 def kill(self):
     L.debug("Kill This Process.")
     self.proc.terminate()
Example #14
0
 def adb(self, cmd, timeout=TIMEOUT):
     if "adb" in cmd:
         L.debug("command include [adb]. : %s" % cmd)
     cmd = "%s %s" % (self._target(), cmd)
     return self._adb(cmd, timeout)
Example #15
0
 def uninstall(self, application):
     cmd = "%suninstall %s" % (self._target(), application)
     L.debug(self._adb(cmd))
Example #16
0
 def install(self, application, timeout=TIMEOUT):
     cmd = "%sinstall -r %s" % (self._target(), application)
     L.debug(self._adb(cmd, timeout))
Example #17
0
 def restart(self):
     cmd = "%sreboot" % self._target()
     L.debug(self._adb(cmd))