Skip to content

ImagePickerPlugin has StrictMode violations for disk read/write on the main thread #100966

Closed as not planned
@math1man

Description

@math1man

Plugins should not perform disk I/O during app startup, as this can lead to jank and bad performance.

03-29 04:51:07.460  2877  2877 D StrictMode: StrictMode policy violation; ~duration=315 ms: android.os.strictmode.DiskReadViolation
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1596)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at libcore.io.BlockGuardOs.access(BlockGuardOs.java:71)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at libcore.io.ForwardingOs.access(ForwardingOs.java:72)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.ActivityThread$AndroidOs.access(ActivityThread.java:7533)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:281)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at java.io.File.exists(File.java:815)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.ContextImpl.getDataDir(ContextImpl.java:2539)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:626)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:853)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:475)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:188)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:188)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at io.flutter.plugins.imagepicker.ImagePickerCache.<init>(ImagePickerCache.java:53)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at io.flutter.plugins.imagepicker.ImagePickerPlugin.constructDelegate(ImagePickerPlugin.java:282)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at io.flutter.plugins.imagepicker.ImagePickerPlugin$ActivityState.<init>(ImagePickerPlugin.java:120)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at io.flutter.plugins.imagepicker.ImagePickerPlugin.setup(ImagePickerPlugin.java:269)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at io.flutter.plugins.imagepicker.ImagePickerPlugin.onAttachedToActivity(ImagePickerPlugin.java:240)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.attachToActivityInternal(FlutterEngineConnectionRegistry.java:345)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.attachToActivity(FlutterEngineConnectionRegistry.java:324)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at internal.elided.FooFlutterFragment.onCreate()
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.support.v4.app.Fragment.performCreate(Fragment.java:2981)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.support.v4.app.FragmentStateManager.create(FragmentStateManager.java:474)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.support.v4.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:257)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.support.v4.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.support.v4.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.support.v4.app.FragmentManager.execSingleAction(FragmentManager.java:1670)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.support.v4.app.BackStackRecord.commitNow(BackStackRecord.java:317)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at internal.elided.FooActivity.onStart()
03-29 04:51:07.460  2877  2877 D StrictMode: 	at androidx.lifecycle.FullLifecycleObserverAdapter.onStateChanged(FullLifecycleObserverAdapter.java:39)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.java:354)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at androidx.lifecycle.LifecycleRegistry.forwardPass(LifecycleRegistry.java:265)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at androidx.lifecycle.LifecycleRegistry.sync(LifecycleRegistry.java:307)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at androidx.lifecycle.LifecycleRegistry.moveToState(LifecycleRegistry.java:148)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:134)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at com.google.apps.tiktok.inject.baseclasses.TracedActivityLifecycleRegistry.handleLifecycleEvent(TracedActivityLifecycleRegistry.java:27)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at androidx.lifecycle.ReportFragment.dispatch(ReportFragment.java:68)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at androidx.lifecycle.ReportFragment$LifecycleCallbacks.onActivityPostStarted(ReportFragment.java:187)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.Activity.dispatchActivityPostStarted(Activity.java:1362)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.Activity.performStart(Activity.java:8055)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3475)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.os.Handler.dispatchMessage(Handler.java:106)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.os.Looper.loop(Looper.java:223)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at android.app.ActivityThread.main(ActivityThread.java:7656)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at java.lang.reflect.Method.invoke(Native Method)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
03-29 04:51:07.460  2877  2877 D StrictMode: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 2.10Found to occur in 2.10found in release: 2.13Found to occur in 2.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: image_pickerThe Image Picker plugin.packageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyr: duplicateIssue is closed as a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions