diff --git a/api/system-current.txt b/api/system-current.txt index 3a260083c24a0..021a26c705dd2 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -1322,6 +1322,7 @@ package android.content.om { public class OverlayManager { method public java.util.List getOverlayInfosForTarget(@Nullable String, int); + method public boolean setEnabled(@Nullable String, boolean, int); method public boolean setEnabledExclusiveInCategory(@Nullable String, int); } diff --git a/core/java/android/content/om/OverlayManager.java b/core/java/android/content/om/OverlayManager.java index 7a2220bfddb67..8e72fa5e1cfdc 100644 --- a/core/java/android/content/om/OverlayManager.java +++ b/core/java/android/content/om/OverlayManager.java @@ -54,6 +54,7 @@ public class OverlayManager { this(context, IOverlayManager.Stub.asInterface( ServiceManager.getService(Context.OVERLAY_SERVICE))); } + /** * Request that an overlay package is enabled and any other overlay packages with the same * target package and category are disabled. @@ -74,6 +75,26 @@ public class OverlayManager { } } + /** + * Request that an overlay package is enabled. + * + * @param packageName the name of the overlay package to enable. + * @param enable {@code false} if the overlay should be turned off. + * @param userId The user for which to change the overlay. + * @return true if the system successfully registered the request, false otherwise. + * + * @hide + */ + @SystemApi + public boolean setEnabled(@Nullable final String packageName, final boolean enable, + int userId) { + try { + return mService.setEnabled(packageName, enable, userId); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + /** * Returns information about all overlays for the given target package for * the specified user. The returned list is ordered according to the