Repository: flutter
Issue: SharedPreferences DiskReadViolation: shared preferences do work in UI thread
Labels: platform-android,customer: crowd,p: shared_preferences,package,has reproducible steps,P2,found in release: 3.3,found in release: 3.5,team-android,triaged-android

## Details

I observe slow performance on Android platform when an App starts. I see in logs that not all methods of SharedPreferences plugin work in the background. In my case I see that SharedPreferences instance is created in the main thread [please see](https://github.com/flutter/plugins/blob/5239062837ef235c614b646d3143ffda6ec57dd0/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/MethodCallHandlerImpl.java#L54). Also I see that [getAllPrefs](https://github.com/flutter/plugins/blob/5239062837ef235c614b646d3143ffda6ec57dd0/packages/shared_preferences/shared_preferences_android/android/src/main/java/io/flutter/plugins/sharedpreferences/MethodCallHandlerImpl.java#L185) works in the Main thread too.
Please move these methods into background.

**Target Platform:** Android

<details>
<summary>Logs</summary>

```bash
StrictMode policy violation; ~duration=658 ms: android.os.strictmode.DiskReadViolation
	at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1556)
	at libcore.io.BlockGuardOs.access(BlockGuardOs.java:69)
	at libcore.io.ForwardingOs.access(ForwardingOs.java:73)
	at android.app.ActivityThread$AndroidOs.access(ActivityThread.java:7246)
	at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:281)
	at java.io.File.exists(File.java:815)
	at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:645)
	at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:636)
	at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:592)
	at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:787)
	at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:439)
	at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:178)
	at io.flutter.plugins.sharedpreferences.MethodCallHandlerImpl.<init>(MethodCallHandlerImpl.java:54)
	at io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin.setupChannel(SharedPreferencesPlugin.java:36)
	at io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin.onAttachedToEngine(SharedPreferencesPlugin.java:26)
	at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.add(FlutterEngineConnectionRegistry.java:145)
	at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:199)
	at MainActivity.configureFlutterEngine(MainActivity.kt:159)
	at io.flutter.embedding.android.FlutterFragment.configureFlutterEngine(FlutterFragment.java:1183)
	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach(FlutterActivityAndFragmentDelegate.java:199)
	at io.flutter.embedding.android.FlutterFragment.onAttach(FlutterFragment.java:743)
	at androidx.fragment.app.Fragment.performAttach(Fragment.java:2922)
	at androidx.fragment.app.FragmentStateManager.attach(FragmentStateManager.java:464)
	at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:275)
	at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:2189)
	at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:2100)
	at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:2002)
	at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3138)
	at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:3072)
	at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:251)
	at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:502)
	at MainActivity.onStart(MainActivity.kt:144)
```
</details>