Class ShadowOverlayManager
OverlayManager
.
This shadow exists because the overlays managed by the OverlayManager require set up at the Android base image level. This is not something that can exist for host level unit tests.
To simulate the image configuration, unit tests must call the addOverlayInfo(android.content.om.OverlayInfo)
function
to define the available overlays.
This basic shadow only implements the getOverlayInfo(java.lang.String,android.os.UserHandle)
and setEnabled(java.lang.String,boolean,android.os.UserHandle)
functions,
enabling a basic workflow for enabling or disabling Runtime Resource Overlays (RROs). It enforces
the android.permissions.CHANGE_OVERLAY_PACKAGES permission.
It does not validate the android.permission.INTERACT_ACROSS_USERS or android.INTERACT_ACROSS_USERS_FULL permissions, which are necessary when changing packages owned by a different user.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addOverlayInfo
(OverlayInfo overlayInfo) Adds or replaces the overlay based on the packageName.protected OverlayInfo
getOverlayInfo
(String packageName, UserHandle userHandle) void
removeOverlayInfo
(String packageName) Removes an overlay with the specified packageName if it is present.protected void
setEnabled
(String packageName, boolean enable, UserHandle user)
-
Constructor Details
-
ShadowOverlayManager
public ShadowOverlayManager()
-
-
Method Details
-
addOverlayInfo
Adds or replaces the overlay based on the packageName. Expected to be used by unit tests to setup the expected overlays. -
removeOverlayInfo
Removes an overlay with the specified packageName if it is present. If not present, nothing happens. -
getOverlayInfo
-
setEnabled
-