Loading apct-tests/perftests/core/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,8 @@ android_test { "androidx.appcompat_appcompat", "androidx.test.rules", "androidx.annotation_annotation", "androidx.benchmark_benchmark-common", "androidx.benchmark_benchmark-junit4", "apct-perftests-overlay-apps", "apct-perftests-resources-manager-apps", "apct-perftests-utils", Loading apct-tests/perftests/core/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ </application> <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" <instrumentation android:name="androidx.benchmark.junit4.AndroidBenchmarkRunner" android:targetPackage="com.android.perftests.core"/> </manifest> apct-tests/perftests/core/src/android/view/CutoutSpecificationBenchmark.java +7 −7 Original line number Diff line number Diff line Loading @@ -22,13 +22,13 @@ import android.graphics.Path; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Region; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; import android.util.PathParser; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; Loading Loading @@ -67,7 +67,7 @@ public class CutoutSpecificationBenchmark { + "Z\n" + "@dp"; @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); private Context mContext; private DisplayMetrics mDisplayMetrics; Loading Loading @@ -168,7 +168,7 @@ public class CutoutSpecificationBenchmark { @Test public void parseByOldMethodForDoubleCutout() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { oldMethodParsingSpec(DOUBLE_CUTOUT_SPEC, mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels, mDisplayMetrics.density); Loading @@ -177,7 +177,7 @@ public class CutoutSpecificationBenchmark { @Test public void parseByNewMethodForDoubleCutout() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { new CutoutSpecification.Parser(mDisplayMetrics.density, mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels) Loading Loading @@ -209,7 +209,7 @@ public class CutoutSpecificationBenchmark { + "@right\n" + "@dp"; final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { new CutoutSpecification.Parser(mDisplayMetrics.density, mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels).parse(spec); Loading @@ -231,7 +231,7 @@ public class CutoutSpecificationBenchmark { + "Z\n" + "@dp"; final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { new CutoutSpecification.Parser(mDisplayMetrics.density, mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels).parse(spec); Loading apct-tests/perftests/core/src/android/view/ViewPerfTest.java +6 −6 Original line number Diff line number Diff line Loading @@ -19,11 +19,11 @@ package android.view; import static junit.framework.Assert.assertTrue; import android.content.Context; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import android.perftests.utils.PerfTestActivity; import android.widget.FrameLayout; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; import androidx.test.rule.ActivityTestRule; Loading @@ -37,7 +37,7 @@ import org.junit.Test; @LargeTest public class ViewPerfTest { @Rule public final PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public final BenchmarkRule mBenchmarkRule = new BenchmarkRule(); @Rule public final ActivityTestRule<PerfTestActivity> mActivityRule = Loading @@ -52,7 +52,7 @@ public class ViewPerfTest { @Test public void testSimpleViewInflate() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); LayoutInflater inflater = LayoutInflater.from(mContext); FrameLayout root = new FrameLayout(mContext); while (state.keepRunning()) { Loading @@ -62,7 +62,7 @@ public class ViewPerfTest { @Test public void testTwelveKeyInflate() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); LayoutInflater inflater = LayoutInflater.from(mContext); FrameLayout root = new FrameLayout(mContext); while (state.keepRunning()) { Loading @@ -72,7 +72,7 @@ public class ViewPerfTest { @Test public void testPerformHapticFeedback() throws Throwable { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); mActivityRule.runOnUiThread(() -> { state.pauseTiming(); View view = new View(mContext); Loading apct-tests/perftests/core/src/android/view/ViewShowHidePerfTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -21,14 +21,14 @@ import static org.junit.Assert.assertTrue; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import android.perftests.utils.PerfTestActivity; import android.view.View.MeasureSpec; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; import androidx.test.rule.ActivityTestRule; Loading @@ -50,7 +50,7 @@ public class ViewShowHidePerfTest { new ActivityTestRule<>(PerfTestActivity.class); @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public final BenchmarkRule mBenchmarkRule = new BenchmarkRule(); public Context getContext() { return InstrumentationRegistry.getInstrumentation().getTargetContext(); Loading Loading @@ -143,7 +143,7 @@ public class ViewShowHidePerfTest { private void testParentWithChild(TestCallback callback) throws Throwable { mActivityRule.runOnUiThread(() -> { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); FrameLayout parent = new FrameLayout(getContext()); mActivityRule.getActivity().setContentView(parent); Loading Loading
apct-tests/perftests/core/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,8 @@ android_test { "androidx.appcompat_appcompat", "androidx.test.rules", "androidx.annotation_annotation", "androidx.benchmark_benchmark-common", "androidx.benchmark_benchmark-junit4", "apct-perftests-overlay-apps", "apct-perftests-resources-manager-apps", "apct-perftests-utils", Loading
apct-tests/perftests/core/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ </application> <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner" <instrumentation android:name="androidx.benchmark.junit4.AndroidBenchmarkRunner" android:targetPackage="com.android.perftests.core"/> </manifest>
apct-tests/perftests/core/src/android/view/CutoutSpecificationBenchmark.java +7 −7 Original line number Diff line number Diff line Loading @@ -22,13 +22,13 @@ import android.graphics.Path; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Region; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import android.text.TextUtils; import android.util.DisplayMetrics; import android.util.Log; import android.util.PathParser; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; Loading Loading @@ -67,7 +67,7 @@ public class CutoutSpecificationBenchmark { + "Z\n" + "@dp"; @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public BenchmarkRule mBenchmarkRule = new BenchmarkRule(); private Context mContext; private DisplayMetrics mDisplayMetrics; Loading Loading @@ -168,7 +168,7 @@ public class CutoutSpecificationBenchmark { @Test public void parseByOldMethodForDoubleCutout() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { oldMethodParsingSpec(DOUBLE_CUTOUT_SPEC, mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels, mDisplayMetrics.density); Loading @@ -177,7 +177,7 @@ public class CutoutSpecificationBenchmark { @Test public void parseByNewMethodForDoubleCutout() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { new CutoutSpecification.Parser(mDisplayMetrics.density, mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels) Loading Loading @@ -209,7 +209,7 @@ public class CutoutSpecificationBenchmark { + "@right\n" + "@dp"; final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { new CutoutSpecification.Parser(mDisplayMetrics.density, mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels).parse(spec); Loading @@ -231,7 +231,7 @@ public class CutoutSpecificationBenchmark { + "Z\n" + "@dp"; final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); while (state.keepRunning()) { new CutoutSpecification.Parser(mDisplayMetrics.density, mDisplayMetrics.widthPixels, mDisplayMetrics.heightPixels).parse(spec); Loading
apct-tests/perftests/core/src/android/view/ViewPerfTest.java +6 −6 Original line number Diff line number Diff line Loading @@ -19,11 +19,11 @@ package android.view; import static junit.framework.Assert.assertTrue; import android.content.Context; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import android.perftests.utils.PerfTestActivity; import android.widget.FrameLayout; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; import androidx.test.rule.ActivityTestRule; Loading @@ -37,7 +37,7 @@ import org.junit.Test; @LargeTest public class ViewPerfTest { @Rule public final PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public final BenchmarkRule mBenchmarkRule = new BenchmarkRule(); @Rule public final ActivityTestRule<PerfTestActivity> mActivityRule = Loading @@ -52,7 +52,7 @@ public class ViewPerfTest { @Test public void testSimpleViewInflate() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); LayoutInflater inflater = LayoutInflater.from(mContext); FrameLayout root = new FrameLayout(mContext); while (state.keepRunning()) { Loading @@ -62,7 +62,7 @@ public class ViewPerfTest { @Test public void testTwelveKeyInflate() { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); LayoutInflater inflater = LayoutInflater.from(mContext); FrameLayout root = new FrameLayout(mContext); while (state.keepRunning()) { Loading @@ -72,7 +72,7 @@ public class ViewPerfTest { @Test public void testPerformHapticFeedback() throws Throwable { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); mActivityRule.runOnUiThread(() -> { state.pauseTiming(); View view = new View(mContext); Loading
apct-tests/perftests/core/src/android/view/ViewShowHidePerfTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -21,14 +21,14 @@ import static org.junit.Assert.assertTrue; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; import android.perftests.utils.PerfTestActivity; import android.view.View.MeasureSpec; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; import androidx.test.rule.ActivityTestRule; Loading @@ -50,7 +50,7 @@ public class ViewShowHidePerfTest { new ActivityTestRule<>(PerfTestActivity.class); @Rule public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); public final BenchmarkRule mBenchmarkRule = new BenchmarkRule(); public Context getContext() { return InstrumentationRegistry.getInstrumentation().getTargetContext(); Loading Loading @@ -143,7 +143,7 @@ public class ViewShowHidePerfTest { private void testParentWithChild(TestCallback callback) throws Throwable { mActivityRule.runOnUiThread(() -> { final BenchmarkState state = mPerfStatusReporter.getBenchmarkState(); final BenchmarkState state = mBenchmarkRule.getState(); FrameLayout parent = new FrameLayout(getContext()); mActivityRule.getActivity().setContentView(parent); Loading