Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3828a5f

Browse files
Apps: cache main_launcher_activity
1 parent056db40 commit3828a5f

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

‎internal_filesystem/lib/mpos/apps.py‎

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def execute_script_new_thread(scriptname, is_file):
9393
if"camtest"inscriptname:
9494
print("Starting camtest with extra stack size!")
9595
stack=32*1024
96-
elif"appstore"inscriptname:
96+
elif"appstore"inscriptname:
9797
print("Starting appstore with extra stack size!")
9898
stack=24*1024# this doesn't do anything because it's all started in the same thread
9999
else:
@@ -111,17 +111,16 @@ def start_app(fullname):
111111
start_time=utime.ticks_ms()
112112
app=PackageManager.get(fullname)
113113
ifnotapp:
114-
print(f"Warning: start_appcould notfind app{fullname}, aborting...")
114+
print(f"Warning: start_appcan'tfind app{fullname}")
115115
return
116116
ifnotapp.installed_path:
117-
print(f"Warning: start_appcould not find installed_path for{fullname}, aborting...")
117+
print(f"Warning: start_appcan't start{fullname} because no it doesn't have an installed_path")
118118
return
119-
main_launcher_activity=PackageManager.find_main_launcher_activity(app)
120-
ifnotmain_launcher_activity:
121-
print(f"WARNING: can't start{fullname} because no main_launcher_activity was found.")
119+
ifnotapp.main_launcher_activity:
120+
print(f"WARNING: start_app can't start{fullname} because it doesn't have a main_launcher_activity")
122121
return
123-
start_script_fullpath=f"{app.installed_path}/{main_launcher_activity.get('entrypoint')}"
124-
execute_script(start_script_fullpath,True,app.installed_path+"/assets/",main_launcher_activity.get("classname"))
122+
start_script_fullpath=f"{app.installed_path}/{app.main_launcher_activity.get('entrypoint')}"
123+
execute_script(start_script_fullpath,True,app.installed_path+"/assets/",app.main_launcher_activity.get("classname"))
125124
# Launchers have the bar, other apps don't have it
126125
ifPackageManager.is_launcher(fullname):
127126
mpos.ui.topmenu.open_bar()
@@ -137,7 +136,7 @@ def restart_launcher():
137136
# No need to stop the other launcher first, because it exits after building the screen
138137
forappinmpos.package_manager.PackageManager.get_app_list():
139138
#print(f"checking {app}")
140-
ifapp.category=="launcher"andPackageManager.find_main_launcher_activity(app):
139+
ifapp.category=="launcher"andapp.main_launcher_activity:# if it's a launcher and it has a main_launcher_activity
141140
print(f"Found launcher, starting{app.fullname}")
142141
start_app(app.fullname)
143142

@@ -157,6 +156,7 @@ def __init__(self, name, publisher, short_description, long_description, icon_ur
157156
self.image_dsc=None
158157
self.activities=activities
159158
self.installed_path=installed_path
159+
self.main_launcher_activity=self._find_main_launcher_activity()
160160

161161
def__str__(self):
162162
return (f"App(name='{self.name}', "
@@ -167,6 +167,22 @@ def __str__(self):
167167
f"activities='{self.activities}', "
168168
f"installed_path={self.installed_path})")
169169

170+
def_find_main_launcher_activity(self):
171+
result=None
172+
foractivityinself.activities:
173+
ifnotactivity.get("entrypoint")ornotactivity.get("classname"):
174+
print(f"Warning: activity{activity} has no entrypoint and classname, skipping...")
175+
continue
176+
print("checking activity's intent_filters...")
177+
forintent_filterinactivity.get("intent_filters"):
178+
print("checking intent_filter...")
179+
ifintent_filter.get("action")=="main"andintent_filter.get("category")=="launcher":
180+
print("found main_launcher!")
181+
result=activity
182+
break
183+
returnresult
184+
185+
170186
defparse_manifest(appdir):
171187
print(f"parse_manifest({appdir})")
172188
manifest_path=f"{appdir}/META-INF/MANIFEST.JSON"

‎internal_filesystem/lib/mpos/package_manager.py‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -220,22 +220,6 @@ def is_installed_by_name(app_fullname):
220220
print(f"Checking if app{app_fullname} is installed...")
221221
returnPackageManager.is_installed_by_path(f"apps/{app_fullname}")orPackageManager.is_installed_by_path(f"builtin/apps/{app_fullname}")
222222

223-
@staticmethod
224-
deffind_main_launcher_activity(app):
225-
result=None
226-
foractivityinapp.activities:
227-
ifnotactivity.get("entrypoint")ornotactivity.get("classname"):
228-
print(f"Warning: activity{activity} has no entrypoint and classname, skipping...")
229-
continue
230-
print("checking activity's intent_filters...")
231-
forintent_filterinactivity.get("intent_filters"):
232-
print("checking intent_filter...")
233-
ifintent_filter.get("action")=="main"andintent_filter.get("category")=="launcher":
234-
print("found main_launcher!")
235-
result=activity
236-
break
237-
returnresult
238-
239223
@staticmethod
240224
defis_launcher(app_name):
241225
print(f"checking is_launcher for{app_name}")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp