| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 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 |
|
| 31 |
|
| 32 |
|
| 33 |
@Immutable |
| 34 |
@SystemApi |
| 35 |
|
| 36 |
|
| 37 |
public final class RuntimeAppOpAccessMessage implements Parcelable { |
| 38 |
|
| 39 |
private final @IntRange(from = 0L) int mUid; |
| 40 |
|
| 41 |
private final @IntRange(from = 0L, to = AppOpsManager._NUM_OP - 1) int mOpCode; |
| 42 |
|
| 43 |
private final @NonNull String mPackageName; |
| 44 |
|
| 45 |
private final @Nullable String mAttributionTag; |
| 46 |
|
| 47 |
private final @NonNull String mMessage; |
| 48 |
|
| 49 |
private final @AppOpsManager.SamplingStrategy int mSamplingStrategy; |
| 50 |
|
| 51 |
public @NonNull String getOp() { |
| 52 |
return AppOpsManager.opToPublicName(mOpCode); |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 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 |
|
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
@DataClass.Generated.Member |
| 122 |
public @IntRange(from = 0L) int getUid() { |
| 123 |
return mUid; |
| 124 |
} |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
@DataClass.Generated.Member |
| 130 |
public @NonNull String getPackageName() { |
| 131 |
return mPackageName; |
| 132 |
} |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
@DataClass.Generated.Member |
| 138 |
public @Nullable String getAttributionTag() { |
| 139 |
return mAttributionTag; |
| 140 |
} |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
@DataClass.Generated.Member |
| 146 |
public @NonNull String getMessage() { |
| 147 |
return mMessage; |
| 148 |
} |
| 149 |
|
| 150 |
|
| 151 |
|
| 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 |
|
| 162 |
|
| 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 |
|
| 180 |
@SuppressWarnings({"unchecked", "RedundantCast"}) |
| 181 |
@DataClass.Generated.Member |
| 182 |
RuntimeAppOpAccessMessage(@NonNull Parcel in) { |
| 183 |
|
| 184 |
|
| 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 |
|
| 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 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
@Deprecated |
| 237 |
private void __metadata() {} |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
} |