resources/src/main/java/org/robolectric/res/android/CppAssetManager2.java
void RebuildFilterList() {
    for (PackageGroup group : package_groups_) {
      for (ConfiguredPackage impl : group.packages_) {
        // // Destroy it.
        // impl.filtered_configs_.~ByteBucketArray();
        //
        // // Re-create it.
        // new (impl.filtered_configs_) ByteBucketArray<FilteredConfigGroup>();
        impl.filtered_configs_ =
            new ByteBucketArray<FilteredConfigGroup>(new FilteredConfigGroup()) {
              @Override
              FilteredConfigGroup newInstance() {
                return new FilteredConfigGroup();
              }
            };

        // Create the filters here.
        impl.loaded_package_.ForEachTypeSpec((TypeSpec spec, byte type_index) -> {
          FilteredConfigGroup configGroup = impl.filtered_configs_.editItemAt(type_index);
          // const auto iter_end = spec->types + spec->type_count;
          //   for (auto iter = spec->types; iter != iter_end; ++iter) {
          for (ResTable_type iter : spec.types) {
            ResTable_config this_config = ResTable_config.fromDtoH(iter.config);
            if (this_config.match(configuration_)) {
              configGroup.configurations.add(this_config);
              configGroup.types.add(iter);
            }
          }
        });
      }
    }
  }
void RebuildFilterList() {
    for (PackageGroup group : package_groups_) {
      for (ConfiguredPackage impl : group.packages_) {
        // // Destroy it.
        // impl.filtered_configs_.~ByteBucketArray();
        //
        // // Re-create it.
        // new (impl.filtered_configs_) ByteBucketArray<FilteredConfigGroup>();
        impl.filtered_configs_ =
            new ByteBucketArray<FilteredConfigGroup>(new FilteredConfigGroup()) {
              @Override
              FilteredConfigGroup newInstance() {
                return new FilteredConfigGroup();
              }
            };

        // Create the filters here.
        impl.loaded_package_.ForEachTypeSpec((TypeSpec spec, byte type_index) -> {
          FilteredConfigGroup configGroup = impl.filtered_configs_.editItemAt(type_index);
          // const auto iter_end = spec->types + spec->type_count;
          //   for (auto iter = spec->types; iter != iter_end; ++iter) {
          for (ResTable_type iter : spec.types) {
            ResTable_config this_config = ResTable_config.fromDtoH(iter.config);
            if (this_config.match(configuration_)) {
              configGroup.configurations.add(this_config);
              configGroup.types.add(iter);
            }
          }
        });
      }
    }
  }
This should always be called when mutating the AssetManager's configuration or ApkAssets set.