1 /* 2 * Copyright (C) 2021 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.car.watchdog; 18 19 import static com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport.BOILERPLATE_CODE; 20 21 import android.annotation.IntDef; 22 import android.annotation.NonNull; 23 import android.annotation.Nullable; 24 import android.annotation.StringDef; 25 import android.annotation.SystemApi; 26 import android.car.annotation.AddedInOrBefore; 27 import android.os.Parcelable; 28 29 import com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport; 30 import com.android.car.internal.util.AnnotationValidations; 31 import com.android.car.internal.util.DataClass; 32 33 import java.lang.annotation.Retention; 34 import java.lang.annotation.RetentionPolicy; 35 import java.util.List; 36 import java.util.Map; 37 38 /** 39 * Resource overuse configuration for a component. 40 * 41 * @hide 42 */ 43 @SystemApi 44 @DataClass(genToString = true, genBuilder = true, genHiddenConstDefs = true) 45 public final class ResourceOveruseConfiguration implements Parcelable { 46 /** 47 * System component. 48 */ 49 @AddedInOrBefore(majorVersion = 33) 50 public static final int COMPONENT_TYPE_SYSTEM = 1; 51 52 /** 53 * Vendor component. 54 */ 55 @AddedInOrBefore(majorVersion = 33) 56 public static final int COMPONENT_TYPE_VENDOR = 2; 57 58 /** 59 * Third party component. 60 */ 61 @AddedInOrBefore(majorVersion = 33) 62 public static final int COMPONENT_TYPE_THIRD_PARTY = 3; 63 64 /** 65 * Map applications. 66 */ 67 @AddedInOrBefore(majorVersion = 33) 68 public static final String APPLICATION_CATEGORY_TYPE_MAPS = 69 "android.car.watchdog.app.category.MAPS"; 70 71 /** 72 * Media applications. 73 */ 74 @AddedInOrBefore(majorVersion = 33) 75 public static final String APPLICATION_CATEGORY_TYPE_MEDIA = 76 "android.car.watchdog.app.category.MEDIA"; 77 78 /** 79 * Component type of the I/O overuse configuration. 80 */ 81 private @ComponentType int mComponentType; 82 83 /** 84 * List of system or vendor packages that are safe to be killed on resource overuse. 85 * 86 * <p>When specifying shared package names, the package names should contain the prefix 87 * 'shared:'. 88 * <p>System components must provide only safe-to-kill system packages in this list. 89 * <p>Vendor components must provide only safe-to-kill vendor packages in this list. 90 */ 91 private @NonNull List<String> mSafeToKillPackages; 92 93 /** 94 * List of vendor package prefixes. 95 * 96 * <p>Any pre-installed package name starting with one of the prefixes or any package from the 97 * vendor partition is identified as a vendor package and vendor provided thresholds are applied 98 * to these packages. This list must be provided only by the vendor component. 99 * 100 * <p>When specifying shared package name prefixes, the prefix should contain 'shared:' at 101 * the beginning. 102 */ 103 private @NonNull List<String> mVendorPackagePrefixes; 104 105 106 /** 107 * Mappings from package name to application category types. 108 * 109 * <p>This mapping must contain only packages that can be mapped to one of the 110 * {@link ApplicationCategoryType} types. This mapping must be defined only by the system and 111 * vendor components. 112 * 113 * <p>For packages under a shared UID, the application category type must be specified 114 * for the shared package name and not for individual packages under the shared UID. When 115 * specifying shared package names, the package names should contain the prefix 'shared:'. 116 */ 117 private @NonNull Map<String, String> mPackagesToAppCategoryTypes; 118 119 /** 120 * I/O overuse configuration for the component specified by 121 * {@link ResourceOveruseConfiguration#getComponentType}. 122 */ 123 private @Nullable IoOveruseConfiguration mIoOveruseConfiguration = null; 124 125 126 127 // Code below generated by codegen v1.0.23. 128 // 129 // DO NOT MODIFY! 130 // CHECKSTYLE:OFF Generated code 131 // 132 // To regenerate run: 133 // $ codegen $ANDROID_BUILD_TOP/packages/services/Car/car-lib/src/android/car/watchdog/ResourceOveruseConfiguration.java 134 // 135 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 136 // Settings > Editor > Code Style > Formatter Control 137 //@formatter:off 138 139 140 /** @hide */ 141 @IntDef(prefix = "COMPONENT_TYPE_", value = { 142 COMPONENT_TYPE_SYSTEM, 143 COMPONENT_TYPE_VENDOR, 144 COMPONENT_TYPE_THIRD_PARTY 145 }) 146 @Retention(RetentionPolicy.SOURCE) 147 @DataClass.Generated.Member 148 public @interface ComponentType {} 149 150 /** @hide */ 151 @DataClass.Generated.Member 152 @AddedInOrBefore(majorVersion = 33) componentTypeToString(@omponentType int value)153 public static String componentTypeToString(@ComponentType int value) { 154 switch (value) { 155 case COMPONENT_TYPE_SYSTEM: 156 return "COMPONENT_TYPE_SYSTEM"; 157 case COMPONENT_TYPE_VENDOR: 158 return "COMPONENT_TYPE_VENDOR"; 159 case COMPONENT_TYPE_THIRD_PARTY: 160 return "COMPONENT_TYPE_THIRD_PARTY"; 161 default: return Integer.toHexString(value); 162 } 163 } 164 165 /** @hide */ 166 @StringDef(prefix = "APPLICATION_CATEGORY_TYPE_", value = { 167 APPLICATION_CATEGORY_TYPE_MAPS, 168 APPLICATION_CATEGORY_TYPE_MEDIA 169 }) 170 @Retention(RetentionPolicy.SOURCE) 171 @DataClass.Generated.Member 172 public @interface ApplicationCategoryType {} 173 174 @DataClass.Generated.Member ResourceOveruseConfiguration( @omponentType int componentType, @NonNull List<String> safeToKillPackages, @NonNull List<String> vendorPackagePrefixes, @NonNull Map<String,String> packagesToAppCategoryTypes, @Nullable IoOveruseConfiguration ioOveruseConfiguration)175 /* package-private */ ResourceOveruseConfiguration( 176 @ComponentType int componentType, 177 @NonNull List<String> safeToKillPackages, 178 @NonNull List<String> vendorPackagePrefixes, 179 @NonNull Map<String,String> packagesToAppCategoryTypes, 180 @Nullable IoOveruseConfiguration ioOveruseConfiguration) { 181 this.mComponentType = componentType; 182 183 if (!(mComponentType == COMPONENT_TYPE_SYSTEM) 184 && !(mComponentType == COMPONENT_TYPE_VENDOR) 185 && !(mComponentType == COMPONENT_TYPE_THIRD_PARTY)) { 186 throw new java.lang.IllegalArgumentException( 187 "componentType was " + mComponentType + " but must be one of: " 188 + "COMPONENT_TYPE_SYSTEM(" + COMPONENT_TYPE_SYSTEM + "), " 189 + "COMPONENT_TYPE_VENDOR(" + COMPONENT_TYPE_VENDOR + "), " 190 + "COMPONENT_TYPE_THIRD_PARTY(" + COMPONENT_TYPE_THIRD_PARTY + ")"); 191 } 192 193 this.mSafeToKillPackages = safeToKillPackages; 194 AnnotationValidations.validate( 195 NonNull.class, null, mSafeToKillPackages); 196 this.mVendorPackagePrefixes = vendorPackagePrefixes; 197 AnnotationValidations.validate( 198 NonNull.class, null, mVendorPackagePrefixes); 199 this.mPackagesToAppCategoryTypes = packagesToAppCategoryTypes; 200 AnnotationValidations.validate( 201 NonNull.class, null, mPackagesToAppCategoryTypes); 202 this.mIoOveruseConfiguration = ioOveruseConfiguration; 203 204 // onConstructed(); // You can define this method to get a callback 205 } 206 207 /** 208 * Component type of the I/O overuse configuration. 209 */ 210 @DataClass.Generated.Member 211 @AddedInOrBefore(majorVersion = 33) getComponentType()212 public @ComponentType int getComponentType() { 213 return mComponentType; 214 } 215 216 /** 217 * List of system or vendor packages that are safe to be killed on resource overuse. 218 * 219 * <p>When specifying shared package names, the package names should contain the prefix 220 * 'shared:'. 221 * <p>System components must provide only safe-to-kill system packages in this list. 222 * <p>Vendor components must provide only safe-to-kill vendor packages in this list. 223 */ 224 @DataClass.Generated.Member 225 @AddedInOrBefore(majorVersion = 33) getSafeToKillPackages()226 public @NonNull List<String> getSafeToKillPackages() { 227 return mSafeToKillPackages; 228 } 229 230 /** 231 * List of vendor package prefixes. 232 * 233 * <p>Any pre-installed package name starting with one of the prefixes or any package from the 234 * vendor partition is identified as a vendor package and vendor provided thresholds are applied 235 * to these packages. This list must be provided only by the vendor component. 236 * 237 * <p>When specifying shared package name prefixes, the prefix should contain 'shared:' at 238 * the beginning. 239 */ 240 @DataClass.Generated.Member 241 @AddedInOrBefore(majorVersion = 33) getVendorPackagePrefixes()242 public @NonNull List<String> getVendorPackagePrefixes() { 243 return mVendorPackagePrefixes; 244 } 245 246 /** 247 * Mappings from package name to application category types. 248 * 249 * <p>This mapping must contain only packages that can be mapped to one of the 250 * {@link ApplicationCategoryType} types. This mapping must be defined only by the system and 251 * vendor components. 252 * 253 * <p>For packages under a shared UID, the application category type must be specified 254 * for the shared package name and not for individual packages under the shared UID. When 255 * specifying shared package names, the package names should contain the prefix 'shared:'. 256 */ 257 @DataClass.Generated.Member 258 @AddedInOrBefore(majorVersion = 33) getPackagesToAppCategoryTypes()259 public @NonNull Map<String,String> getPackagesToAppCategoryTypes() { 260 return mPackagesToAppCategoryTypes; 261 } 262 263 /** 264 * I/O overuse configuration for the component specified by 265 * {@link ResourceOveruseConfiguration#getComponentType}. 266 */ 267 @DataClass.Generated.Member 268 @AddedInOrBefore(majorVersion = 33) getIoOveruseConfiguration()269 public @Nullable IoOveruseConfiguration getIoOveruseConfiguration() { 270 return mIoOveruseConfiguration; 271 } 272 273 @Override 274 @DataClass.Generated.Member 275 @AddedInOrBefore(majorVersion = 33) toString()276 public String toString() { 277 // You can override field toString logic by defining methods like: 278 // String fieldNameToString() { ... } 279 280 return "ResourceOveruseConfiguration { " + 281 "componentType = " + componentTypeToString(mComponentType) + ", " + 282 "safeToKillPackages = " + mSafeToKillPackages + ", " + 283 "vendorPackagePrefixes = " + mVendorPackagePrefixes + ", " + 284 "packagesToAppCategoryTypes = " + mPackagesToAppCategoryTypes + ", " + 285 "ioOveruseConfiguration = " + mIoOveruseConfiguration + 286 " }"; 287 } 288 289 @Override 290 @DataClass.Generated.Member 291 @AddedInOrBefore(majorVersion = 33) writeToParcel(@onNull android.os.Parcel dest, int flags)292 public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { 293 // You can override field parcelling by defining methods like: 294 // void parcelFieldName(Parcel dest, int flags) { ... } 295 296 byte flg = 0; 297 if (mIoOveruseConfiguration != null) flg |= 0x10; 298 dest.writeByte(flg); 299 dest.writeInt(mComponentType); 300 dest.writeStringList(mSafeToKillPackages); 301 dest.writeStringList(mVendorPackagePrefixes); 302 dest.writeMap(mPackagesToAppCategoryTypes); 303 if (mIoOveruseConfiguration != null) dest.writeTypedObject(mIoOveruseConfiguration, flags); 304 } 305 306 @Override 307 @DataClass.Generated.Member 308 @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE) 309 @AddedInOrBefore(majorVersion = 33) describeContents()310 public int describeContents() { return 0; } 311 312 /** @hide */ 313 @SuppressWarnings({"unchecked", "RedundantCast"}) 314 @DataClass.Generated.Member ResourceOveruseConfiguration(@onNull android.os.Parcel in)315 /* package-private */ ResourceOveruseConfiguration(@NonNull android.os.Parcel in) { 316 // You can override field unparcelling by defining methods like: 317 // static FieldType unparcelFieldName(Parcel in) { ... } 318 319 byte flg = in.readByte(); 320 int componentType = in.readInt(); 321 List<String> safeToKillPackages = new java.util.ArrayList<>(); 322 in.readStringList(safeToKillPackages); 323 List<String> vendorPackagePrefixes = new java.util.ArrayList<>(); 324 in.readStringList(vendorPackagePrefixes); 325 Map<String,String> packagesToAppCategoryTypes = new java.util.LinkedHashMap<>(); 326 in.readMap(packagesToAppCategoryTypes, String.class.getClassLoader()); 327 IoOveruseConfiguration ioOveruseConfiguration = (flg & 0x10) == 0 ? null : (IoOveruseConfiguration) in.readTypedObject(IoOveruseConfiguration.CREATOR); 328 329 this.mComponentType = componentType; 330 331 if (!(mComponentType == COMPONENT_TYPE_SYSTEM) 332 && !(mComponentType == COMPONENT_TYPE_VENDOR) 333 && !(mComponentType == COMPONENT_TYPE_THIRD_PARTY)) { 334 throw new java.lang.IllegalArgumentException( 335 "componentType was " + mComponentType + " but must be one of: " 336 + "COMPONENT_TYPE_SYSTEM(" + COMPONENT_TYPE_SYSTEM + "), " 337 + "COMPONENT_TYPE_VENDOR(" + COMPONENT_TYPE_VENDOR + "), " 338 + "COMPONENT_TYPE_THIRD_PARTY(" + COMPONENT_TYPE_THIRD_PARTY + ")"); 339 } 340 341 this.mSafeToKillPackages = safeToKillPackages; 342 AnnotationValidations.validate( 343 NonNull.class, null, mSafeToKillPackages); 344 this.mVendorPackagePrefixes = vendorPackagePrefixes; 345 AnnotationValidations.validate( 346 NonNull.class, null, mVendorPackagePrefixes); 347 this.mPackagesToAppCategoryTypes = packagesToAppCategoryTypes; 348 AnnotationValidations.validate( 349 NonNull.class, null, mPackagesToAppCategoryTypes); 350 this.mIoOveruseConfiguration = ioOveruseConfiguration; 351 352 // onConstructed(); // You can define this method to get a callback 353 } 354 355 @DataClass.Generated.Member 356 @AddedInOrBefore(majorVersion = 33) 357 public static final @NonNull Parcelable.Creator<ResourceOveruseConfiguration> CREATOR 358 = new Parcelable.Creator<ResourceOveruseConfiguration>() { 359 @Override 360 public ResourceOveruseConfiguration[] newArray(int size) { 361 return new ResourceOveruseConfiguration[size]; 362 } 363 364 @Override 365 public ResourceOveruseConfiguration createFromParcel(@NonNull android.os.Parcel in) { 366 return new ResourceOveruseConfiguration(in); 367 } 368 }; 369 370 /** 371 * A builder for {@link ResourceOveruseConfiguration} 372 */ 373 @SuppressWarnings("WeakerAccess") 374 @DataClass.Generated.Member 375 public static final class Builder { 376 377 private @ComponentType int mComponentType; 378 private @NonNull List<String> mSafeToKillPackages; 379 private @NonNull List<String> mVendorPackagePrefixes; 380 private @NonNull Map<String,String> mPackagesToAppCategoryTypes; 381 private @Nullable IoOveruseConfiguration mIoOveruseConfiguration; 382 383 private long mBuilderFieldsSet = 0L; 384 385 /** 386 * Creates a new Builder. 387 * 388 * @param componentType 389 * Component type of the I/O overuse configuration. 390 * @param safeToKillPackages 391 * List of system or vendor packages that are safe to be killed on resource overuse. 392 * 393 * <p>When specifying shared package names, the package names should contain the prefix 394 * 'shared:'. 395 * <p>System components must provide only safe-to-kill system packages in this list. 396 * <p>Vendor components must provide only safe-to-kill vendor packages in this list. 397 * @param vendorPackagePrefixes 398 * List of vendor package prefixes. 399 * 400 * <p>Any pre-installed package name starting with one of the prefixes or any package from the 401 * vendor partition is identified as a vendor package and vendor provided thresholds are applied 402 * to these packages. This list must be provided only by the vendor component. 403 * 404 * <p>When specifying shared package name prefixes, the prefix should contain 'shared:' at 405 * the beginning. 406 * @param packagesToAppCategoryTypes 407 * Mappings from package name to application category types. 408 * 409 * <p>This mapping must contain only packages that can be mapped to one of the 410 * {@link ApplicationCategoryType} types. This mapping must be defined only by the system and 411 * vendor components. 412 * 413 * <p>For packages under a shared UID, the application category type must be specified 414 * for the shared package name and not for individual packages under the shared UID. When 415 * specifying shared package names, the package names should contain the prefix 'shared:'. 416 */ Builder( @omponentType int componentType, @NonNull List<String> safeToKillPackages, @NonNull List<String> vendorPackagePrefixes, @NonNull Map<String,String> packagesToAppCategoryTypes)417 public Builder( 418 @ComponentType int componentType, 419 @NonNull List<String> safeToKillPackages, 420 @NonNull List<String> vendorPackagePrefixes, 421 @NonNull Map<String,String> packagesToAppCategoryTypes) { 422 mComponentType = componentType; 423 424 if (!(mComponentType == COMPONENT_TYPE_SYSTEM) 425 && !(mComponentType == COMPONENT_TYPE_VENDOR) 426 && !(mComponentType == COMPONENT_TYPE_THIRD_PARTY)) { 427 throw new java.lang.IllegalArgumentException( 428 "componentType was " + mComponentType + " but must be one of: " 429 + "COMPONENT_TYPE_SYSTEM(" + COMPONENT_TYPE_SYSTEM + "), " 430 + "COMPONENT_TYPE_VENDOR(" + COMPONENT_TYPE_VENDOR + "), " 431 + "COMPONENT_TYPE_THIRD_PARTY(" + COMPONENT_TYPE_THIRD_PARTY + ")"); 432 } 433 434 mSafeToKillPackages = safeToKillPackages; 435 AnnotationValidations.validate( 436 NonNull.class, null, mSafeToKillPackages); 437 mVendorPackagePrefixes = vendorPackagePrefixes; 438 AnnotationValidations.validate( 439 NonNull.class, null, mVendorPackagePrefixes); 440 mPackagesToAppCategoryTypes = packagesToAppCategoryTypes; 441 AnnotationValidations.validate( 442 NonNull.class, null, mPackagesToAppCategoryTypes); 443 } 444 445 /** 446 * Component type of the I/O overuse configuration. 447 */ 448 @DataClass.Generated.Member 449 @AddedInOrBefore(majorVersion = 33) setComponentType(@omponentType int value)450 public @NonNull Builder setComponentType(@ComponentType int value) { 451 checkNotUsed(); 452 mBuilderFieldsSet |= 0x1; 453 mComponentType = value; 454 return this; 455 } 456 457 /** 458 * List of system or vendor packages that are safe to be killed on resource overuse. 459 * 460 * <p>When specifying shared package names, the package names should contain the prefix 461 * 'shared:'. 462 * <p>System components must provide only safe-to-kill system packages in this list. 463 * <p>Vendor components must provide only safe-to-kill vendor packages in this list. 464 */ 465 @DataClass.Generated.Member 466 @AddedInOrBefore(majorVersion = 33) setSafeToKillPackages(@onNull List<String> value)467 public @NonNull Builder setSafeToKillPackages(@NonNull List<String> value) { 468 checkNotUsed(); 469 mBuilderFieldsSet |= 0x2; 470 mSafeToKillPackages = value; 471 return this; 472 } 473 474 /** @see #setSafeToKillPackages */ 475 @DataClass.Generated.Member 476 @AddedInOrBefore(majorVersion = 33) addSafeToKillPackages(@onNull String value)477 public @NonNull Builder addSafeToKillPackages(@NonNull String value) { 478 // You can refine this method's name by providing item's singular name, e.g.: 479 // @DataClass.PluralOf("item")) mItems = ... 480 481 if (mSafeToKillPackages == null) setSafeToKillPackages(new java.util.ArrayList<>()); 482 mSafeToKillPackages.add(value); 483 return this; 484 } 485 486 /** 487 * List of vendor package prefixes. 488 * 489 * <p>Any pre-installed package name starting with one of the prefixes or any package from the 490 * vendor partition is identified as a vendor package and vendor provided thresholds are applied 491 * to these packages. This list must be provided only by the vendor component. 492 * 493 * <p>When specifying shared package name prefixes, the prefix should contain 'shared:' at 494 * the beginning. 495 */ 496 @DataClass.Generated.Member 497 @AddedInOrBefore(majorVersion = 33) setVendorPackagePrefixes(@onNull List<String> value)498 public @NonNull Builder setVendorPackagePrefixes(@NonNull List<String> value) { 499 checkNotUsed(); 500 mBuilderFieldsSet |= 0x4; 501 mVendorPackagePrefixes = value; 502 return this; 503 } 504 505 /** @see #setVendorPackagePrefixes */ 506 @DataClass.Generated.Member 507 @AddedInOrBefore(majorVersion = 33) addVendorPackagePrefixes(@onNull String value)508 public @NonNull Builder addVendorPackagePrefixes(@NonNull String value) { 509 // You can refine this method's name by providing item's singular name, e.g.: 510 // @DataClass.PluralOf("item")) mItems = ... 511 512 if (mVendorPackagePrefixes == null) setVendorPackagePrefixes(new java.util.ArrayList<>()); 513 mVendorPackagePrefixes.add(value); 514 return this; 515 } 516 517 /** 518 * Mappings from package name to application category types. 519 * 520 * <p>This mapping must contain only packages that can be mapped to one of the 521 * {@link ApplicationCategoryType} types. This mapping must be defined only by the system and 522 * vendor components. 523 * 524 * <p>For packages under a shared UID, the application category type must be specified 525 * for the shared package name and not for individual packages under the shared UID. When 526 * specifying shared package names, the package names should contain the prefix 'shared:'. 527 */ 528 @DataClass.Generated.Member 529 @AddedInOrBefore(majorVersion = 33) setPackagesToAppCategoryTypes(@onNull Map<String,String> value)530 public @NonNull Builder setPackagesToAppCategoryTypes(@NonNull Map<String,String> value) { 531 checkNotUsed(); 532 mBuilderFieldsSet |= 0x8; 533 mPackagesToAppCategoryTypes = value; 534 return this; 535 } 536 537 /** @see #setPackagesToAppCategoryTypes */ 538 @DataClass.Generated.Member 539 @AddedInOrBefore(majorVersion = 33) addPackagesToAppCategoryTypes(@onNull String key, @NonNull String value)540 public @NonNull Builder addPackagesToAppCategoryTypes(@NonNull String key, @NonNull String value) { 541 // You can refine this method's name by providing item's singular name, e.g.: 542 // @DataClass.PluralOf("item")) mItems = ... 543 544 if (mPackagesToAppCategoryTypes == null) setPackagesToAppCategoryTypes(new java.util.LinkedHashMap()); 545 mPackagesToAppCategoryTypes.put(key, value); 546 return this; 547 } 548 549 /** 550 * I/O overuse configuration for the component specified by 551 * {@link ResourceOveruseConfiguration#getComponentType}. 552 */ 553 @DataClass.Generated.Member 554 @AddedInOrBefore(majorVersion = 33) setIoOveruseConfiguration(@onNull IoOveruseConfiguration value)555 public @NonNull Builder setIoOveruseConfiguration(@NonNull IoOveruseConfiguration value) { 556 checkNotUsed(); 557 mBuilderFieldsSet |= 0x10; 558 mIoOveruseConfiguration = value; 559 return this; 560 } 561 562 /** Builds the instance. This builder should not be touched after calling this! */ 563 @AddedInOrBefore(majorVersion = 33) build()564 public @NonNull ResourceOveruseConfiguration build() { 565 checkNotUsed(); 566 mBuilderFieldsSet |= 0x20; // Mark builder used 567 568 if ((mBuilderFieldsSet & 0x10) == 0) { 569 mIoOveruseConfiguration = null; 570 } 571 ResourceOveruseConfiguration o = new ResourceOveruseConfiguration( 572 mComponentType, 573 mSafeToKillPackages, 574 mVendorPackagePrefixes, 575 mPackagesToAppCategoryTypes, 576 mIoOveruseConfiguration); 577 return o; 578 } 579 checkNotUsed()580 private void checkNotUsed() { 581 if ((mBuilderFieldsSet & 0x20) != 0) { 582 throw new IllegalStateException( 583 "This Builder should not be reused. Use a new Builder instance instead"); 584 } 585 } 586 } 587 588 @DataClass.Generated( 589 time = 1628099327759L, 590 codegenVersion = "1.0.23", 591 sourceFile = "packages/services/Car/car-lib/src/android/car/watchdog/ResourceOveruseConfiguration.java", 592 inputSignatures = "public static final int COMPONENT_TYPE_SYSTEM\npublic static final int COMPONENT_TYPE_VENDOR\npublic static final int COMPONENT_TYPE_THIRD_PARTY\npublic static final java.lang.String APPLICATION_CATEGORY_TYPE_MAPS\npublic static final java.lang.String APPLICATION_CATEGORY_TYPE_MEDIA\nprivate @android.car.watchdog.ResourceOveruseConfiguration.ComponentType int mComponentType\nprivate @android.annotation.NonNull java.util.List<java.lang.String> mSafeToKillPackages\nprivate @android.annotation.NonNull java.util.List<java.lang.String> mVendorPackagePrefixes\nprivate @android.annotation.NonNull java.util.Map<java.lang.String,java.lang.String> mPackagesToAppCategoryTypes\nprivate @android.annotation.Nullable android.car.watchdog.IoOveruseConfiguration mIoOveruseConfiguration\nclass ResourceOveruseConfiguration extends java.lang.Object implements [android.os.Parcelable]\n@com.android.car.internal.util.DataClass(genToString=true, genBuilder=true, genHiddenConstDefs=true)") 593 @Deprecated 594 @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE) __metadata()595 private void __metadata() {} 596 597 598 //@formatter:on 599 // End of generated code 600 601 } 602