Skip to content

Initial key generation hangs UI rendering #116

Closed

Description

@morrica

The initial key generation on first run will hang UI rendering including initial Widget paints or animations. This is a big issue for a live app because a new user's first impression will be that the app is clunky and slow to load.

This appears to only affect running on real devices, perhaps because the emulator is able to use underlying PC hardware generate the key faster than is noticeable.

As is, this issue prevents the app from loading any UI for between 5 and 30 seconds on first launch on a Pixel 3 running latest Android 10 build QQ2A.200305.002.

Modifying FlutterSecureStoragePlugin.java to wait for an actual channel method call to initialize the StorageCipher will result in animations completely hanging for a similar period of time.

An example app that demonstrates the problem is included below. To reproduce the issue, run the given app on a real device and time the period before the LoadingScreen is rendered. Then time it a second time after the StorageCipher has been initialized. To retest the first run case you can clear the app's storage on the test device.

test_app.zip

Activity

  1. added a commit that references this issue on May 3, 2020
  2. gargakshit commented on May 12, 2020

    @gargakshit

    I encountered the same issue yesterday, and it seems like either we have to use isolate or manually delay the key generation (workaround)

  3. morrica commented on May 12, 2020

    @morrica
    ContributorAuthor

    @gargakshit, this issue has been fixed in the merged commit above. The fix has not yet been pushed to pub.dev, but you can depend on github code directly in your pubspec.yaml if necessary.

  4. gargakshit commented on May 13, 2020

    @gargakshit

    Cool, I'll use the git version. Thanks for the timely response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions