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

Commit b9b310a9 authored by Hyunyoung Song's avatar Hyunyoung Song Committed by Android (Google) Code Review
Browse files

Merge "Fix OverlayInfo API"

parents 1cf61976 fa0257a8
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1457,14 +1457,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;

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

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

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

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

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

    /**
@@ -243,6 +239,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");