@@ -252,7 +252,7 @@ def is_installed_by_name(app_fullname):
252252 return AppManager .is_installed_by_path (f"apps/{ app_fullname } " ) or AppManager .is_installed_by_path (f"builtin/apps/{ app_fullname } " )
253253
254254 @staticmethod
255- def execute_script (script_source , is_file , classname , cwd = None ):
255+ def execute_script (script_source , is_file , classname , cwd = None , app_fullname = None ):
256256 """Run the script in the current thread. Returns True if successful."""
257257 import utime # for timing read and compile
258258 import lvgl as lv
@@ -297,13 +297,14 @@ def execute_script(script_source, is_file, classname, cwd=None):
297297 print ("Variables:" , variables .keys ())
298298 main_activity = script_globals .get (classname )
299299 if main_activity :
300- from .. app . activity import Activity
300+ from mpos . activity_navigator import ActivityNavigator
301301 from .intent import Intent
302- from mpos .activity_navigator import get_foreground_app
303302 start_time = utime .ticks_ms ()
304- Activity .startActivity (None , Intent (activity_class = main_activity , app_fullname = get_foreground_app ()))
303+ ActivityNavigator .startActivity (
304+ Intent (activity_class = main_activity , app_fullname = app_fullname )
305+ )
305306 end_time = utime .ticks_diff (utime .ticks_ms (), start_time )
306- print (f"execute_script: Activity .startActivity took { end_time } ms" )
307+ print (f"execute_script: ActivityNavigator .startActivity took { end_time } ms" )
307308 else :
308309 print (f"Warning: could not find app's main_activity { classname } " )
309310 return False
@@ -341,7 +342,13 @@ def start_app(fullname):
341342 else :
342343 entrypoint = app .main_launcher_activity .get ('entrypoint' )
343344 classname = app .main_launcher_activity .get ("classname" )
344- result = AppManager .execute_script (app .installed_path + "/" + entrypoint , True , classname , app .installed_path + "/assets/" )
345+ result = AppManager .execute_script (
346+ app .installed_path + "/" + entrypoint ,
347+ True ,
348+ classname ,
349+ app .installed_path + "/assets/" ,
350+ app_fullname = fullname ,
351+ )
345352 # Launchers have the bar, other apps don't have it
346353 import mpos .ui
347354 if app .is_valid_launcher ():
0 commit comments