Skip to content

FlutterLoader needs to respect StrictMode non-main thread IO access #56145

@xster

Description

@xster
at android.content.ContextWrapper.getDir(ContextWrapper.java:281)
at io.flutter.util.PathUtils.getDataDirectory(PathUtils.java:16)
at io.flutter.embedding.engine.loader.FlutterLoader.initResources(FlutterLoader.java:301)
at io.flutter.embedding.engine.loader.FlutterLoader.startInitialization(FlutterLoader.java:118)

at dalvik.system.BaseDexClassLoader.findLibrary(BaseDexClassLoader.java:122)
at java.lang.Runtime.loadLibrary0(Runtime.java:1005)
at java.lang.System.loadLibrary(System.java:1657)
at io.flutter.embedding.engine.loader.FlutterLoader.startInitialization(FlutterLoader.java:120)

at android.content.ContextWrapper.getDir(ContextWrapper.java:281)
at io.flutter.util.PathUtils.getDataDirectory(PathUtils.java:16)
at io.flutter.embedding.engine.loader.FlutterLoader.ensureInitializationComplete(FlutterLoader.java:178)

at android.content.ContextWrapper.getCodeCacheDir(ContextWrapper.java:261)
at io.flutter.util.PathUtils.getCacheDirectory(PathUtils.java:21)
at io.flutter.embedding.engine.loader.FlutterLoader.ensureInitializationComplete(FlutterLoader.java:198)

are making I/O calls on the main thread. Make the entire startInitialization asynchronous. Move getCacheDirectory and getDataDirectory from ensureInitializationComplete to startInitialization.

cc @mehmetf @jason-simmons

Metadata

Metadata

Assignees

Labels

c: performanceRelates to speed or footprint issues (see "perf:" labels)engineflutter/engine related. See also e: labels.platform-androidAndroid applications specifically

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions