Loading apct-tests/perftests/core/OWNERS +4 −0 Original line number Diff line number Diff line include /graphics/java/android/graphics/fonts/OWNERS # Bug component: 568761 per-file /apct-tests/perftests/core/res/* = felkachang@google.com,zyy@google.com apct-tests/perftests/core/res/values/colors.xml 0 → 100644 +10022 −0 File added.Preview size limit exceeded, changes collapsed. Show changes apct-tests/perftests/core/src/android/app/ResourcesPerfTest.java +22 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.util.Random; /** * Benchmarks for {@link android.content.res.Resources}. Loading Loading @@ -222,4 +223,24 @@ public class ResourcesPerfTest { state.resumeTiming(); } } @Test public void getIdentifier() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final Random random = new Random(System.currentTimeMillis()); final Context context = InstrumentationRegistry.getTargetContext(); final String packageName = context.getPackageName(); while (state.keepRunning()) { state.pauseTiming(); final int expectedInteger = random.nextInt(10001); final String expectedString = Integer.toHexString(expectedInteger); final String entryName = "i_am_color_" + expectedString; state.resumeTiming(); final int resIdentifier = mRes.getIdentifier(entryName, "color", packageName); if (resIdentifier == 0) { fail("Color \"" + entryName + "\" is not found"); } } } } Loading
apct-tests/perftests/core/OWNERS +4 −0 Original line number Diff line number Diff line include /graphics/java/android/graphics/fonts/OWNERS # Bug component: 568761 per-file /apct-tests/perftests/core/res/* = felkachang@google.com,zyy@google.com
apct-tests/perftests/core/res/values/colors.xml 0 → 100644 +10022 −0 File added.Preview size limit exceeded, changes collapsed. Show changes
apct-tests/perftests/core/src/android/app/ResourcesPerfTest.java +22 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.util.Random; /** * Benchmarks for {@link android.content.res.Resources}. Loading Loading @@ -222,4 +223,24 @@ public class ResourcesPerfTest { state.resumeTiming(); } } @Test public void getIdentifier() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final Random random = new Random(System.currentTimeMillis()); final Context context = InstrumentationRegistry.getTargetContext(); final String packageName = context.getPackageName(); while (state.keepRunning()) { state.pauseTiming(); final int expectedInteger = random.nextInt(10001); final String expectedString = Integer.toHexString(expectedInteger); final String entryName = "i_am_color_" + expectedString; state.resumeTiming(); final int resIdentifier = mRes.getIdentifier(entryName, "color", packageName); if (resIdentifier == 0) { fail("Color \"" + entryName + "\" is not found"); } } } }