Rename StubActivity to PerfTestActivity

The activity is real.

Bug: 131727899
Test: atest CorePerfTests
Change-Id: I7fdb41aa5447329c0b1b6960f9e3d808be69648d
This commit is contained in:
Riddle Hsu
2019-09-24 17:54:38 -06:00
parent 166b7cbbc8
commit 1be1dd6bbf
17 changed files with 49 additions and 42 deletions

View File

@ -20,9 +20,9 @@ import static org.junit.Assert.assertTrue;
import android.os.Looper;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.PerfTestActivity;
import android.perftests.utils.SettingsHelper;
import android.perftests.utils.SettingsStateKeeperRule;
import android.perftests.utils.StubActivity;
import android.provider.Settings;
import androidx.test.InstrumentationRegistry;
@ -46,8 +46,8 @@ public abstract class AbstractAutofillPerfTestCase {
Settings.Secure.AUTOFILL_SERVICE);
@Rule
public ActivityTestRule<StubActivity> mActivityRule =
new ActivityTestRule<StubActivity>(StubActivity.class);
public ActivityTestRule<PerfTestActivity> mActivityRule =
new ActivityTestRule<>(PerfTestActivity.class);
@Rule
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@ -68,7 +68,7 @@ public abstract class AbstractAutofillPerfTestCase {
Looper.getMainLooper().getThread() == Thread.currentThread());
assertTrue("We should be running on the main thread",
Looper.myLooper() == Looper.getMainLooper());
StubActivity activity = mActivityRule.getActivity();
PerfTestActivity activity = mActivityRule.getActivity();
activity.setContentView(mLayoutId);
onCreate(activity);
});
@ -89,9 +89,9 @@ public abstract class AbstractAutofillPerfTestCase {
}
/**
* Initializes the {@link StubActivity} after it was launched.
* Initializes the {@link PerfTestActivity} after it was launched.
*/
protected abstract void onCreate(StubActivity activity);
protected abstract void onCreate(PerfTestActivity activity);
/**
* Uses the {@code settings} binary to set the autofill service.

View File

@ -20,7 +20,7 @@ import static android.view.autofill.AutofillManager.AutofillCallback.EVENT_INPUT
import static android.view.autofill.AutofillManager.AutofillCallback.EVENT_INPUT_SHOWN;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import android.view.View;
import android.widget.EditText;
@ -39,7 +39,7 @@ public class LoginTest extends AbstractAutofillPerfTestCase {
}
@Override
protected void onCreate(StubActivity activity) {
protected void onCreate(PerfTestActivity activity) {
View root = activity.getWindow().getDecorView();
mUsername = root.findViewById(R.id.username);
mPassword = root.findViewById(R.id.password);

View File

@ -13,7 +13,7 @@
<application>
<uses-library android:name="android.test.runner" />
<activity android:name="android.perftests.utils.StubActivity">
<activity android:name="android.perftests.utils.PerfTestActivity">
<intent-filter>
<action android:name="com.android.perftests.core.PERFTEST" />
</intent-filter>

View File

@ -20,7 +20,7 @@ import android.content.Context;
import android.content.Intent;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.LargeTest;
@ -48,7 +48,7 @@ public class PendingIntentPerfTest {
@Before
public void setUp() {
mContext = InstrumentationRegistry.getTargetContext();
mIntent = StubActivity.createLaunchIntent(mContext);
mIntent = PerfTestActivity.createLaunchIntent(mContext);
}
/**

View File

@ -19,7 +19,7 @@ package android.graphics.perftests;
import android.graphics.Paint;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
@ -58,7 +58,8 @@ public class PaintHasGlyphPerfTest {
}
@Rule
public ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule(StubActivity.class);
public ActivityTestRule<PerfTestActivity> mActivityRule =
new ActivityTestRule<>(PerfTestActivity.class);
@Rule
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();

View File

@ -26,7 +26,7 @@ import android.graphics.drawable.VectorDrawable;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.BitmapUtils;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import android.test.suitebuilder.annotation.LargeTest;
import androidx.test.rule.ActivityTestRule;
@ -48,8 +48,8 @@ public class VectorDrawablePerfTest {
private int[] mTestHeights = {512, 1024};
@Rule
public ActivityTestRule<StubActivity> mActivityRule =
new ActivityTestRule(StubActivity.class);
public ActivityTestRule<PerfTestActivity> mActivityRule =
new ActivityTestRule<>(PerfTestActivity.class);
@Rule
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();

View File

@ -23,7 +23,7 @@ import android.graphics.Paint;
import android.graphics.Paint.FontMetricsInt;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import android.text.style.ReplacementSpan;
import android.util.ArraySet;
@ -75,7 +75,8 @@ public class DynamicLayoutPerfTest {
}
@Rule
public ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule(StubActivity.class);
public ActivityTestRule<PerfTestActivity> mActivityRule =
new ActivityTestRule<>(PerfTestActivity.class);
@Rule
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();

View File

@ -23,7 +23,7 @@ import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import android.view.View.MeasureSpec;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -46,7 +46,8 @@ import java.util.List;
public class ViewShowHidePerfTest {
@Rule
public ActivityTestRule mActivityRule = new ActivityTestRule(StubActivity.class);
public ActivityTestRule<PerfTestActivity> mActivityRule =
new ActivityTestRule<>(PerfTestActivity.class);
@Rule
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();

View File

@ -18,7 +18,7 @@ package android.widget;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import android.text.Selection;
import android.view.KeyEvent;
import android.view.View.MeasureSpec;
@ -80,7 +80,8 @@ public class EditTextBackspacePerfTest {
}
@Rule
public ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule(StubActivity.class);
public ActivityTestRule<PerfTestActivity> mActivityRule =
new ActivityTestRule<>(PerfTestActivity.class);
@Rule
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();

View File

@ -18,7 +18,7 @@ package android.widget;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import android.text.Selection;
import android.view.KeyEvent;
import android.view.View.MeasureSpec;
@ -74,7 +74,8 @@ public class EditTextCursorMovementPerfTest {
}
@Rule
public ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule(StubActivity.class);
public ActivityTestRule<PerfTestActivity> mActivityRule =
new ActivityTestRule<>(PerfTestActivity.class);
@Rule
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();

View File

@ -19,7 +19,7 @@ package android.widget;
import android.app.Activity;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import android.view.KeyEvent;
import android.view.View.MeasureSpec;
import android.view.ViewGroup;
@ -59,7 +59,8 @@ public class EditTextLongTextPerfTest {
}
@Rule
public ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule(StubActivity.class);
public ActivityTestRule<PerfTestActivity> mActivityRule =
new ActivityTestRule<>(PerfTestActivity.class);
@Rule
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();

View File

@ -28,7 +28,7 @@ import android.app.Activity;
import android.os.Looper;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import android.view.View;
import android.view.ViewGroup;
@ -72,8 +72,8 @@ public class LayoutPerfTest {
}
@Rule
public ActivityTestRule<StubActivity> mActivityRule =
new ActivityTestRule(StubActivity.class);
public ActivityTestRule<PerfTestActivity> mActivityRule =
new ActivityTestRule(PerfTestActivity.class);
@Rule
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();

View File

@ -22,7 +22,7 @@ import android.app.Activity;
import android.os.Looper;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
@ -64,8 +64,8 @@ public class TextViewAutoSizeLayoutPerfTest {
}
@Rule
public ActivityTestRule<StubActivity> mActivityRule =
new ActivityTestRule(StubActivity.class);
public ActivityTestRule<PerfTestActivity> mActivityRule =
new ActivityTestRule(PerfTestActivity.class);
@Rule
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();

View File

@ -18,7 +18,7 @@ package android.widget;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
@ -56,7 +56,8 @@ public class TextViewSetTextLocalePerfTest {
}
@Rule
public ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule(StubActivity.class);
public ActivityTestRule<PerfTestActivity> mActivityRule =
new ActivityTestRule<>(PerfTestActivity.class);
@Rule
public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();

View File

@ -39,7 +39,7 @@ import android.os.SystemClock;
import android.perftests.utils.ManualBenchmarkState;
import android.perftests.utils.ManualBenchmarkState.ManualBenchmarkTest;
import android.perftests.utils.PerfManualStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import android.util.Pair;
import android.view.IRecentsAnimationController;
import android.view.IRecentsAnimationRunner;
@ -77,8 +77,8 @@ public class RecentsAnimationPerfTest extends WindowManagerPerfTestBase {
public final PerfManualStatusReporter mPerfStatusReporter = new PerfManualStatusReporter();
@Rule
public final ActivityTestRule<StubActivity> mActivityRule = new ActivityTestRule<>(
StubActivity.class, false /* initialTouchMode */, false /* launchActivity */);
public final ActivityTestRule<PerfTestActivity> mActivityRule = new ActivityTestRule<>(
PerfTestActivity.class, false /* initialTouchMode */, false /* launchActivity */);
private long mMeasuredTimeNs;
private LifecycleListener mLifecycleListener;

View File

@ -24,7 +24,7 @@ import android.graphics.Rect;
import android.os.RemoteException;
import android.perftests.utils.BenchmarkState;
import android.perftests.utils.PerfStatusReporter;
import android.perftests.utils.StubActivity;
import android.perftests.utils.PerfTestActivity;
import android.util.MergedConfiguration;
import android.view.DisplayCutout;
import android.view.IWindow;
@ -57,8 +57,8 @@ public class RelayoutPerfTest extends WindowManagerPerfTestBase {
public final PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter();
@Rule
public final ActivityTestRule<StubActivity> mActivityRule =
new ActivityTestRule<>(StubActivity.class);
public final ActivityTestRule<PerfTestActivity> mActivityRule =
new ActivityTestRule<>(PerfTestActivity.class);
/** This is only a placement to match the input parameters from {@link #getParameters}. */
@Parameterized.Parameter(0)

View File

@ -20,11 +20,11 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
public class StubActivity extends Activity {
public class PerfTestActivity extends Activity {
public static Intent createLaunchIntent(Context context) {
final Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClass(context, StubActivity.class);
intent.setClass(context, PerfTestActivity.class);
return intent;
}
}