Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa0257a8 authored by Hyunyoung Song's avatar Hyunyoung Song
Browse files

Fix OverlayInfo API

Bug: 124402715
Test: builds

Change-Id: I1618d3c019802a15278f0aaa65df1d6a849b6c9c
parent 9c4a902b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1458,14 +1458,14 @@ package android.content.om {
  public final class OverlayInfo implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public String getCategory();
    method @NonNull public String getPackageName();
    method @Nullable public String getTargetOverlayableName();
    method @Nullable public String getTargetPackageName();
    method public int getUserId();
    method public boolean isEnabled();
    method public void writeToParcel(android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.content.om.OverlayInfo> CREATOR;
    field public final String category;
    field public final String packageName;
    field public final String targetOverlayableName;
    field public final String targetPackageName;
    field public final int userId;
  }
  public class OverlayManager {
+51 −5
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.UserIdInt;
import android.os.Parcel;
import android.os.Parcelable;

@@ -128,7 +129,6 @@ public final class OverlayInfo implements Parcelable {
     *
     * @hide
     */
    @SystemApi
    public final String packageName;

    /**
@@ -136,7 +136,6 @@ public final class OverlayInfo implements Parcelable {
     *
     * @hide
     */
    @SystemApi
    public final String targetPackageName;

    /**
@@ -144,7 +143,6 @@ public final class OverlayInfo implements Parcelable {
     *
     * @hide
     */
    @SystemApi
    public final String targetOverlayableName;

    /**
@@ -152,7 +150,6 @@ public final class OverlayInfo implements Parcelable {
     *
     * @hide
     */
    @SystemApi
    public final String category;

    /**
@@ -171,7 +168,6 @@ public final class OverlayInfo implements Parcelable {
     * User handle for which this overlay applies
     * @hide
     */
    @SystemApi
    public final int userId;

    /**
@@ -236,6 +232,56 @@ public final class OverlayInfo implements Parcelable {
        ensureValidState();
    }

    /**
     * Returns package name of the current overlay.
     * @hide
     */
    @SystemApi
    @NonNull
    public String getPackageName() {
        return packageName;
    }

    /**
     * Returns the target package name of the current overlay.
     * @hide
     */
    @SystemApi
    @Nullable
    public String getTargetPackageName() {
        return targetPackageName;
    }

    /**
     * Returns the category of the current overlay.
     * @hide\
     */
    @SystemApi
    @Nullable
    public String getCategory() {
        return category;
    }

    /**
     * Returns user handle for which this overlay applies to.
     * @hide
     */
    @SystemApi
    @UserIdInt
    public int getUserId() {
        return userId;
    }

    /**
     * Returns name of the target overlayable declaration.
     * @hide
     */
    @SystemApi
    @Nullable
    public String getTargetOverlayableName() {
        return targetOverlayableName;
    }

    private void ensureValidState() {
        if (packageName == null) {
            throw new IllegalArgumentException("packageName must not be null");