Beispiel #1
0
 def sync_device_to_host(self, device_dir, host_dir):
     cmd = "adb-sync -s %s --reverse %s %s" % (self.serial, device_dir,
                                               host_dir)
     result = exeute_cmd(cmd)
     if "Total: " not in result:
         log.warning("%s sync %s Failed." % (self.serial, device_dir))
     else:
         log.success("%s sync %s succeed." % (self.serial, device_dir))
Beispiel #2
0
 def flash_manually_build(self):
     cmd = [
         "cd %s" % self.cfg["original_image_path"],
         "source build/envsetup.sh", self.cfg["lunch_command"],
         "/usr/bin/adb -s %s reboot bootloader" % self.serial, "sleep 5",
         "/usr/bin/fastboot -s %s flashing unlock" % self.serial,
         "/usr/bin/fastboot -s %s flashall -w" % self.serial
     ]
     cmd = "\n".join(cmd)
     result = exeute_cmd(cmd)
     log.info(result)
     log.success("finish flashing manually build image.")
     sleep(30)
Beispiel #3
0
 def flash_santizier_image(self):
     log.info("start flashing sanitizier image.")
     cmd = [
         "cd %s\n" % self.cfg["sanitizer_image_path"],
         "source build/envsetup.sh", self.cfg["lunch_command"],
         "/usr/bin/adb -s %s reboot bootloader" % self.serial, "sleep 5",
         "/usr/bin/fastboot -s %s flashing unlock" % self.serial,
         "/usr/bin/fastboot -s %s flash userdata" % self.serial,
         "/usr/bin/fastboot -s %s flashall" % self.serial
     ]
     cmd = "\n".join(cmd)
     result = exeute_cmd(cmd)
     log.info(result)
     # wait until boot completed
     log.success("finish flashing sanitizier image.")
     sleep(30)
Beispiel #4
0
 def wipe_userdata_and_cache(self):
     log.info("start wiping userdata and cache.")
     cmd = [
         "/usr/bin/adb -s %s reboot bootloader" % self.serial,
         "sleep 5",
         "/usr/bin/fastboot -s %s boot %s" %
         (self.serial, self.cfg["twrp_img_path"]),
         "sleep 25",
         "/usr/bin/adb -s %s shell recovery --wipe_data" % self.serial,
     ]
     cmd = "\n".join(cmd)
     result = exeute_cmd(cmd)
     log.info(result)
     if "I:AB_OTA_UPDATER := true" in result:
         log.success("wiping userdata and cache succeed.")
     else:
         log.warning("wiping userdata and cache failed.")
     # wait until boot completed
     sleep(30)
Beispiel #5
0
 def flash_factory(self):
     cmd = [
         "cd %s" % self.cfg["original_image_path"],
         "source build/envsetup.sh",
         self.cfg["lunch_command"],
         "cd %s" % self.cfg["factory_image_path"],
         "/usr/bin/adb -s " + self.serial + " " + "reboot bootloader",
         "sleep 5",
         "/usr/bin/fastboot -s %s flash bootloader bootloader-taimen-tmz20r.img"
         % self.serial,
         "/usr/bin/fastboot -s %s reboot-bootloader" % self.serial,
         "sleep 5",
         "/usr/bin/fastboot -s %s flash radio radio-taimen-g8998-00008-1902121845.img"
         % self.serial,
         "/usr/bin/fastboot -s %s reboot-bootloader" % self.serial,
         "sleep 5",
         "/usr/bin/fastboot -s %s -w update image-taimen-pq3a.190801.002.zip"
         % self.serial,
     ]
     cmd = "\n".join(cmd)
     result = exeute_cmd(cmd)
     log.info(result)
     log.success("finish flashing factory image.")
     sleep(30)
Beispiel #6
0
 def adb(self, cmd):
     adb_prefix = '/usr/bin/adb -s ' + self.serial
     return exeute_cmd(adb_prefix + " " + cmd)
Beispiel #7
0
 def host_shell(self, cmdline):
     return exeute_cmd(cmdline)