File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,5 +26,6 @@ poetry.lock
2626.vscode
2727
2828# MSB asset
29+ logs /
2930asset /environments /resource /apks
3031asset /environments /resource /wallpapers_bmp
Original file line number Diff line number Diff line change 11import os
22import subprocess
3+ import requests
34
45from dataclasses import dataclass
56from minimal_task_runner import _find_adb_directory
@@ -26,6 +27,27 @@ def _init_env():
2627 return True
2728
2829def _init_apk ():
30+ apk_path = lambda filename : os .path .join (
31+ os .environ ["MOBILE_SAFETY_HOME" ],
32+ "asset/environments/resource/apks" ,
33+ filename
34+ )
35+
36+ def download (filename , url ):
37+ if os .path .exists (apk_path (filename )):
38+ return
39+
40+ with requests .get (url , stream = True ) as response :
41+ response .raise_for_status ()
42+ with open (apk_path (filename ), "wb" ) as file :
43+ for chunk in response .iter_content (chunk_size = 8192 ):
44+ file .write (chunk )
45+
46+ download ("Joplin.apk" , "..." )
47+ download ("PhotoNote.apk" , "..." )
48+ download ("SimpleCalendarPro.apk" , "..." )
49+ download ("StockTrainer.apk" , "..." )
50+
2951 return True
3052
3153@dataclass
@@ -71,4 +93,5 @@ def init():
7193
7294if __name__ == "__main__" :
7395 _init_env ()
96+ _init_apk ()
7497 _init_avd ()
You can’t perform that action at this time.
0 commit comments