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

Commit 04bcff1e authored by Mark Renouf's avatar Mark Renouf
Browse files

Return packageName to scroll capture requests from SysUI

Bug: 195013652
Test: manual
Change-Id: Ib623e34031b7a5117d9c5afb439fc382f9c77dd1
parent da84c20c
Loading
Loading
Loading
Loading
+42 −7
Original line number Diff line number Diff line
@@ -53,6 +53,10 @@ public class ScrollCaptureResponse implements Parcelable {
    @Nullable
    private String mWindowTitle = null;

    /** The package which owns the window. */
    @Nullable
    private String mPackageName = null;

    /** Carries additional logging and debugging information when enabled. */
    @NonNull
    @DataClass.PluralOf("message")
@@ -77,7 +81,7 @@ public class ScrollCaptureResponse implements Parcelable {



    // Code below generated by codegen v1.0.22.
    // Code below generated by codegen v1.0.23.
    //
    // DO NOT MODIFY!
    // CHECKSTYLE:OFF Generated code
@@ -97,6 +101,7 @@ public class ScrollCaptureResponse implements Parcelable {
            @Nullable Rect windowBounds,
            @Nullable Rect boundsInWindow,
            @Nullable String windowTitle,
            @Nullable String packageName,
            @NonNull ArrayList<String> messages) {
        this.mDescription = description;
        com.android.internal.util.AnnotationValidations.validate(
@@ -105,6 +110,7 @@ public class ScrollCaptureResponse implements Parcelable {
        this.mWindowBounds = windowBounds;
        this.mBoundsInWindow = boundsInWindow;
        this.mWindowTitle = windowTitle;
        this.mPackageName = packageName;
        this.mMessages = messages;
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mMessages);
@@ -152,6 +158,14 @@ public class ScrollCaptureResponse implements Parcelable {
        return mWindowTitle;
    }

    /**
     * The package name of the process the window is owned by.
     */
    @DataClass.Generated.Member
    public @Nullable String getPackageName() {
        return mPackageName;
    }

    /**
     * Carries additional logging and debugging information when enabled.
     */
@@ -172,6 +186,7 @@ public class ScrollCaptureResponse implements Parcelable {
                "windowBounds = " + mWindowBounds + ", " +
                "boundsInWindow = " + mBoundsInWindow + ", " +
                "windowTitle = " + mWindowTitle + ", " +
                "packageName = " + mPackageName + ", " +
                "messages = " + mMessages +
        " }";
    }
@@ -187,12 +202,14 @@ public class ScrollCaptureResponse implements Parcelable {
        if (mWindowBounds != null) flg |= 0x4;
        if (mBoundsInWindow != null) flg |= 0x8;
        if (mWindowTitle != null) flg |= 0x10;
        if (mPackageName != null) flg |= 0x20;
        dest.writeByte(flg);
        dest.writeString(mDescription);
        if (mConnection != null) dest.writeStrongInterface(mConnection);
        if (mWindowBounds != null) dest.writeTypedObject(mWindowBounds, flags);
        if (mBoundsInWindow != null) dest.writeTypedObject(mBoundsInWindow, flags);
        if (mWindowTitle != null) dest.writeString(mWindowTitle);
        if (mPackageName != null) dest.writeString(mPackageName);
        dest.writeStringList(mMessages);
    }

@@ -213,6 +230,7 @@ public class ScrollCaptureResponse implements Parcelable {
        Rect windowBounds = (flg & 0x4) == 0 ? null : (Rect) in.readTypedObject(Rect.CREATOR);
        Rect boundsInWindow = (flg & 0x8) == 0 ? null : (Rect) in.readTypedObject(Rect.CREATOR);
        String windowTitle = (flg & 0x10) == 0 ? null : in.readString();
        String packageName = (flg & 0x20) == 0 ? null : in.readString();
        ArrayList<String> messages = new ArrayList<>();
        in.readStringList(messages);

@@ -223,6 +241,7 @@ public class ScrollCaptureResponse implements Parcelable {
        this.mWindowBounds = windowBounds;
        this.mBoundsInWindow = boundsInWindow;
        this.mWindowTitle = windowTitle;
        this.mPackageName = packageName;
        this.mMessages = messages;
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mMessages);
@@ -256,6 +275,7 @@ public class ScrollCaptureResponse implements Parcelable {
        private @Nullable Rect mWindowBounds;
        private @Nullable Rect mBoundsInWindow;
        private @Nullable String mWindowTitle;
        private @Nullable String mPackageName;
        private @NonNull ArrayList<String> mMessages;

        private long mBuilderFieldsSet = 0L;
@@ -318,13 +338,24 @@ public class ScrollCaptureResponse implements Parcelable {
            return this;
        }

        /**
         * The package name of the process the window is owned by.
         */
        @DataClass.Generated.Member
        public @NonNull Builder setPackageName(@NonNull String value) {
            checkNotUsed();
            mBuilderFieldsSet |= 0x20;
            mPackageName = value;
            return this;
        }

        /**
         * Carries additional logging and debugging information when enabled.
         */
        @DataClass.Generated.Member
        public @NonNull Builder setMessages(@NonNull ArrayList<String> value) {
            checkNotUsed();
            mBuilderFieldsSet |= 0x20;
            mBuilderFieldsSet |= 0x40;
            mMessages = value;
            return this;
        }
@@ -340,7 +371,7 @@ public class ScrollCaptureResponse implements Parcelable {
        /** Builds the instance. This builder should not be touched after calling this! */
        public @NonNull ScrollCaptureResponse build() {
            checkNotUsed();
            mBuilderFieldsSet |= 0x40; // Mark builder used
            mBuilderFieldsSet |= 0x80; // Mark builder used

            if ((mBuilderFieldsSet & 0x1) == 0) {
                mDescription = "";
@@ -358,6 +389,9 @@ public class ScrollCaptureResponse implements Parcelable {
                mWindowTitle = null;
            }
            if ((mBuilderFieldsSet & 0x20) == 0) {
                mPackageName = null;
            }
            if ((mBuilderFieldsSet & 0x40) == 0) {
                mMessages = new ArrayList<>();
            }
            ScrollCaptureResponse o = new ScrollCaptureResponse(
@@ -366,12 +400,13 @@ public class ScrollCaptureResponse implements Parcelable {
                    mWindowBounds,
                    mBoundsInWindow,
                    mWindowTitle,
                    mPackageName,
                    mMessages);
            return o;
        }

        private void checkNotUsed() {
            if ((mBuilderFieldsSet & 0x40) != 0) {
            if ((mBuilderFieldsSet & 0x80) != 0) {
                throw new IllegalStateException(
                        "This Builder should not be reused. Use a new Builder instance instead");
            }
@@ -379,10 +414,10 @@ public class ScrollCaptureResponse implements Parcelable {
    }

    @DataClass.Generated(
            time = 1614833185795L,
            codegenVersion = "1.0.22",
            time = 1628630366187L,
            codegenVersion = "1.0.23",
            sourceFile = "frameworks/base/core/java/android/view/ScrollCaptureResponse.java",
            inputSignatures = "private @android.annotation.NonNull java.lang.String mDescription\nprivate @android.annotation.Nullable @com.android.internal.util.DataClass.MaySetToNull android.view.IScrollCaptureConnection mConnection\nprivate @android.annotation.Nullable android.graphics.Rect mWindowBounds\nprivate @android.annotation.Nullable android.graphics.Rect mBoundsInWindow\nprivate @android.annotation.Nullable java.lang.String mWindowTitle\nprivate @android.annotation.NonNull @com.android.internal.util.DataClass.PluralOf(\"message\") java.util.ArrayList<java.lang.String> mMessages\npublic  boolean isConnected()\npublic  void close()\nclass ScrollCaptureResponse extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genGetters=true)")
            inputSignatures = "private @android.annotation.NonNull java.lang.String mDescription\nprivate @android.annotation.Nullable @com.android.internal.util.DataClass.MaySetToNull android.view.IScrollCaptureConnection mConnection\nprivate @android.annotation.Nullable android.graphics.Rect mWindowBounds\nprivate @android.annotation.Nullable android.graphics.Rect mBoundsInWindow\nprivate @android.annotation.Nullable java.lang.String mWindowTitle\nprivate @android.annotation.Nullable java.lang.String mPackageName\nprivate @android.annotation.NonNull @com.android.internal.util.DataClass.PluralOf(\"message\") java.util.ArrayList<java.lang.String> mMessages\npublic  boolean isConnected()\npublic  void close()\nclass ScrollCaptureResponse extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genGetters=true)")
    @Deprecated
    private void __metadata() {}

+1 −0
Original line number Diff line number Diff line
@@ -9493,6 +9493,7 @@ public final class ViewRootImpl implements ViewParent,

        ScrollCaptureResponse.Builder response = new ScrollCaptureResponse.Builder();
        response.setWindowTitle(getTitle().toString());
        response.setPackageName(mContext.getPackageName());

        StringWriter writer =  new StringWriter();
        IndentingPrintWriter pw = new IndentingPrintWriter(writer);