Debian Codegraph @

core/java/android/view/InputMonitor.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package android.view;
18
19 import android.annotation.NonNull;
20 import android.os.Parcel;
21 import android.os.Parcelable;
22 import android.os.RemoteException;
23
24 import com.android.internal.util.DataClass;
25
26 /**
27 * An {@code InputMonitor} allows privileged applications and components to monitor streams of
28 * {@link InputEvent}s without having to be the designated recipient for the event.
29 *
30 * For example, focus dispatched events would normally only go to the focused window on the
31 * targeted display, but an {@code InputMonitor} will also receive a copy of that event if they're
32 * registered to monitor that type of event on the targeted display.
33 *
34 * @hide
35 */
36 @DataClass(genToString = true)
37 public final class InputMonitor implements Parcelable {
38 private static final String TAG = "InputMonitor";
39
40 private static final boolean DEBUG = false;
41
42 @NonNull
43 private final InputChannel mInputChannel;
44 @NonNull
45 private final IInputMonitorHost mHost;
46
47
48 /**
49 * Takes all of the current pointer events streams that are currently being sent to this
50 * monitor and generates appropriate cancellations for the windows that would normally get
51 * them.
52 *
53 * This method should be used with caution as unexpected pilfering can break fundamental user
54 * interactions.
55 */
56 public void pilferPointers() {
57 try {
58 mHost.pilferPointers();
59 } catch (RemoteException e) {
60 e.rethrowFromSystemServer();
61 }
62 }
63
64 /**
65 * Disposes the input monitor.
66 *
67 * Explicitly release all of the resources this monitor is holding on to (e.g. the
68 * InputChannel). Once this method is called, this monitor and any resources it's provided may
69 * no longer be used.
70 */
71 public void dispose() {
72 mInputChannel.dispose();
73 try {
74 mHost.dispose();
75 } catch (RemoteException e) {
76 e.rethrowFromSystemServer();
77 }
78 }
79
80
81
82 // Code below generated by codegen v1.0.23.
83 //
84 // DO NOT MODIFY!
85 // CHECKSTYLE:OFF Generated code
86 //
87 // To regenerate run:
88 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/view/InputMonitor.java
89 //
90 // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
91 // Settings > Editor > Code Style > Formatter Control
92 //@formatter:off
93
94
95 @DataClass.Generated.Member
96 public InputMonitor(
97 @NonNull InputChannel inputChannel,
98 @NonNull IInputMonitorHost host) {
99 this.mInputChannel = inputChannel;
100 com.android.internal.util.AnnotationValidations.validate(
101 NonNull.class, null, mInputChannel);
102 this.mHost = host;
103 com.android.internal.util.AnnotationValidations.validate(
104 NonNull.class, null, mHost);
105
106 // onConstructed(); // You can define this method to get a callback
107 }
108
109 @DataClass.Generated.Member
110 public @NonNull InputChannel getInputChannel() {
111 return mInputChannel;
112 }
113
114 @DataClass.Generated.Member
115 public @NonNull IInputMonitorHost getHost() {
116 return mHost;
117 }
118
119 @Override
120 @DataClass.Generated.Member
121 public String toString() {
122 // You can override field toString logic by defining methods like:
123 // String fieldNameToString() { ... }
124
125 return "InputMonitor { " +
126 "inputChannel = " + mInputChannel + ", " +
127 "host = " + mHost +
128 " }";
129 }
130
131 @Override
132 @DataClass.Generated.Member
133 public void writeToParcel(@NonNull Parcel dest, int flags) {
134 // You can override field parcelling by defining methods like:
135 // void parcelFieldName(Parcel dest, int flags) { ... }
136
137 dest.writeTypedObject(mInputChannel, flags);
138 dest.writeStrongInterface(mHost);
139 }
140
141 @Override
142 @DataClass.Generated.Member
143 public int describeContents() { return 0; }
144
145 /** @hide */
146 @SuppressWarnings({"unchecked", "RedundantCast"})
147 @DataClass.Generated.Member
148 /* package-private */ InputMonitor(@NonNull Parcel in) {
149 // You can override field unparcelling by defining methods like:
150 // static FieldType unparcelFieldName(Parcel in) { ... }
151
152 InputChannel inputChannel = (InputChannel) in.readTypedObject(InputChannel.CREATOR);
153 IInputMonitorHost host = IInputMonitorHost.Stub.asInterface(in.readStrongBinder());
154
155 this.mInputChannel = inputChannel;
156 com.android.internal.util.AnnotationValidations.validate(
157 NonNull.class, null, mInputChannel);
158 this.mHost = host;
159 com.android.internal.util.AnnotationValidations.validate(
160 NonNull.class, null, mHost);
161
162 // onConstructed(); // You can define this method to get a callback
163 }
164
165 @DataClass.Generated.Member
166 public static final @NonNull Parcelable.Creator<InputMonitor> CREATOR
167 = new Parcelable.Creator<InputMonitor>() {
168 @Override
169 public InputMonitor[] newArray(int size) {
170 return new InputMonitor[size];
171 }
172
173 @Override
174 public InputMonitor createFromParcel(@NonNull Parcel in) {
175 return new InputMonitor(in);
176 }
177 };
178
179 @DataClass.Generated(
180 time = 1637697281750L,
181 codegenVersion = "1.0.23",
182 sourceFile = "frameworks/base/core/java/android/view/InputMonitor.java",
183 inputSignatures = "private static final java.lang.String TAG\nprivate static final boolean DEBUG\nprivate final @android.annotation.NonNull android.view.InputChannel mInputChannel\nprivate final @android.annotation.NonNull android.view.IInputMonitorHost mHost\npublic void pilferPointers()\npublic void dispose()\nclass InputMonitor extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true)")
184 @Deprecated
185 private void __metadata() {}
186
187
188 //@formatter:on
189 // End of generated code
190
191 }