Skip to content

Android: Main thread I/O in discovery and model deletion #8

@0xharkirat

Description

@0xharkirat

Priority: Medium

Several file and package operations run synchronously on the main thread:

  1. OacpDiscoveryHandler.discoverOacpApps() — iterates all installed packages and reads ContentProvider streams on main thread. Can cause ANR on devices with many apps.

  2. LocalModelStorageHandler.deleteBackup() and findBackup()file.exists(), file.length(), file.delete() run on main thread. Deleting a multi-GB model file can block noticeably.

Recommended fix

Move both to background threads using the same postSuccess/postError pattern already used by saveBackup and restoreBackup.

Files

  • android/app/src/main/kotlin/com/oacp/hark/OacpDiscoveryHandler.kt (line 17)
  • android/app/src/main/kotlin/com/oacp/hark/LocalModelStorageHandler.kt (lines 48, 82-84)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions