diff options
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/content/om/OverlayManager.java | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 8c78b21eee5c..dc01fbcacb86 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -1478,6 +1478,7 @@ package android.content.om { } public class OverlayManager { + method @Nullable public android.content.om.OverlayInfo getOverlayInfo(@NonNull String, @NonNull android.os.UserHandle); method public java.util.List<android.content.om.OverlayInfo> 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 8e72fa5e1cfd..ceea0435a254 100644 --- a/core/java/android/content/om/OverlayManager.java +++ b/core/java/android/content/om/OverlayManager.java @@ -16,12 +16,14 @@ package android.content.om; +import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.annotation.SystemService; import android.content.Context; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.UserHandle; import java.util.List; @@ -96,6 +98,28 @@ public class OverlayManager { } /** + * Returns information about the overlay with the given package name for + * the specified user. + * + * @param packageName The name of the package. + * @param userHandle The user to get the OverlayInfos for. + * @return An OverlayInfo object; if no overlays exist with the + * requested package name, null is returned. + * + * @hide + */ + @SystemApi + @Nullable + public OverlayInfo getOverlayInfo(@NonNull final String packageName, + @NonNull final UserHandle userHandle) { + try { + return mService.getOverlayInfo(packageName, userHandle.myUserId()); + } 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 * overlay priority with the highest priority at the end of the list. |