Describe the bug
We're trying to detect all the disk access from main thread via Android's Strict mode. One of the disk write violations is related to LDClient.identify function. Since it returns Future, we do expect it doesn't do any heavy/blocking operations under the hood. But internally, it may call SharedPrefsFlagStore.delete which is doing blocking IO.
Stacktrace
```
android.os.strictmode.DiskWriteViolation: null
at android.os.StrictMode$AndroidBlockGuardPolicy.onWriteToDisk(StrictMode.java:1512)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:250)
at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7296)
at libcore.io.IoBridge.open(IoBridge.java:482)
at java.io.FileOutputStream.(FileOutputStream.java:235)
at java.io.FileOutputStream.(FileOutputStream.java:186)
at android.app.SharedPreferencesImpl.createFileOutputStream(SharedPreferencesImpl.java:677)
at android.app.SharedPreferencesImpl.writeToFile(SharedPreferencesImpl.java:768)
at android.app.SharedPreferencesImpl.access$900(SharedPreferencesImpl.java:55)
at android.app.SharedPreferencesImpl$2.run(SharedPreferencesImpl.java:647)
at android.app.SharedPreferencesImpl.enqueueDiskWrite(SharedPreferencesImpl.java:666)
at android.app.SharedPreferencesImpl.access$100(SharedPreferencesImpl.java:55)
at android.app.SharedPreferencesImpl$EditorImpl.commit(SharedPreferencesImpl.java:585)
at com.launchdarkly.sdk.android.SharedPrefsFlagStore.delete(SharedPrefsFlagStore.java:43)
at com.launchdarkly.sdk.android.SharedPrefsFlagStoreManager.switchToUser(SharedPrefsFlagStoreManager.java:78)
at com.launchdarkly.sdk.android.DefaultUserManager.setCurrentUser(DefaultUserManager.java:85)
at com.launchdarkly.sdk.android.LDClient.identifyInternal(LDClient.java:312)
at com.launchdarkly.sdk.android.LDClient.identifyInstances(LDClient.java:335)
at com.launchdarkly.sdk.android.LDClient.identify(LDClient.java:301)
```
Expected behavior
LDClient.identify returns the Future as quick as possible without doing any IO operation
SDK version
3.1.3
OS/platform
Android, not specific version
Additional context
Currently we're going to move it off main thread, please let us know if there is any issue related to it.
Thank you for reporting this. I've added a task to our backlog that would refactor .identify() to only write to SharedPreferences on a background thread.
Describe the bug We're trying to detect all the disk access from main thread via Android's Strict mode. One of the disk write violations is related to LDClient.identify function. Since it returns Future, we do expect it doesn't do any heavy/blocking operations under the hood. But internally, it may call SharedPrefsFlagStore.delete which is doing blocking IO.
Stacktrace
``` android.os.strictmode.DiskWriteViolation: null at android.os.StrictMode$AndroidBlockGuardPolicy.onWriteToDisk(StrictMode.java:1512) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:250) at libcore.io.ForwardingOs.open(ForwardingOs.java:167) at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7296) at libcore.io.IoBridge.open(IoBridge.java:482) at java.io.FileOutputStream.Expected behavior LDClient.identify returns the Future as quick as possible without doing any IO operation
SDK version 3.1.3
OS/platform Android, not specific version
Additional context Currently we're going to move it off main thread, please let us know if there is any issue related to it.