summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-08-28 00:59:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-08-28 00:59:09 +0000
commiteadfd77b6e5b2197fa436631037612985a9ef029 (patch)
tree3b4fdae62e78cab929f38a1b3c8f8a8c50a909e0 /core/java
parentec69eca0fb5e49c791c40a2dff03213649b8a61f (diff)
parentbf1c1fca55345e88956b605a1ba7f67d9e33f312 (diff)
Merge "Add comments about mData in TypedArray."
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/content/res/TypedArray.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/core/java/android/content/res/TypedArray.java b/core/java/android/content/res/TypedArray.java
index 30d2d5f73206..508626bdd869 100644
--- a/core/java/android/content/res/TypedArray.java
+++ b/core/java/android/content/res/TypedArray.java
@@ -85,11 +85,47 @@ public class TypedArray {
/*package*/ XmlBlock.Parser mXml;
@UnsupportedAppUsage
/*package*/ Resources.Theme mTheme;
+ /**
+ * mData is used to hold the value/id and other metadata about each attribute.
+ *
+ * [type, data, asset cookie, resource id, changing configuration, density]
+ *
+ * type - type of this attribute, see TypedValue#TYPE_*
+ *
+ * data - can be used in various ways:
+ * a) actual value of the attribute if type is between #TYPE_FIRST_INT and #TYPE_LAST_INT
+ * 1) color represented by an integer (#TYPE_INT_COLOR_*)
+ * 2) boolean represented by an integer (#TYPE_INT_BOOLEAN)
+ * 3) integer number (#TYPE_TYPE_INT_DEC or #TYPE_INT_HEX)
+ * 4) float number where integer gets interpreted as float (#TYPE_FLOAT, #TYPE_FRACTION
+ * and #TYPE_DIMENSION)
+ * b) index into string block inside AssetManager (#TYPE_STRING)
+ * c) attribute resource id in the current theme/style (#TYPE_ATTRIBUTE)
+ *
+ * asset cookie - used in two ways:
+ * a) for strings, drawables, and fonts it specifies the set of apk assets to look at
+ * (multi-apk case)
+ * b) cookie + asset as a unique identifier for drawable caches
+ *
+ * resource id - id that was finally used to resolve this attribute
+ *
+ * changing configuration - a mask of the configuration parameters for which the values in this
+ * attribute may change
+ *
+ * density - density of drawable pointed to by this attribute
+ */
@UnsupportedAppUsage
/*package*/ int[] mData;
+ /**
+ * Pointer to the start of the memory address of mData. It is passed via JNI and used to write
+ * to mData array directly from native code (AttributeResolution.cpp).
+ */
/*package*/ long mDataAddress;
@UnsupportedAppUsage
/*package*/ int[] mIndices;
+ /**
+ * Similar to mDataAddress, but instead it is a pointer to mIndices address.
+ */
/*package*/ long mIndicesAddress;
@UnsupportedAppUsage
/*package*/ int mLength;