Loading apct-tests/perftests/inputmethod/src/android/inputmethod/ImePerfTest.java +13 −11 Original line number Diff line number Diff line Loading @@ -24,8 +24,6 @@ import static android.view.WindowInsetsAnimation.Callback.DISPATCH_MODE_STOP; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; import static org.junit.Assert.assertTrue; import android.annotation.UiThread; import android.app.Activity; import android.content.ComponentName; Loading @@ -39,6 +37,7 @@ import android.perftests.utils.PerfManualStatusReporter; import android.perftests.utils.TraceMarkParser; import android.perftests.utils.TraceMarkParser.TraceMarkSlice; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.ViewGroup; Loading @@ -53,6 +52,7 @@ import androidx.annotation.Nullable; import androidx.test.filters.LargeTest; import com.android.compatibility.common.util.PollingCheck; import com.android.compatibility.common.util.SystemUtil; import junit.framework.Assert; Loading Loading @@ -185,7 +185,6 @@ public class ImePerfTest extends ImePerfTestBase public static class BaselineIme extends InputMethodService { public static final int HEIGHT_DP = 100; private static int sPid; @Override public View onCreateInputView() { Loading @@ -196,14 +195,10 @@ public class ImePerfTest extends ImePerfTestBase view.setPadding(0, 0, 0, 0); view.addView(inner, new FrameLayout.LayoutParams(MATCH_PARENT, height)); inner.setBackgroundColor(0xff01fe10); // green sPid = Process.myPid(); Log.v(TAG, "onCreateInputView"); return view; } static int getPid() { return sPid; } static ComponentName getName(Context context) { return new ComponentName(context, BaselineIme.class); } Loading Loading @@ -281,9 +276,16 @@ public class ImePerfTest extends ImePerfTestBase } private void killBaselineIme() { assertTrue("PID of test and IME can't be same", Process.myPid() != BaselineIme.getPid()); Process.killProcess(BaselineIme.getPid()); // pidof returns a space separated list of numeric PIDs. String result = SystemUtil.runShellCommand( "pidof com.android.perftests.inputmethod:BaselineIME"); for (String pid : result.trim().split(" ")) { // The output may be empty if there is no process with the name. if (TextUtils.isEmpty(pid)) { continue; } Process.killProcess(Integer.parseInt(pid)); } } private void testShowOrHideImeWarm(final boolean show) throws Throwable { Loading Loading
apct-tests/perftests/inputmethod/src/android/inputmethod/ImePerfTest.java +13 −11 Original line number Diff line number Diff line Loading @@ -24,8 +24,6 @@ import static android.view.WindowInsetsAnimation.Callback.DISPATCH_MODE_STOP; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; import static org.junit.Assert.assertTrue; import android.annotation.UiThread; import android.app.Activity; import android.content.ComponentName; Loading @@ -39,6 +37,7 @@ import android.perftests.utils.PerfManualStatusReporter; import android.perftests.utils.TraceMarkParser; import android.perftests.utils.TraceMarkParser.TraceMarkSlice; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.view.ViewGroup; Loading @@ -53,6 +52,7 @@ import androidx.annotation.Nullable; import androidx.test.filters.LargeTest; import com.android.compatibility.common.util.PollingCheck; import com.android.compatibility.common.util.SystemUtil; import junit.framework.Assert; Loading Loading @@ -185,7 +185,6 @@ public class ImePerfTest extends ImePerfTestBase public static class BaselineIme extends InputMethodService { public static final int HEIGHT_DP = 100; private static int sPid; @Override public View onCreateInputView() { Loading @@ -196,14 +195,10 @@ public class ImePerfTest extends ImePerfTestBase view.setPadding(0, 0, 0, 0); view.addView(inner, new FrameLayout.LayoutParams(MATCH_PARENT, height)); inner.setBackgroundColor(0xff01fe10); // green sPid = Process.myPid(); Log.v(TAG, "onCreateInputView"); return view; } static int getPid() { return sPid; } static ComponentName getName(Context context) { return new ComponentName(context, BaselineIme.class); } Loading Loading @@ -281,9 +276,16 @@ public class ImePerfTest extends ImePerfTestBase } private void killBaselineIme() { assertTrue("PID of test and IME can't be same", Process.myPid() != BaselineIme.getPid()); Process.killProcess(BaselineIme.getPid()); // pidof returns a space separated list of numeric PIDs. String result = SystemUtil.runShellCommand( "pidof com.android.perftests.inputmethod:BaselineIME"); for (String pid : result.trim().split(" ")) { // The output may be empty if there is no process with the name. if (TextUtils.isEmpty(pid)) { continue; } Process.killProcess(Integer.parseInt(pid)); } } private void testShowOrHideImeWarm(final boolean show) throws Throwable { Loading