| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.app.ambientcontext; |
| 18 |
|
| 19 |
import android.annotation.IntDef; |
| 20 |
import android.annotation.NonNull; |
| 21 |
import android.annotation.SystemApi; |
| 22 |
import android.os.Parcelable; |
| 23 |
|
| 24 |
import com.android.internal.util.DataClass; |
| 25 |
import com.android.internal.util.Parcelling; |
| 26 |
|
| 27 |
import java.lang.annotation.Retention; |
| 28 |
import java.lang.annotation.RetentionPolicy; |
| 29 |
import java.time.Instant; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
@SystemApi |
| 39 |
@DataClass( |
| 40 |
genBuilder = true, |
| 41 |
genConstructor = false, |
| 42 |
genHiddenConstDefs = true, |
| 43 |
genParcelable = true, |
| 44 |
genToString = true |
| 45 |
) |
| 46 |
public final class AmbientContextEvent implements Parcelable { |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
public static final int EVENT_UNKNOWN = 0; |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
public static final int EVENT_COUGH = 1; |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
public static final int EVENT_SNORE = 2; |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
public static final int EVENT_BACK_DOUBLE_TAP = 3; |
| 70 |
|
| 71 |
|
| 72 |
@IntDef(prefix = { "EVENT_" }, value = { |
| 73 |
EVENT_UNKNOWN, |
| 74 |
EVENT_COUGH, |
| 75 |
EVENT_SNORE, |
| 76 |
EVENT_BACK_DOUBLE_TAP, |
| 77 |
}) public @interface EventCode {} |
| 78 |
|
| 79 |
|
| 80 |
public static final int LEVEL_UNKNOWN = 0; |
| 81 |
|
| 82 |
|
| 83 |
public static final int LEVEL_LOW = 1; |
| 84 |
|
| 85 |
|
| 86 |
public static final int LEVEL_MEDIUM_LOW = 2; |
| 87 |
|
| 88 |
|
| 89 |
public static final int LEVEL_MEDIUM = 3; |
| 90 |
|
| 91 |
|
| 92 |
public static final int LEVEL_MEDIUM_HIGH = 4; |
| 93 |
|
| 94 |
|
| 95 |
public static final int LEVEL_HIGH = 5; |
| 96 |
|
| 97 |
|
| 98 |
@IntDef(prefix = {"LEVEL_"}, value = { |
| 99 |
LEVEL_UNKNOWN, |
| 100 |
LEVEL_LOW, |
| 101 |
LEVEL_MEDIUM_LOW, |
| 102 |
LEVEL_MEDIUM, |
| 103 |
LEVEL_MEDIUM_HIGH, |
| 104 |
LEVEL_HIGH |
| 105 |
}) public @interface LevelValue {} |
| 106 |
|
| 107 |
@EventCode private final int mEventType; |
| 108 |
private static int defaultEventType() { |
| 109 |
return EVENT_UNKNOWN; |
| 110 |
} |
| 111 |
|
| 112 |
|
| 113 |
@DataClass.ParcelWith(Parcelling.BuiltIn.ForInstant.class) |
| 114 |
@NonNull private final Instant mStartTime; |
| 115 |
@NonNull private static Instant defaultStartTime() { |
| 116 |
return Instant.MIN; |
| 117 |
} |
| 118 |
|
| 119 |
|
| 120 |
@DataClass.ParcelWith(Parcelling.BuiltIn.ForInstant.class) |
| 121 |
@NonNull private final Instant mEndTime; |
| 122 |
@NonNull private static Instant defaultEndTime() { |
| 123 |
return Instant.MAX; |
| 124 |
} |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
@LevelValue private final int mConfidenceLevel; |
| 131 |
private static int defaultConfidenceLevel() { |
| 132 |
return LEVEL_UNKNOWN; |
| 133 |
} |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
@LevelValue private final int mDensityLevel; |
| 140 |
private static int defaultDensityLevel() { |
| 141 |
return LEVEL_UNKNOWN; |
| 142 |
} |
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
@IntDef(prefix = "EVENT_", value = { |
| 161 |
EVENT_UNKNOWN, |
| 162 |
EVENT_COUGH, |
| 163 |
EVENT_SNORE, |
| 164 |
EVENT_BACK_DOUBLE_TAP |
| 165 |
}) |
| 166 |
@Retention(RetentionPolicy.SOURCE) |
| 167 |
@DataClass.Generated.Member |
| 168 |
public @interface Event {} |
| 169 |
|
| 170 |
|
| 171 |
@DataClass.Generated.Member |
| 172 |
public static String eventToString(@Event int value) { |
| 173 |
switch (value) { |
| 174 |
case EVENT_UNKNOWN: |
| 175 |
return "EVENT_UNKNOWN"; |
| 176 |
case EVENT_COUGH: |
| 177 |
return "EVENT_COUGH"; |
| 178 |
case EVENT_SNORE: |
| 179 |
return "EVENT_SNORE"; |
| 180 |
case EVENT_BACK_DOUBLE_TAP: |
| 181 |
return "EVENT_BACK_DOUBLE_TAP"; |
| 182 |
default: return Integer.toHexString(value); |
| 183 |
} |
| 184 |
} |
| 185 |
|
| 186 |
|
| 187 |
@IntDef(prefix = "LEVEL_", value = { |
| 188 |
LEVEL_UNKNOWN, |
| 189 |
LEVEL_LOW, |
| 190 |
LEVEL_MEDIUM_LOW, |
| 191 |
LEVEL_MEDIUM, |
| 192 |
LEVEL_MEDIUM_HIGH, |
| 193 |
LEVEL_HIGH |
| 194 |
}) |
| 195 |
@Retention(RetentionPolicy.SOURCE) |
| 196 |
@DataClass.Generated.Member |
| 197 |
public @interface Level {} |
| 198 |
|
| 199 |
|
| 200 |
@DataClass.Generated.Member |
| 201 |
public static String levelToString(@Level int value) { |
| 202 |
switch (value) { |
| 203 |
case LEVEL_UNKNOWN: |
| 204 |
return "LEVEL_UNKNOWN"; |
| 205 |
case LEVEL_LOW: |
| 206 |
return "LEVEL_LOW"; |
| 207 |
case LEVEL_MEDIUM_LOW: |
| 208 |
return "LEVEL_MEDIUM_LOW"; |
| 209 |
case LEVEL_MEDIUM: |
| 210 |
return "LEVEL_MEDIUM"; |
| 211 |
case LEVEL_MEDIUM_HIGH: |
| 212 |
return "LEVEL_MEDIUM_HIGH"; |
| 213 |
case LEVEL_HIGH: |
| 214 |
return "LEVEL_HIGH"; |
| 215 |
default: return Integer.toHexString(value); |
| 216 |
} |
| 217 |
} |
| 218 |
|
| 219 |
@DataClass.Generated.Member |
| 220 |
AmbientContextEvent( |
| 221 |
@EventCode int eventType, |
| 222 |
@NonNull Instant startTime, |
| 223 |
@NonNull Instant endTime, |
| 224 |
@LevelValue int confidenceLevel, |
| 225 |
@LevelValue int densityLevel) { |
| 226 |
this.mEventType = eventType; |
| 227 |
com.android.internal.util.AnnotationValidations.validate( |
| 228 |
EventCode.class, null, mEventType); |
| 229 |
this.mStartTime = startTime; |
| 230 |
com.android.internal.util.AnnotationValidations.validate( |
| 231 |
NonNull.class, null, mStartTime); |
| 232 |
this.mEndTime = endTime; |
| 233 |
com.android.internal.util.AnnotationValidations.validate( |
| 234 |
NonNull.class, null, mEndTime); |
| 235 |
this.mConfidenceLevel = confidenceLevel; |
| 236 |
com.android.internal.util.AnnotationValidations.validate( |
| 237 |
LevelValue.class, null, mConfidenceLevel); |
| 238 |
this.mDensityLevel = densityLevel; |
| 239 |
com.android.internal.util.AnnotationValidations.validate( |
| 240 |
LevelValue.class, null, mDensityLevel); |
| 241 |
|
| 242 |
|
| 243 |
} |
| 244 |
|
| 245 |
@DataClass.Generated.Member |
| 246 |
public @EventCode int getEventType() { |
| 247 |
return mEventType; |
| 248 |
} |
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
@DataClass.Generated.Member |
| 254 |
public @NonNull Instant getStartTime() { |
| 255 |
return mStartTime; |
| 256 |
} |
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
@DataClass.Generated.Member |
| 262 |
public @NonNull Instant getEndTime() { |
| 263 |
return mEndTime; |
| 264 |
} |
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
@DataClass.Generated.Member |
| 271 |
public @LevelValue int getConfidenceLevel() { |
| 272 |
return mConfidenceLevel; |
| 273 |
} |
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
@DataClass.Generated.Member |
| 280 |
public @LevelValue int getDensityLevel() { |
| 281 |
return mDensityLevel; |
| 282 |
} |
| 283 |
|
| 284 |
@Override |
| 285 |
@DataClass.Generated.Member |
| 286 |
public String toString() { |
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
return "AmbientContextEvent { " + |
| 291 |
"eventType = " + mEventType + ", " + |
| 292 |
"startTime = " + mStartTime + ", " + |
| 293 |
"endTime = " + mEndTime + ", " + |
| 294 |
"confidenceLevel = " + mConfidenceLevel + ", " + |
| 295 |
"densityLevel = " + mDensityLevel + |
| 296 |
" }"; |
| 297 |
} |
| 298 |
|
| 299 |
@DataClass.Generated.Member |
| 300 |
static Parcelling<Instant> sParcellingForStartTime = |
| 301 |
Parcelling.Cache.get( |
| 302 |
Parcelling.BuiltIn.ForInstant.class); |
| 303 |
static { |
| 304 |
if (sParcellingForStartTime == null) { |
| 305 |
sParcellingForStartTime = Parcelling.Cache.put( |
| 306 |
new Parcelling.BuiltIn.ForInstant()); |
| 307 |
} |
| 308 |
} |
| 309 |
|
| 310 |
@DataClass.Generated.Member |
| 311 |
static Parcelling<Instant> sParcellingForEndTime = |
| 312 |
Parcelling.Cache.get( |
| 313 |
Parcelling.BuiltIn.ForInstant.class); |
| 314 |
static { |
| 315 |
if (sParcellingForEndTime == null) { |
| 316 |
sParcellingForEndTime = Parcelling.Cache.put( |
| 317 |
new Parcelling.BuiltIn.ForInstant()); |
| 318 |
} |
| 319 |
} |
| 320 |
|
| 321 |
@Override |
| 322 |
@DataClass.Generated.Member |
| 323 |
public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { |
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
dest.writeInt(mEventType); |
| 328 |
sParcellingForStartTime.parcel(mStartTime, dest, flags); |
| 329 |
sParcellingForEndTime.parcel(mEndTime, dest, flags); |
| 330 |
dest.writeInt(mConfidenceLevel); |
| 331 |
dest.writeInt(mDensityLevel); |
| 332 |
} |
| 333 |
|
| 334 |
@Override |
| 335 |
@DataClass.Generated.Member |
| 336 |
public int describeContents() { return 0; } |
| 337 |
|
| 338 |
|
| 339 |
@SuppressWarnings({"unchecked", "RedundantCast"}) |
| 340 |
@DataClass.Generated.Member |
| 341 |
AmbientContextEvent(@NonNull android.os.Parcel in) { |
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
int eventType = in.readInt(); |
| 346 |
Instant startTime = sParcellingForStartTime.unparcel(in); |
| 347 |
Instant endTime = sParcellingForEndTime.unparcel(in); |
| 348 |
int confidenceLevel = in.readInt(); |
| 349 |
int densityLevel = in.readInt(); |
| 350 |
|
| 351 |
this.mEventType = eventType; |
| 352 |
com.android.internal.util.AnnotationValidations.validate( |
| 353 |
EventCode.class, null, mEventType); |
| 354 |
this.mStartTime = startTime; |
| 355 |
com.android.internal.util.AnnotationValidations.validate( |
| 356 |
NonNull.class, null, mStartTime); |
| 357 |
this.mEndTime = endTime; |
| 358 |
com.android.internal.util.AnnotationValidations.validate( |
| 359 |
NonNull.class, null, mEndTime); |
| 360 |
this.mConfidenceLevel = confidenceLevel; |
| 361 |
com.android.internal.util.AnnotationValidations.validate( |
| 362 |
LevelValue.class, null, mConfidenceLevel); |
| 363 |
this.mDensityLevel = densityLevel; |
| 364 |
com.android.internal.util.AnnotationValidations.validate( |
| 365 |
LevelValue.class, null, mDensityLevel); |
| 366 |
|
| 367 |
|
| 368 |
} |
| 369 |
|
| 370 |
@DataClass.Generated.Member |
| 371 |
public static final @NonNull Parcelable.Creator<AmbientContextEvent> CREATOR |
| 372 |
= new Parcelable.Creator<AmbientContextEvent>() { |
| 373 |
@Override |
| 374 |
public AmbientContextEvent[] newArray(int size) { |
| 375 |
return new AmbientContextEvent[size]; |
| 376 |
} |
| 377 |
|
| 378 |
@Override |
| 379 |
public AmbientContextEvent createFromParcel(@NonNull android.os.Parcel in) { |
| 380 |
return new AmbientContextEvent(in); |
| 381 |
} |
| 382 |
}; |
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
@SuppressWarnings("WeakerAccess") |
| 388 |
@DataClass.Generated.Member |
| 389 |
public static final class Builder { |
| 390 |
|
| 391 |
private @EventCode int mEventType; |
| 392 |
private @NonNull Instant mStartTime; |
| 393 |
private @NonNull Instant mEndTime; |
| 394 |
private @LevelValue int mConfidenceLevel; |
| 395 |
private @LevelValue int mDensityLevel; |
| 396 |
|
| 397 |
private long mBuilderFieldsSet = 0L; |
| 398 |
|
| 399 |
public Builder() { |
| 400 |
} |
| 401 |
|
| 402 |
@DataClass.Generated.Member |
| 403 |
public @NonNull Builder setEventType(@EventCode int value) { |
| 404 |
checkNotUsed(); |
| 405 |
mBuilderFieldsSet |= 0x1; |
| 406 |
mEventType = value; |
| 407 |
return this; |
| 408 |
} |
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
@DataClass.Generated.Member |
| 414 |
public @NonNull Builder setStartTime(@NonNull Instant value) { |
| 415 |
checkNotUsed(); |
| 416 |
mBuilderFieldsSet |= 0x2; |
| 417 |
mStartTime = value; |
| 418 |
return this; |
| 419 |
} |
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
@DataClass.Generated.Member |
| 425 |
public @NonNull Builder setEndTime(@NonNull Instant value) { |
| 426 |
checkNotUsed(); |
| 427 |
mBuilderFieldsSet |= 0x4; |
| 428 |
mEndTime = value; |
| 429 |
return this; |
| 430 |
} |
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
@DataClass.Generated.Member |
| 437 |
public @NonNull Builder setConfidenceLevel(@LevelValue int value) { |
| 438 |
checkNotUsed(); |
| 439 |
mBuilderFieldsSet |= 0x8; |
| 440 |
mConfidenceLevel = value; |
| 441 |
return this; |
| 442 |
} |
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
@DataClass.Generated.Member |
| 449 |
public @NonNull Builder setDensityLevel(@LevelValue int value) { |
| 450 |
checkNotUsed(); |
| 451 |
mBuilderFieldsSet |= 0x10; |
| 452 |
mDensityLevel = value; |
| 453 |
return this; |
| 454 |
} |
| 455 |
|
| 456 |
|
| 457 |
public @NonNull AmbientContextEvent build() { |
| 458 |
checkNotUsed(); |
| 459 |
mBuilderFieldsSet |= 0x20; |
| 460 |
|
| 461 |
if ((mBuilderFieldsSet & 0x1) == 0) { |
| 462 |
mEventType = defaultEventType(); |
| 463 |
} |
| 464 |
if ((mBuilderFieldsSet & 0x2) == 0) { |
| 465 |
mStartTime = defaultStartTime(); |
| 466 |
} |
| 467 |
if ((mBuilderFieldsSet & 0x4) == 0) { |
| 468 |
mEndTime = defaultEndTime(); |
| 469 |
} |
| 470 |
if ((mBuilderFieldsSet & 0x8) == 0) { |
| 471 |
mConfidenceLevel = defaultConfidenceLevel(); |
| 472 |
} |
| 473 |
if ((mBuilderFieldsSet & 0x10) == 0) { |
| 474 |
mDensityLevel = defaultDensityLevel(); |
| 475 |
} |
| 476 |
AmbientContextEvent o = new AmbientContextEvent( |
| 477 |
mEventType, |
| 478 |
mStartTime, |
| 479 |
mEndTime, |
| 480 |
mConfidenceLevel, |
| 481 |
mDensityLevel); |
| 482 |
return o; |
| 483 |
} |
| 484 |
|
| 485 |
private void checkNotUsed() { |
| 486 |
if ((mBuilderFieldsSet & 0x20) != 0) { |
| 487 |
throw new IllegalStateException( |
| 488 |
"This Builder should not be reused. Use a new Builder instance instead"); |
| 489 |
} |
| 490 |
} |
| 491 |
} |
| 492 |
|
| 493 |
@DataClass.Generated( |
| 494 |
time = 1659950304931L, |
| 495 |
codegenVersion = "1.0.23", |
| 496 |
sourceFile = "frameworks/base/core/java/android/app/ambientcontext/AmbientContextEvent.java", |
| 497 |
inputSignatures = "public static final int EVENT_UNKNOWN\npublic static final int EVENT_COUGH\npublic static final int EVENT_SNORE\npublic static final int EVENT_BACK_DOUBLE_TAP\npublic static final int LEVEL_UNKNOWN\npublic static final int LEVEL_LOW\npublic static final int LEVEL_MEDIUM_LOW\npublic static final int LEVEL_MEDIUM\npublic static final int LEVEL_MEDIUM_HIGH\npublic static final int LEVEL_HIGH\nprivate final @android.app.ambientcontext.AmbientContextEvent.EventCode int mEventType\nprivate final @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInstant.class) @android.annotation.NonNull java.time.Instant mStartTime\nprivate final @com.android.internal.util.DataClass.ParcelWith(com.android.internal.util.Parcelling.BuiltIn.ForInstant.class) @android.annotation.NonNull java.time.Instant mEndTime\nprivate final @android.app.ambientcontext.AmbientContextEvent.LevelValue int mConfidenceLevel\nprivate final @android.app.ambientcontext.AmbientContextEvent.LevelValue int mDensityLevel\nprivate static int defaultEventType()\nprivate static @android.annotation.NonNull java.time.Instant defaultStartTime()\nprivate static @android.annotation.NonNull java.time.Instant defaultEndTime()\nprivate static int defaultConfidenceLevel()\nprivate static int defaultDensityLevel()\nclass AmbientContextEvent extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genBuilder=true, genConstructor=false, genHiddenConstDefs=true, genParcelable=true, genToString=true)") |
| 498 |
@Deprecated |
| 499 |
private void __metadata() {} |
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
} |