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

Commit bfd143d1 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Removing possible user defined strings from bugreport view-dump" into...

Merge "Removing possible user defined strings from bugreport view-dump" into rvc-dev am: 31c94a2f am: dabe69fe am: f9edbbd5

Change-Id: Ifa12d776426d64ff913f14fa7a762d5503335516
parents 4b236599 f9edbbd5
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -29794,7 +29794,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        // accessibility
        // accessibility
        CharSequence contentDescription = getContentDescription();
        CharSequence contentDescription = getContentDescription();
        stream.addProperty("accessibility:contentDescription",
        stream.addUserProperty("accessibility:contentDescription",
                contentDescription == null ? "" : contentDescription.toString());
                contentDescription == null ? "" : contentDescription.toString());
        stream.addProperty("accessibility:labelFor", getLabelFor());
        stream.addProperty("accessibility:labelFor", getLabelFor());
        stream.addProperty("accessibility:importantForAccessibility", getImportantForAccessibility());
        stream.addProperty("accessibility:importantForAccessibility", getImportantForAccessibility());
+1 −0
Original line number Original line Diff line number Diff line
@@ -1209,6 +1209,7 @@ public class ViewDebug {
        ByteArrayOutputStream baOut = new ByteArrayOutputStream();
        ByteArrayOutputStream baOut = new ByteArrayOutputStream();


        final ViewHierarchyEncoder encoder = new ViewHierarchyEncoder(baOut);
        final ViewHierarchyEncoder encoder = new ViewHierarchyEncoder(baOut);
        encoder.setUserPropertiesEnabled(false);
        encoder.addProperty("window:left", view.mAttachInfo.mWindowLeft);
        encoder.addProperty("window:left", view.mAttachInfo.mWindowLeft);
        encoder.addProperty("window:top", view.mAttachInfo.mWindowTop);
        encoder.addProperty("window:top", view.mAttachInfo.mWindowTop);
        view.encode(encoder);
        view.encode(encoder);
+17 −0
Original line number Original line Diff line number Diff line
@@ -66,10 +66,16 @@ public class ViewHierarchyEncoder {
    private short mPropertyId = 1;
    private short mPropertyId = 1;
    private Charset mCharset = Charset.forName("utf-8");
    private Charset mCharset = Charset.forName("utf-8");


    private boolean mUserPropertiesEnabled = true;

    public ViewHierarchyEncoder(@NonNull ByteArrayOutputStream stream) {
    public ViewHierarchyEncoder(@NonNull ByteArrayOutputStream stream) {
        mStream = new DataOutputStream(stream);
        mStream = new DataOutputStream(stream);
    }
    }


    public void setUserPropertiesEnabled(boolean enabled) {
        mUserPropertiesEnabled = enabled;
    }

    public void beginObject(@NonNull Object o) {
    public void beginObject(@NonNull Object o) {
        startPropertyMap();
        startPropertyMap();
        addProperty("meta:__name__", o.getClass().getName());
        addProperty("meta:__name__", o.getClass().getName());
@@ -120,6 +126,17 @@ public class ViewHierarchyEncoder {
        writeString(s);
        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
     * Writes the given name as the property name, and leaves it to the callee
     * to fill in value for this property.
     * to fill in value for this property.
+1 −1
Original line number Original line Diff line number Diff line
@@ -13174,7 +13174,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        stream.addProperty("text:selectionStart", getSelectionStart());
        stream.addProperty("text:selectionStart", getSelectionStart());
        stream.addProperty("text:selectionEnd", getSelectionEnd());
        stream.addProperty("text:selectionEnd", getSelectionEnd());
        stream.addProperty("text:curTextColor", mCurTextColor);
        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);
        stream.addProperty("text:gravity", mGravity);
    }
    }