resources/src/main/java/org/robolectric/res/android/CppAssetManager2.java
@SuppressWarnings("NewApi")
  public int GetResourceId(final String resource_name,
      final String fallback_type,
      final String fallback_package) {
    final Ref<String> package_name = new Ref<>(null),
        type = new Ref<>(null),
        entry = new Ref<>(null);
    if (!ExtractResourceName(resource_name, package_name, type, entry)) {
      return 0;
    }

    if (entry.get().isEmpty()) {
      return 0;
    }

    if (package_name.get().isEmpty()) {
      package_name.set(fallback_package);
    }

    if (type.get().isEmpty()) {
      type.set(fallback_type);
    }

    String type16 = type.get();
    // if (!Utf8ToUtf16(type, &type16)) {
    //   return 0;
    // }

    String entry16 = entry.get();
    // if (!Utf8ToUtf16(entry, &entry16)) {
    //   return 0;
    // }

    final String kAttr16 = "attr";
    final String kAttrPrivate16 = "^attr-private";

    for (final PackageGroup package_group : package_groups_) {
      for (final ConfiguredPackage package_impl : package_group.packages_) {
        LoadedPackage package_= package_impl.loaded_package_;
        if (!Objects.equals(package_name.get(), package_.GetPackageName())) {
          // All packages in the same group are expected to have the same package name.
          break;
        }

        int resid = package_.FindEntryByName(type16, entry16);
        if (resid == 0 && Objects.equals(kAttr16, type16)) {
          // Private attributes in libraries (such as the framework) are sometimes encoded
          // under the type '^attr-private' in order to leave the ID space of public 'attr'
          // free for future additions. Check '^attr-private' for the same name.
          resid = package_.FindEntryByName(kAttrPrivate16, entry16);
        }

        if (resid != 0) {
          return fix_package_id(resid, package_group.dynamic_ref_table.mAssignedPackageId);
        }
      }
    }
    return 0;
  }
@SuppressWarnings("NewApi")
  public int GetResourceId(final String resource_name,
      final String fallback_type,
      final String fallback_package) {
    final Ref<String> package_name = new Ref<>(null),
        type = new Ref<>(null),
        entry = new Ref<>(null);
    if (!ExtractResourceName(resource_name, package_name, type, entry)) {
      return 0;
    }

    if (entry.get().isEmpty()) {
      return 0;
    }

    if (package_name.get().isEmpty()) {
      package_name.set(fallback_package);
    }

    if (type.get().isEmpty()) {
      type.set(fallback_type);
    }

    String type16 = type.get();
    // if (!Utf8ToUtf16(type, &type16)) {
    //   return 0;
    // }

    String entry16 = entry.get();
    // if (!Utf8ToUtf16(entry, &entry16)) {
    //   return 0;
    // }

    final String kAttr16 = "attr";
    final String kAttrPrivate16 = "^attr-private";

    for (final PackageGroup package_group : package_groups_) {
      for (final ConfiguredPackage package_impl : package_group.packages_) {
        LoadedPackage package_= package_impl.loaded_package_;
        if (!Objects.equals(package_name.get(), package_.GetPackageName())) {
          // All packages in the same group are expected to have the same package name.
          break;
        }

        int resid = package_.FindEntryByName(type16, entry16);
        if (resid == 0 && Objects.equals(kAttr16, type16)) {
          // Private attributes in libraries (such as the framework) are sometimes encoded
          // under the type '^attr-private' in order to leave the ID space of public 'attr'
          // free for future additions. Check '^attr-private' for the same name.
          resid = package_.FindEntryByName(kAttrPrivate16, entry16);
        }

        if (resid != 0) {
          return fix_package_id(resid, package_group.dynamic_ref_table.mAssignedPackageId);
        }
      }
    }
    return 0;
  }
@ SuppressWarnings ( "NewApi" ) public int GetResourceId ( final String resource_name , final String fallback_type , final String fallback_package ) { final Ref < String > package_name = new Ref <> ( null ) , type = new Ref <> ( null ) , entry = new Ref <> ( null ) ; if ( ! ExtractResourceName ( resource_name , package_name , type , entry ) ) { return 0 ; } if ( entry . get ( ) . isEmpty ( ) ) { return 0 ; } if ( package_name . get ( ) . isEmpty ( ) ) { package_name . set ( fallback_package ) ; } if ( type . get ( ) . isEmpty ( ) ) { type . set ( fallback_type ) ; } String type16 = type . get ( ) ; // if (!Utf8ToUtf16(type, &type16)) { //   return 0; // } String entry16 = entry . get ( ) ; // if (!Utf8ToUtf16(entry, &entry16)) { //   return 0; // } final String kAttr16 = "attr" ; final String kAttrPrivate16 = "^attr-private" ; for ( final PackageGroup package_group : package_groups_ ) { for ( final ConfiguredPackage package_impl : package_group . packages_ ) { LoadedPackage package_ = package_impl . loaded_package_ ; if ( ! Objects . equals ( package_name . get ( ) , package_ . GetPackageName ( ) ) ) { // All packages in the same group are expected to have the same package name. break ; } int resid = package_ . FindEntryByName ( type16 , entry16 ) ; if ( resid == 0 && Objects . equals ( kAttr16 , type16 ) ) { // Private attributes in libraries (such as the framework) are sometimes encoded // under the type '^attr-private' in order to leave the ID space of public 'attr' // free for future additions. Check '^attr-private' for the same name. resid = package_ . FindEntryByName ( kAttrPrivate16 , entry16 ) ; } if ( resid != 0 ) { return fix_package_id ( resid , package_group . dynamic_ref_table . mAssignedPackageId ) ; } } } return 0 ; }
final String fallback_package = {});
final String fallback_package = {} ) ;