Allow mutable overlays to be enabled by default

When an overlay is not specified as immutable through OverlayConfig,
enabling the overlay using the OverlayConfig `enable` attribute makes
the overlay enabled by default.

When an overlay is scanned by the OverlayManagerService for the first
time, the default-enabled state will be applied to the overlay. If the
configured default-enabled state changes in a subsequent boot, the
default-enabled state will not be applied to the overlay.

This means OTAs cannot change a mutable overlay from default-enabled
to default-disabled (or vice-versa) and except the configured enabled
state to take effect.

When the device is factory reset, then the configured enabled state
will be applied. If a package is removed from the device in one OTA
and added back to the device in a future OTA, the configured enabled
state will be applied. If an overlay changes its target package or
target overlayable, then the configured enabled state will be applied.
If an immutable overlay becomes mutable, then the configured enabled
state will be applied.

Bug: 149499802
Test: atest OverlayManagerServiceImplRebootTests
Change-Id: I24f86591ac811ef2b836da36ef5574a82628b151
4 files changed