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

Commit c1a4decb authored by Ember Rose's avatar Ember Rose
Browse files

Annotation processing for @InspectableProperty

Test: atest --host view-inspector-annotation-processor-test
Bug: 117616612
Change-Id: Ia9641b4efae5f6945084849309f81f2d31faf2ec
parent 61ae7ed2
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -2124,6 +2124,33 @@ package android.view.inputmethod {

}

package android.view.inspector {

  public abstract class InspectableNodeName implements java.lang.annotation.Annotation {
  }

  public abstract class InspectableProperty implements java.lang.annotation.Annotation {
  }

  public static abstract class InspectableProperty.EnumMap implements java.lang.annotation.Annotation {
  }

  public static abstract class InspectableProperty.FlagMap implements java.lang.annotation.Annotation {
  }

  public static final class InspectableProperty.ValueType extends java.lang.Enum {
    method public static android.view.inspector.InspectableProperty.ValueType valueOf(java.lang.String);
    method public static final android.view.inspector.InspectableProperty.ValueType[] values();
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType COLOR;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType GRAVITY;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType INFERRED;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType INT_ENUM;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType INT_FLAG;
    enum_constant public static final android.view.inspector.InspectableProperty.ValueType NONE;
  }

}

package android.widget {

  public abstract class AbsListView extends android.widget.AdapterView implements android.widget.Filter.FilterListener android.text.TextWatcher android.view.ViewTreeObserver.OnGlobalLayoutListener android.view.ViewTreeObserver.OnTouchModeChangeListener {
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package android.view.inspector;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.SOURCE;

import android.annotation.TestApi;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

@@ -39,6 +41,7 @@ import java.lang.annotation.Target;
 */
@Target({TYPE})
@Retention(SOURCE)
@TestApi
public @interface InspectableNodeName {
    /**
     * The display name for nodes of this type.
+19 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.SOURCE;

import android.annotation.TestApi;
import android.content.res.Resources;

import java.lang.annotation.Retention;
@@ -40,6 +41,7 @@ import java.lang.annotation.Target;
 */
@Target({METHOD})
@Retention(SOURCE)
@TestApi
public @interface InspectableProperty {
    /**
     * The name of the property.
@@ -86,7 +88,6 @@ public @interface InspectableProperty {
     *
     * @return An array of {@link EnumMap}, empty if not applicable
     * @see android.annotation.IntDef
     * @see IntEnumMapping
     */
    EnumMap[] enumMapping() default {};

@@ -109,6 +110,7 @@ public @interface InspectableProperty {
     */
    @Target({TYPE})
    @Retention(SOURCE)
    @TestApi
    @interface EnumMap {
        /**
         * The string name of this enumeration value.
@@ -133,6 +135,7 @@ public @interface InspectableProperty {
     */
    @Target({TYPE})
    @Retention(SOURCE)
    @TestApi
    @interface FlagMap {
        /**
         * The string name of this flag.
@@ -167,15 +170,22 @@ public @interface InspectableProperty {
     *
     * @hide
     */
    @TestApi
    enum ValueType {
        /**
         * No special handling, property is considered to be a numeric value.
         *
         * @hide
         */
        @TestApi
        NONE,

        /**
         * The default the annotation processor infers the value type from context.
         *
         * @hide
         */
        @TestApi
        INFERRED,

        /**
@@ -184,7 +194,9 @@ public @interface InspectableProperty {
         * This is inferred if {@link #enumMapping()} is specified.
         *
         * @see EnumMap
         * @hide
         */
        @TestApi
        INT_ENUM,

        /**
@@ -193,7 +205,9 @@ public @interface InspectableProperty {
         * This is inferred if {@link #flagMapping()} is specified.
         *
         * @see FlagMap
         * @hide
         */
        @TestApi
        INT_FLAG,

        /**
@@ -203,7 +217,9 @@ public @interface InspectableProperty {
         * {@link android.annotation.ColorLong} on the getter method.
         *
         * @see android.graphics.Color
         * @hide
         */
        @TestApi
        COLOR,

        /**
@@ -212,7 +228,9 @@ public @interface InspectableProperty {
         * This type is not inferred, and is non-trivial to represent using {@link FlagMap}.
         *
         * @see android.view.Gravity
         * @hide
         */
        @TestApi
        GRAVITY
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -18,9 +18,9 @@ java_test_host {
    java_resource_dirs: ["test/resources"],

    static_libs: [
        "guava",
        "junit",
        "view-inspector-annotation-processor",
        "guava",
        "view-inspector-annotation-processor"
    ],

    test_suites: ["general-tests"],
+2 −0
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@
  "presubmit": [
    {
      "name": "view-inspector-annotation-processor-test"
    }, {
      "name": "CtsViewInspectorAnnotationProcessorTestCases"
    }
  ]
}
Loading