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

Commit 5078f4e7 authored by Nader Jawad's avatar Nader Jawad
Browse files

Addressing API Review feedback

Marked Insets class as final and added nullability
annotations for static factory methods

Change-Id: Id2092704e0e464bf783a5f33a90cad2e37972b57
Fixes: 113855954
Test: re-ran CTS test cases
parent e074ef59
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -13784,7 +13784,7 @@ package android.graphics {
    field public static final int YV12 = 842094169; // 0x32315659
  }
  public class Insets {
  public final class Insets {
    method public static android.graphics.Insets of(int, int, int, int);
    method public static android.graphics.Insets of(android.graphics.Rect);
    field public static final android.graphics.Insets NONE;
+6 −3
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package android.graphics;

import android.annotation.NonNull;
import android.annotation.Nullable;

/**
 * An Insets instance holds four integer offsets which describe changes to the four
 * edges of a Rectangle. By convention, positive values move edges towards the
@@ -24,7 +27,7 @@ package android.graphics;
 * Insets are immutable so may be treated as values.
 *
 */
public class Insets {
public final class Insets {
    public static final Insets NONE = new Insets(0, 0, 0, 0);

    public final int left;
@@ -51,7 +54,7 @@ public class Insets {
     *
     * @return Insets instance with the appropriate values
     */
    public static Insets of(int left, int top, int right, int bottom) {
    public static @NonNull Insets of(int left, int top, int right, int bottom) {
        if (left == 0 && top == 0 && right == 0 && bottom == 0) {
            return NONE;
        }
@@ -65,7 +68,7 @@ public class Insets {
     *
     * @return an Insets instance with the appropriate values
     */
    public static Insets of(Rect r) {
    public static @NonNull Insets of(@Nullable Rect r) {
        return (r == null) ? NONE : of(r.left, r.top, r.right, r.bottom);
    }