Fix RescueParty querying DeviceConfig before SettingsProvider ready

It turns out that PackageWatchdog will invoke
RescuePartyObserver.onBootloop very early in the boot sequence(in startBootstrapServices), thus calling into isDisabled() which calls into DeviceConfig.getBoolean before SettingProvider is initialized(in startOtherServices), thus causing an NPE thrown from SettingsProvider.

Since we registered namespace "configuration" in
SettingsToProperiesMapper.java, DeviceConfig flags from "configuration"
will be synced to corresponding persistent sys props. Thus instead of querying DeviceConfig, we can query the system property which is ready at the time that onBootloop is called.

Note that the race condition won't cause a problem to DeviceConfig reset
on bootloop, since:
   1. executeRescueLevel will swallow the exception when reset is
   attempted before SettingsProvider initialized. Thus won't crashing
   system server.
   2. onSettingsProviderPublished will retry the reset based the
   incremented rescue level set in executeBootLoopMitigation

Bug:152346219
Test: 1. atest RescuePartyTest 2. manually turn on the flag via adb
device_config and observe RescuePary is disable during systemui
crashloop.

Change-Id: Idde46ee5872bc3107cbc8a2ab05b3e1de028d998
2 files changed