Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

Improve startup process & notifying users of nonfatal component errors

Open david-allison opened this issue 10 months ago • 14 comments

Opening for discussion

  • See https://github.com/ankidroid/Anki-Android/issues/20163
  • Subset of https://github.com/ankidroid/Anki-Android/issues/19552

david-allison avatar Jan 19 '26 18:01 david-allison

Initially: investigate https://developer.android.com/jetpack/androidx/releases/startup

david-allison avatar Jan 19 '26 19:01 david-allison

@david-allison I can take on this issue. Can u assign it to me?

rudrat0319 avatar Jan 28 '26 12:01 rudrat0319

@david-allison I’m currently working on this. Apart from integrating AndroidX Startup, is there anything else you’d recommend addressing as part of this improvement?

So far, I’ve identified a few candidates for optimisation, including lazily initialising some providers. Additionally, would you like me to add a Baseline Profile as part of this change?

vibhor-kulshrestha avatar Jan 28 '26 15:01 vibhor-kulshrestha

No specific guidance here. Ideally find a framework and start with a small spike to improve a single aspect of the startup process

david-allison avatar Jan 28 '26 20:01 david-allison

@rudrat0319 @vibhor-kulshrestha ideally only one of you should work on this, unless you can divide the work

@rudrat0319 you asked first. Do you think it's feasible to split the work so two people can contribute without conflicts?

david-allison avatar Jan 28 '26 20:01 david-allison

@rudrat0319 Yesterday, I successfully set up a few initialisers using AndroidX Startup and was able to build the project without issues. I’m now considering moving some components to lazy initialization since they aren’t required during app startup. If you have already identified and implemented lazy initialization for these, please let me know and I won’t proceed further with this part. In that case, I can move on to working on baseline profiling instead.

vibhor-kulshrestha avatar Jan 29 '26 04:01 vibhor-kulshrestha

@vibhor-kulshrestha I think it's doable, but given how intertwined the startup and initialization changes are, I'd prefer to work on this end to end to avoid conflicts. I'll keep the issue updated, and if I run into any blockers i'll reach out so we can coordinate or split things up.

rudrat0319 avatar Jan 29 '26 10:01 rudrat0319

Hi @rudrat0319, are you still working on this?

There hasn’t been any update for a while. If not, could I take over from here?

Giyutomioka-SS avatar Feb 27 '26 20:02 Giyutomioka-SS

Hi @Giyutomioka-SS , yes I'm working on it. I was but caught up with other stuff which is why I couldn't update. I'm submitting the PR in a few days

rudrat0319 avatar Feb 28 '26 03:02 rudrat0319

hi @rudrat0319, what's the status on this?

david-allison avatar Mar 14 '26 12:03 david-allison

@rudrat0319 Still working on it? Else I can look into it.

Alok-Silswal avatar Mar 14 '26 15:03 Alok-Silswal

Initially: investigate https://developer.android.com/jetpack/androidx/releases/startup

https://developer.android.com/topic/libraries/app-startup

@mikehardy FYI: I'll avoid Jetpack Startup for now, unless I'm missing something (pinging as you mentioned it).

I feel we want:

  • A basic abstraction over dependencies management (context parameters allow this - should be fixed in Kotlin 2.3)
  • Timing
  • Background initialization
  • Crash & 'fatal startup error' handling

I don't think extracting each startup concern to its own class is the correct approach here, and we'd do better with splitting out onCreate into methods

david-allison avatar Mar 26 '26 03:03 david-allison

Hello 👋, this issue has been opened for more than 3 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

github-actions[bot] avatar Jun 24 '26 05:06 github-actions[bot]

Hello 👋, this issue has been opened for more than 3 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

github-actions[bot] avatar Sep 23 '26 10:09 github-actions[bot]