Do not attempt to retrieve the job scheduler or the app hibernation
manager before they should be available.
SystemServiceRegistry.getSystemService does not allow querying service
instances before they have been registered, so we cannot
opportunistically do that in code paths that may be run from the
ArtManagerLocal constructor or onBoot. Hence we need to switch to a
more principled approach to avoid calling it in those cases.
JobScheduler may not be requested from the constructor, so delay
creation of the BackgroundDexoptJob instance until the getter is
called.
AppHibernationManager may not be requested in onBoot. Continue to use
the compilation reason to identify it. That way those reasons behave
consistently even if a later dexopt operation uses one of them.
Test: Boot with dalvik.vm.useartservice=true and check that ART Service
comes up and that logcat that no "Manager wrapper not available" wtf
messages are logged from getSystemService.
Test: atest ArtServiceTests art_libartservice_tests
Bug: 266028904
Ignore-AOSP-First: ART Services
Change-Id: I387be74b32f361141c0446ac97cb8383a7286bf3
4 files changed