@@ -96,14 +96,15 @@ def adb_twrp_wipe_and_install(bin_path: Path, target: str) -> bool:
9696 Only works for twrp recovery.
9797 """
9898 logger .info ("Wipe and format data with twrp, then install os image." )
99- sleep (1 )
99+ sleep (7 )
100100 result = run_command ("adb" , ["shell" , "twrp" , "format" , "data" ], bin_path )
101101 if result .returncode != 0 :
102102 logger .info ("Formatting data failed." )
103103 return False
104104 # wipe some partitions
105- for partition in ["cache" , "system" , "dalvik" ]:
105+ for partition in ["cache" , "system" ]:
106106 result = run_command ("adb" , ["shell" , "twrp" , "wipe" , partition ], bin_path )
107+ sleep (1 )
107108 if result .returncode != 0 :
108109 logger .info (f"Wiping { partition } failed." )
109110 return False
@@ -114,21 +115,22 @@ def adb_twrp_wipe_and_install(bin_path: Path, target: str) -> bool:
114115 logger .info ("Activating sideload failed." )
115116 return False
116117 # now flash os image
117- sleep (1 )
118+ sleep (5 )
118119 logger .info ("Sideload and install os image." )
119120 result = run_command ("adb" , ["sideload" , f"{ target } " ], bin_path )
120121 if result .returncode != 0 :
121122 logger .info (f"Sideloading { target } failed." )
122123 return False
123124 # wipe some cache partitions
124- sleep (1 )
125+ sleep (5 )
125126 for partition in ["cache" , "dalvik" ]:
126127 result = run_command ("adb" , ["shell" , "twrp" , "wipe" , partition ], bin_path )
128+ sleep (1 )
127129 if result .returncode != 0 :
128130 logger .info (f"Wiping { partition } failed." )
129131 return False
130132 # finally reboot into os
131- sleep (1 )
133+ sleep (5 )
132134 logger .info ("Reboot into OS." )
133135 result = run_command ("adb" , ["shell" , "twrp" , "reboot" ], bin_path )
134136 if result .returncode != 0 :
0 commit comments