Debian Codegraph @

core/java/android/app/RuntimeAppOpAccessMessage.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.app;
18
19 import android.annotation.IntRange;
20 import android.annotation.NonNull;
21 import android.annotation.Nullable;
22 import android.annotation.SystemApi;
23 import android.os.Parcel;
24 import android.os.Parcelable;
25
26 import com.android.internal.annotations.Immutable;
27 import com.android.internal.util.DataClass;
28
29 /**
30 * Message for noted runtime permission access.
31 * @hide
32 */
33 @Immutable
34 @SystemApi
35 /*@DataClass(genConstructor = false)
36 @DataClass.Suppress("getOpCode")*/
37 public final class RuntimeAppOpAccessMessage implements Parcelable {
38 /** Uid of package for which runtime app op access message was collected */
39 private final @IntRange(from = 0L) int mUid;
40 /** Op code of operation access which was collected */
41 private final @IntRange(from = 0L, to = AppOpsManager._NUM_OP - 1) int mOpCode;
42 /** Name of package for which runtime app op access message was collected */
43 private final @NonNull String mPackageName;
44 /** Feature of package for which runtime app op access message was collected */
45 private final @Nullable String mAttributionTag;
46 /** Message collected (including stacktrace for synchronous ops) */
47 private final @NonNull String mMessage;
48 /** Sampling strategy used to collect this message. */
49 private final @AppOpsManager.SamplingStrategy int mSamplingStrategy;
50
51 public @NonNull String getOp() {
52 return AppOpsManager.opToPublicName(mOpCode);
53 }
54
55 /**
56 * Creates a new RuntimeAppOpAccessMessage.
57 *
58 * @param uid
59 * Uid of package for which runtime app op access message was collected
60 * @param opCode
61 * Op code of operation access which was collected
62 * @param packageName
63 * Name of package for which runtime app op access message was collected
64 * @param attributionTag
65 * Attribution tag for which runtime app op access message was collected
66 * @param message
67 * Message collected (including stacktrace for synchronous ops)
68 * @param samplingStrategy
69 * Sampling strategy used to collect this message.
70 */
71 @DataClass.Generated.Member
72 public RuntimeAppOpAccessMessage(
73 @IntRange(from = 0L) int uid,
74 @IntRange(from = 0L) int opCode,
75 @NonNull String packageName,
76 @Nullable String attributionTag,
77 @NonNull String message,
78 @AppOpsManager.SamplingStrategy int samplingStrategy) {
79 this.mUid = uid;
80 com.android.internal.util.AnnotationValidations.validate(
81 IntRange.class, null, mUid,
82 "from", 0L);
83 this.mOpCode = opCode;
84 com.android.internal.util.AnnotationValidations.validate(
85 IntRange.class, null, mOpCode,
86 "from", 0L,
87 "to", AppOpsManager._NUM_OP - 1);
88 this.mPackageName = packageName;
89 com.android.internal.util.AnnotationValidations.validate(
90 NonNull.class, null, mPackageName);
91 this.mAttributionTag = attributionTag;
92 this.mMessage = message;
93 com.android.internal.util.AnnotationValidations.validate(
94 NonNull.class, null, mMessage);
95 this.mSamplingStrategy = samplingStrategy;
96 com.android.internal.util.AnnotationValidations.validate(
97 AppOpsManager.SamplingStrategy.class, null, mSamplingStrategy);
98
99 // onConstructed(); // You can define this method to get a callback
100 }
101
102
103
104
105 // Code below generated by codegen v1.0.14.
106 //
107 // DO NOT MODIFY!
108 // CHECKSTYLE:OFF Generated code
109 //
110 // To regenerate run:
111 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/app/RuntimeAppOpAccessMessage.java
112 //
113 // To exclude the generated code from IntelliJ auto-formatting enable (one-time):
114 // Settings > Editor > Code Style > Formatter Control
115 //@formatter:off
116
117
118 /**
119 * Uid of package for which runtime app op access message was collected
120 */
121 @DataClass.Generated.Member
122 public @IntRange(from = 0L) int getUid() {
123 return mUid;
124 }
125
126 /**
127 * Name of package for which runtime app op access message was collected
128 */
129 @DataClass.Generated.Member
130 public @NonNull String getPackageName() {
131 return mPackageName;
132 }
133
134 /**
135 * Attribution tag for which runtime app op access message was collected
136 */
137 @DataClass.Generated.Member
138 public @Nullable String getAttributionTag() {
139 return mAttributionTag;
140 }
141
142 /**
143 * Message collected (including stacktrace for synchronous ops)
144 */
145 @DataClass.Generated.Member
146 public @NonNull String getMessage() {
147 return mMessage;
148 }
149
150 /**
151 * Sampling strategy used to collect this message.
152 */
153 @DataClass.Generated.Member
154 public @AppOpsManager.SamplingStrategy int getSamplingStrategy() {
155 return mSamplingStrategy;
156 }
157
158 @Override
159 @DataClass.Generated.Member
160 public void writeToParcel(@NonNull Parcel dest, int flags) {
161 // You can override field parcelling by defining methods like:
162 // void parcelFieldName(Parcel dest, int flags) { ... }
163
164 byte flg = 0;
165 if (mAttributionTag != null) flg |= 0x8;
166 dest.writeByte(flg);
167 dest.writeInt(mUid);
168 dest.writeInt(mOpCode);
169 dest.writeString(mPackageName);
170 if (mAttributionTag != null) dest.writeString(mAttributionTag);
171 dest.writeString(mMessage);
172 dest.writeInt(mSamplingStrategy);
173 }
174
175 @Override
176 @DataClass.Generated.Member
177 public int describeContents() { return 0; }
178
179 /** @hide */
180 @SuppressWarnings({"unchecked", "RedundantCast"})
181 @DataClass.Generated.Member
182 /* package-private */ RuntimeAppOpAccessMessage(@NonNull Parcel in) {
183 // You can override field unparcelling by defining methods like:
184 // static FieldType unparcelFieldName(Parcel in) { ... }
185
186 byte flg = in.readByte();
187 int uid = in.readInt();
188 int opCode = in.readInt();
189 String packageName = in.readString();
190 String attributionTag = (flg & 0x8) == 0 ? null : in.readString();
191 String message = in.readString();
192 int samplingStrategy = in.readInt();
193
194 this.mUid = uid;
195 com.android.internal.util.AnnotationValidations.validate(
196 IntRange.class, null, mUid,
197 "from", 0L);
198 this.mOpCode = opCode;
199 com.android.internal.util.AnnotationValidations.validate(
200 IntRange.class, null, mOpCode,
201 "from", 0L,
202 "to", AppOpsManager._NUM_OP - 1);
203 this.mPackageName = packageName;
204 com.android.internal.util.AnnotationValidations.validate(
205 NonNull.class, null, mPackageName);
206 this.mAttributionTag = attributionTag;
207 this.mMessage = message;
208 com.android.internal.util.AnnotationValidations.validate(
209 NonNull.class, null, mMessage);
210 this.mSamplingStrategy = samplingStrategy;
211 com.android.internal.util.AnnotationValidations.validate(
212 AppOpsManager.SamplingStrategy.class, null, mSamplingStrategy);
213
214 // onConstructed(); // You can define this method to get a callback
215 }
216
217 @DataClass.Generated.Member
218 public static final @NonNull Parcelable.Creator<RuntimeAppOpAccessMessage> CREATOR
219 = new Parcelable.Creator<RuntimeAppOpAccessMessage>() {
220 @Override
221 public RuntimeAppOpAccessMessage[] newArray(int size) {
222 return new RuntimeAppOpAccessMessage[size];
223 }
224
225 @Override
226 public RuntimeAppOpAccessMessage createFromParcel(@NonNull Parcel in) {
227 return new RuntimeAppOpAccessMessage(in);
228 }
229 };
230
231 /*@DataClass.Generated(
232 time = 1581517099127L,
233 codegenVersion = "1.0.14",
234 sourceFile = "frameworks/base/core/java/android/app/RuntimeAppOpAccessMessage.java",
235 inputSignatures = "private final @android.annotation.IntRange(from=0L) int mUid\nprivate final @android.annotation.IntRange(from=0L, to=AppOpsManager._NUM_OP - 1) int mOpCode\nprivate final @android.annotation.NonNull java.lang.String mPackageName\nprivate final @android.annotation.Nullable java.lang.String mAttributionTag\nprivate final @android.annotation.NonNull java.lang.String mMessage\nprivate final @android.app.AppOpsManager.SamplingStrategy int mSamplingStrategy\npublic @android.annotation.NonNull java.lang.String getOp()\nclass RuntimeAppOpAccessMessage extends java.lang.Object implements [android.os.Parcelable]\[email protected](genConstructor=false)")*/
236 @Deprecated
237 private void __metadata() {}
238
239
240 //@formatter:on
241 // End of generated code
242
243 }