Lazily-initialize PhoneNumberOfflineGeocoder/PhoneNumberUtil
- They were indirectly created in VoicemailContentProvider.onCreate and
CallLogProvider.onCreate, and were slow. It was taking ~300ms on my
measurement on a nexus-s. Also it touched the filesystem, so it can
be much slower on worn-out flash or when flash is busy.
- Doing it in a provider's onCreate means it affects auto-complete
performance if acore is not started. Also it'll affect app-startup
when we merge processes.
- But they were actually only used when inserting a call log, so we don't
have to initialize them at startup.
- Inserting a call-log should be done in a worker thread, so lazy-
initialization shouldn't cause laggy UI.
(Alternatively, we could initialize them in a worker thread at startup,
but I don't think it's worth it.)
- Also, now CallLogProvider and VoicemailContentProvider share the
same instance of DefaultCallLogInsertionHelper.
(They used to have their own)
same instance of DefaultCallLogInsertionHelper doesn't have any
instance specific state, so this should be safe.
Bug 5220669
Change-Id: Ibcd664ed683507c5dcac88bec736e4903a4a7032
3 files changed