Loading core/java/android/view/View.java +1 −1 Original line number Diff line number Diff line Loading @@ -29794,7 +29794,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // accessibility CharSequence contentDescription = getContentDescription(); stream.addProperty("accessibility:contentDescription", stream.addUserProperty("accessibility:contentDescription", contentDescription == null ? "" : contentDescription.toString()); stream.addProperty("accessibility:labelFor", getLabelFor()); stream.addProperty("accessibility:importantForAccessibility", getImportantForAccessibility()); core/java/android/view/ViewDebug.java +1 −0 Original line number Diff line number Diff line Loading @@ -1209,6 +1209,7 @@ public class ViewDebug { ByteArrayOutputStream baOut = new ByteArrayOutputStream(); final ViewHierarchyEncoder encoder = new ViewHierarchyEncoder(baOut); encoder.setUserPropertiesEnabled(false); encoder.addProperty("window:left", view.mAttachInfo.mWindowLeft); encoder.addProperty("window:top", view.mAttachInfo.mWindowTop); view.encode(encoder); Loading core/java/android/view/ViewHierarchyEncoder.java +17 −0 Original line number Diff line number Diff line Loading @@ -66,10 +66,16 @@ public class ViewHierarchyEncoder { private short mPropertyId = 1; private Charset mCharset = Charset.forName("utf-8"); private boolean mUserPropertiesEnabled = true; public ViewHierarchyEncoder(@NonNull ByteArrayOutputStream stream) { mStream = new DataOutputStream(stream); } public void setUserPropertiesEnabled(boolean enabled) { mUserPropertiesEnabled = enabled; } public void beginObject(@NonNull Object o) { startPropertyMap(); addProperty("meta:__name__", o.getClass().getName()); Loading Loading @@ -120,6 +126,17 @@ public class ViewHierarchyEncoder { writeString(s); } /** * Encodes a user defined property if they are allowed to be encoded * * @see #setUserPropertiesEnabled(boolean) */ public void addUserProperty(@NonNull String name, @Nullable String s) { if (mUserPropertiesEnabled) { addProperty(name, s); } } /** * Writes the given name as the property name, and leaves it to the callee * to fill in value for this property. Loading core/java/android/widget/TextView.java +1 −1 Original line number Diff line number Diff line Loading @@ -13174,7 +13174,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener stream.addProperty("text:selectionStart", getSelectionStart()); stream.addProperty("text:selectionEnd", getSelectionEnd()); stream.addProperty("text:curTextColor", mCurTextColor); stream.addProperty("text:text", mText == null ? null : mText.toString()); stream.addUserProperty("text:text", mText == null ? null : mText.toString()); stream.addProperty("text:gravity", mGravity); } Loading Loading
core/java/android/view/View.java +1 −1 Original line number Diff line number Diff line Loading @@ -29794,7 +29794,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // accessibility CharSequence contentDescription = getContentDescription(); stream.addProperty("accessibility:contentDescription", stream.addUserProperty("accessibility:contentDescription", contentDescription == null ? "" : contentDescription.toString()); stream.addProperty("accessibility:labelFor", getLabelFor()); stream.addProperty("accessibility:importantForAccessibility", getImportantForAccessibility());
core/java/android/view/ViewDebug.java +1 −0 Original line number Diff line number Diff line Loading @@ -1209,6 +1209,7 @@ public class ViewDebug { ByteArrayOutputStream baOut = new ByteArrayOutputStream(); final ViewHierarchyEncoder encoder = new ViewHierarchyEncoder(baOut); encoder.setUserPropertiesEnabled(false); encoder.addProperty("window:left", view.mAttachInfo.mWindowLeft); encoder.addProperty("window:top", view.mAttachInfo.mWindowTop); view.encode(encoder); Loading
core/java/android/view/ViewHierarchyEncoder.java +17 −0 Original line number Diff line number Diff line Loading @@ -66,10 +66,16 @@ public class ViewHierarchyEncoder { private short mPropertyId = 1; private Charset mCharset = Charset.forName("utf-8"); private boolean mUserPropertiesEnabled = true; public ViewHierarchyEncoder(@NonNull ByteArrayOutputStream stream) { mStream = new DataOutputStream(stream); } public void setUserPropertiesEnabled(boolean enabled) { mUserPropertiesEnabled = enabled; } public void beginObject(@NonNull Object o) { startPropertyMap(); addProperty("meta:__name__", o.getClass().getName()); Loading Loading @@ -120,6 +126,17 @@ public class ViewHierarchyEncoder { writeString(s); } /** * Encodes a user defined property if they are allowed to be encoded * * @see #setUserPropertiesEnabled(boolean) */ public void addUserProperty(@NonNull String name, @Nullable String s) { if (mUserPropertiesEnabled) { addProperty(name, s); } } /** * Writes the given name as the property name, and leaves it to the callee * to fill in value for this property. Loading
core/java/android/widget/TextView.java +1 −1 Original line number Diff line number Diff line Loading @@ -13174,7 +13174,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener stream.addProperty("text:selectionStart", getSelectionStart()); stream.addProperty("text:selectionEnd", getSelectionEnd()); stream.addProperty("text:curTextColor", mCurTextColor); stream.addProperty("text:text", mText == null ? null : mText.toString()); stream.addUserProperty("text:text", mText == null ? null : mText.toString()); stream.addProperty("text:gravity", mGravity); } Loading