Skip to content

[Bug]: #495

@Jawnnypoo

Description

@Jawnnypoo

What happened?

When we run with StrictMode on:

        StrictMode.setThreadPolicy(
            StrictMode.ThreadPolicy.Builder()
                .detectNetwork()
                .detectCustomSlowCalls()
                .detectDiskReads()
                .detectDiskWrites()
                .penaltyLog()
                .build(),
        )

        StrictMode.setVmPolicy(
            StrictMode.VmPolicy.Builder()
                .detectActivityLeaks()
                .detectLeakedClosableObjects()
                .detectLeakedRegistrationObjects()
                .detectLeakedSqlLiteObjects()
                .detectFileUriExposure()
                .penaltyLog()
                .penaltyDeath()
                .build(),
        )

we get a violation from Flocon:

StrictMode policy violation; ~duration=625 ms: android.os.strictmode.DiskReadViolation (Fix with AI)
                 	at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1728)
                 	at libcore.io.BlockGuardOs.access(BlockGuardOs.java:74)
                 	at libcore.io.ForwardingOs.access(ForwardingOs.java:128)
                 	at android.app.ActivityThread$AndroidOs.access(ActivityThread.java:8944)
                 	at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:332)
                 	at java.io.File.exists(File.java:829)
                 	at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:818)
                 	at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:809)
                 	at android.app.ContextImpl.getFilesDir(ContextImpl.java:854)
                 	at android.content.ContextWrapper.getFilesDir(ContextWrapper.java:288)
                 	at io.github.openflocon.flocon.plugins.network.FloconNetworkDataSourceAndroid.loadMocksFromFile(FloconNetworkPluginImpl.android.kt:37)
                 	at io.github.openflocon.flocon.plugins.network.FloconNetworkPluginImpl.<init>(FloconNetworkPluginImpl.kt:50)
                 	at io.github.openflocon.flocon.client.FloconClientImpl.<init>(FloconClientImpl.kt:76)
                 	at io.github.openflocon.flocon.FloconCore.initializeFlocon(FloconCore.kt:32)
                 	at io.github.openflocon.flocon.Flocon.initialize(Flocon.kt:21)
                 	at com.example.client.flocon.FloconImpl.init(FloconImpl.kt:18)
                 	at com.example.client.Application.onCreate(Application.kt:163)
                 	at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1381)
                 	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7830)
                 	at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
                 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2546)
                 	at android.os.Handler.dispatchMessage(Handler.java:110)
                 	at android.os.Looper.loopOnce(Looper.java:248)
                 	at android.os.Looper.loop(Looper.java:338)
                 	at android.app.ActivityThread.main(ActivityThread.java:9067)
                 	at java.lang.reflect.Method.invoke(Native Method)
                 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593)
                 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:932)

Would it be possible for it to move this to a Flow or coroutine?

Version

1.6.6

What platform are you seeing the problem on?

Mobile

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions