### Question:
ResourceUsageAnalyzer { @VisibleForTesting boolean isResourceClass(@NonNull String name) { if (mResourceObfuscation.containsKey(name)) { return true; } assert name.endsWith(DOT_CLASS) : name; int index = name.lastIndexOf('/'); if (index != -1 && name.startsWith("R$", index + 1)) { String typeName = name.substring(index + 3, name.length() - DOT_CLASS.length()); return ResourceType.fromClassName(typeName) != null; } return false; } ResourceUsageAnalyzer(
            @NonNull File rDir,
            @NonNull Iterable<File> classes,
            @NonNull File manifest,
            @Nullable File mapping,
            @NonNull Iterable<File> resources,
            @Nullable File reportFile,
            @NonNull ApkFormat format);  ResourceUsageAnalyzer(
            @NonNull File rDir,
            @NonNull Iterable<File> classes,
            @NonNull File manifest,
            @Nullable File mapping,
            @NonNull File resources,
            @Nullable File reportFile,
            @NonNull ApkFormat format); void dispose(); void analyze(); boolean isDryRun(); void setDryRun(boolean dryRun); boolean isVerbose(); void setVerbose(boolean verbose); boolean isDebug(); void setDebug(boolean verbose); void rewriteResourceZip(@NonNull File source, @NonNull File dest); void emitWhitelist(Path destination); void emitConfig(Path destination); void removeUnused(@Nullable File destination); int getUnusedResourceCount(); static final boolean REPLACE_DELETED_WITH_EMPTY; @SuppressWarnings("SpellCheckingInspection") // arsc
    static final boolean TWO_PASS_AAPT; static final byte[] TINY_PNG; static final long TINY_PNG_CRC; static final byte[] TINY_9PNG; static final long TINY_9PNG_CRC; static final byte[] TINY_BINARY_XML; static final long TINY_BINARY_XML_CRC; static final byte[] TINY_PROTO_XML; static final long TINY_PROTO_XML_CRC; static final Pattern FORMAT; }### Answer:
@Test public void testIsResourceClass() throws Exception { File dummy = new File("dummy"); File mappingFile = createMappingFile(Files.createTempDir()); ResourceUsageAnalyzer analyzer = new ResourceUsageAnalyzer( dummy, Collections.singleton(dummy), dummy, mappingFile, dummy, null, ResourceUsageAnalyzer.ApkFormat.BINARY); analyzer.getModel().addDeclaredResource(ResourceType.LAYOUT, "structure_status_view", null, true); analyzer.recordMapping(mappingFile); assertTrue(analyzer.isResourceClass("android/support/v7/appcompat/R$attr.class")); assertTrue(analyzer.isResourceClass("android/support/v7/appcompat/R$attr.class")); assertTrue(analyzer.isResourceClass("android/support/v7/appcompat/R$bool.class")); assertFalse(analyzer.isResourceClass("android/support/v7/appcompat/R.class")); assertFalse(analyzer.isResourceClass("com/google/samples/apps/iosched/ui/BrowseSessionsActivity.class")); assertFalse(analyzer.isResourceClass("android/support/annotation/FloatRange.class")); assertTrue(analyzer.isResourceClass("com/foo/bar/t.class")); assertTrue(analyzer.isResourceClass("com/foo/bar/t")); Resource resource = analyzer.getResourceFromCode("com/foo/bar/t", "f"); assertNotNull(resource); assertEquals("structure_status_view", resource.name); assertEquals(ResourceType.LAYOUT, resource.type); assertNull(analyzer.getResourceFromCode("android/support/annotation/FloatRange", "fromInclusive")); }