File: ScrollCaptureResponse.java

package info (click to toggle)
android-platform-frameworks-base 1%3A14~beta1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 326,084 kB
  • sloc: java: 2,032,373; xml: 343,016; cpp: 304,181; python: 3,683; ansic: 2,090; sh: 1,871; makefile: 120; sed: 19
file content (428 lines) | stat: -rw-r--r-- 14,984 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.view;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.graphics.Rect;
import android.os.Parcelable;
import android.os.RemoteException;

import com.android.internal.util.DataClass;

import java.util.ArrayList;

/** @hide */
@DataClass(genToString = true, genGetters = true)
public class ScrollCaptureResponse implements Parcelable {

    /** Developer-facing human readable description of the result. */
    @NonNull
    private String mDescription = "";

    // Remaining fields are non-null when isConnected() == true

    /** The active connection for a successful result. */
    @Nullable
    @DataClass.MaySetToNull
    private IScrollCaptureConnection mConnection = null;

    /** The bounds of the window within the display */
    @Nullable
    private Rect mWindowBounds = null;

    /** The bounds of the scrolling content, in window space. */
    @Nullable
    private Rect mBoundsInWindow = null;

    /** The current window title. */
    @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")
    private ArrayList<String> mMessages = new ArrayList<>();

    /** Whether an active connection is present. */
    public boolean isConnected() {
        return mConnection != null && mConnection.asBinder().isBinderAlive();
    }

    /** Closes a connection returned with this response. */
    public void close() {
        if (mConnection != null) {
            try {
                mConnection.close();
            } catch (RemoteException e) {
                // Ignore
            }
            mConnection = null;
        }
    }



    // Code below generated by codegen v1.0.23.
    //
    // DO NOT MODIFY!
    // CHECKSTYLE:OFF Generated code
    //
    // To regenerate run:
    // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/view/ScrollCaptureResponse.java
    //
    // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
    //   Settings > Editor > Code Style > Formatter Control
    //@formatter:off


    @DataClass.Generated.Member
    /* package-private */ ScrollCaptureResponse(
            @NonNull String description,
            @Nullable IScrollCaptureConnection connection,
            @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(
                NonNull.class, null, mDescription);
        this.mConnection = connection;
        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);

        // onConstructed(); // You can define this method to get a callback
    }

    /**
     * Developer-facing human readable description of the result.
     */
    @DataClass.Generated.Member
    public @NonNull String getDescription() {
        return mDescription;
    }

    /**
     * The active connection for a successful result.
     */
    @DataClass.Generated.Member
    public @Nullable IScrollCaptureConnection getConnection() {
        return mConnection;
    }

    /**
     * The bounds of the window within the display
     */
    @DataClass.Generated.Member
    public @Nullable Rect getWindowBounds() {
        return mWindowBounds;
    }

    /**
     * The bounds of the scrolling content, in window space.
     */
    @DataClass.Generated.Member
    public @Nullable Rect getBoundsInWindow() {
        return mBoundsInWindow;
    }

    /**
     * The current window title.
     */
    @DataClass.Generated.Member
    public @Nullable String getWindowTitle() {
        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.
     */
    @DataClass.Generated.Member
    public @NonNull ArrayList<String> getMessages() {
        return mMessages;
    }

    @Override
    @DataClass.Generated.Member
    public String toString() {
        // You can override field toString logic by defining methods like:
        // String fieldNameToString() { ... }

        return "ScrollCaptureResponse { " +
                "description = " + mDescription + ", " +
                "connection = " + mConnection + ", " +
                "windowBounds = " + mWindowBounds + ", " +
                "boundsInWindow = " + mBoundsInWindow + ", " +
                "windowTitle = " + mWindowTitle + ", " +
                "packageName = " + mPackageName + ", " +
                "messages = " + mMessages +
        " }";
    }

    @Override
    @DataClass.Generated.Member
    public void writeToParcel(@NonNull android.os.Parcel dest, int flags) {
        // You can override field parcelling by defining methods like:
        // void parcelFieldName(Parcel dest, int flags) { ... }

        byte flg = 0;
        if (mConnection != null) flg |= 0x2;
        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);
    }

    @Override
    @DataClass.Generated.Member
    public int describeContents() { return 0; }

    /** @hide */
    @SuppressWarnings({"unchecked", "RedundantCast"})
    @DataClass.Generated.Member
    protected ScrollCaptureResponse(@NonNull android.os.Parcel in) {
        // You can override field unparcelling by defining methods like:
        // static FieldType unparcelFieldName(Parcel in) { ... }

        byte flg = in.readByte();
        String description = in.readString();
        IScrollCaptureConnection connection = (flg & 0x2) == 0 ? null : IScrollCaptureConnection.Stub.asInterface(in.readStrongBinder());
        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);

        this.mDescription = description;
        com.android.internal.util.AnnotationValidations.validate(
                NonNull.class, null, mDescription);
        this.mConnection = connection;
        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);

        // onConstructed(); // You can define this method to get a callback
    }

    @DataClass.Generated.Member
    public static final @NonNull Parcelable.Creator<ScrollCaptureResponse> CREATOR
            = new Parcelable.Creator<ScrollCaptureResponse>() {
        @Override
        public ScrollCaptureResponse[] newArray(int size) {
            return new ScrollCaptureResponse[size];
        }

        @Override
        public ScrollCaptureResponse createFromParcel(@NonNull android.os.Parcel in) {
            return new ScrollCaptureResponse(in);
        }
    };

    /**
     * A builder for {@link ScrollCaptureResponse}
     */
    @SuppressWarnings("WeakerAccess")
    @DataClass.Generated.Member
    public static class Builder {

        private @NonNull String mDescription;
        private @Nullable IScrollCaptureConnection mConnection;
        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;

        public Builder() {
        }

        /**
         * Developer-facing human readable description of the result.
         */
        @DataClass.Generated.Member
        public @NonNull Builder setDescription(@NonNull String value) {
            checkNotUsed();
            mBuilderFieldsSet |= 0x1;
            mDescription = value;
            return this;
        }

        /**
         * The active connection for a successful result.
         */
        @DataClass.Generated.Member
        public @NonNull Builder setConnection(@Nullable IScrollCaptureConnection value) {
            checkNotUsed();
            mBuilderFieldsSet |= 0x2;
            mConnection = value;
            return this;
        }

        /**
         * The bounds of the window within the display
         */
        @DataClass.Generated.Member
        public @NonNull Builder setWindowBounds(@NonNull Rect value) {
            checkNotUsed();
            mBuilderFieldsSet |= 0x4;
            mWindowBounds = value;
            return this;
        }

        /**
         * The bounds of the scrolling content, in window space.
         */
        @DataClass.Generated.Member
        public @NonNull Builder setBoundsInWindow(@NonNull Rect value) {
            checkNotUsed();
            mBuilderFieldsSet |= 0x8;
            mBoundsInWindow = value;
            return this;
        }

        /**
         * The current window title.
         */
        @DataClass.Generated.Member
        public @NonNull Builder setWindowTitle(@NonNull String value) {
            checkNotUsed();
            mBuilderFieldsSet |= 0x10;
            mWindowTitle = value;
            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 |= 0x40;
            mMessages = value;
            return this;
        }

        /** @see #setMessages */
        @DataClass.Generated.Member
        public @NonNull Builder addMessage(@NonNull String value) {
            if (mMessages == null) setMessages(new ArrayList<>());
            mMessages.add(value);
            return this;
        }

        /** Builds the instance. This builder should not be touched after calling this! */
        public @NonNull ScrollCaptureResponse build() {
            checkNotUsed();
            mBuilderFieldsSet |= 0x80; // Mark builder used

            if ((mBuilderFieldsSet & 0x1) == 0) {
                mDescription = "";
            }
            if ((mBuilderFieldsSet & 0x2) == 0) {
                mConnection = null;
            }
            if ((mBuilderFieldsSet & 0x4) == 0) {
                mWindowBounds = null;
            }
            if ((mBuilderFieldsSet & 0x8) == 0) {
                mBoundsInWindow = null;
            }
            if ((mBuilderFieldsSet & 0x10) == 0) {
                mWindowTitle = null;
            }
            if ((mBuilderFieldsSet & 0x20) == 0) {
                mPackageName = null;
            }
            if ((mBuilderFieldsSet & 0x40) == 0) {
                mMessages = new ArrayList<>();
            }
            ScrollCaptureResponse o = new ScrollCaptureResponse(
                    mDescription,
                    mConnection,
                    mWindowBounds,
                    mBoundsInWindow,
                    mWindowTitle,
                    mPackageName,
                    mMessages);
            return o;
        }

        private void checkNotUsed() {
            if ((mBuilderFieldsSet & 0x80) != 0) {
                throw new IllegalStateException(
                        "This Builder should not be reused. Use a new Builder instance instead");
            }
        }
    }

    @DataClass.Generated(
            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.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() {}


    //@formatter:on
    // End of generated code

}