Loading apct-tests/perftests/core/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ android_test { "apct-perftests-resources-manager-apps", "apct-perftests-utils", "collector-device-lib", "compatibility-device-util-axt", "core-tests-support", "guava", ], Loading apct-tests/perftests/core/AndroidManifest.xml +10 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,16 @@ </intent-filter> </service> <service android:name="android.view.HandwritingImeService" android:label="Handwriting IME" android:permission="android.permission.BIND_INPUT_METHOD" android:exported="true"> <intent-filter> <action android:name="android.view.InputMethod"/> </intent-filter> <meta-data android:name="android.view.im" android:resource="@xml/ime_meta_handwriting"/> </service> </application> <instrumentation android:name="androidx.benchmark.junit4.AndroidBenchmarkRunner" Loading apct-tests/perftests/core/res/xml/ime_meta_handwriting.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2022 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <input-method xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="com.android.inputmethod.latin.settings.SettingsActivity" android:supportsStylusHandwriting="true"/> apct-tests/perftests/core/src/android/view/HandwritingImeService.java 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.view; import android.content.ComponentName; import android.inputmethodservice.InputMethodService; public class HandwritingImeService extends InputMethodService { private static final String PACKAGE_NAME = "com.android.perftests.core"; private static ComponentName getComponentName() { return new ComponentName(PACKAGE_NAME, HandwritingImeService.class.getName()); } static String getImeId() { return getComponentName().flattenToShortString(); } } apct-tests/perftests/core/src/android/view/HandwritingInitiatorPerfTest.java +17 −4 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import static android.view.MotionEvent.ACTION_UP; import static android.view.MotionEvent.TOOL_TYPE_FINGER; import static android.view.MotionEvent.TOOL_TYPE_STYLUS; import android.app.Instrumentation; import android.content.Context; import android.perftests.utils.BenchmarkState; Loading @@ -34,11 +33,15 @@ import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import com.android.compatibility.common.util.PollingCheck; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import java.util.concurrent.TimeUnit; /** * Benchmark tests for {@link HandwritingInitiator} * Loading @@ -56,11 +59,21 @@ public class HandwritingInitiatorPerfTest { public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Before public void setup() { final Instrumentation mInstrumentation = InstrumentationRegistry.getInstrumentation(); mContext = mInstrumentation.getTargetContext(); public void setup() throws Exception { final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); mContext = instrumentation.getTargetContext(); String imeId = HandwritingImeService.getImeId(); instrumentation.getUiAutomation().executeShellCommand("ime enable " + imeId); instrumentation.getUiAutomation().executeShellCommand("ime set " + imeId); PollingCheck.check("Check that stylus handwriting is available", TimeUnit.SECONDS.toMillis(10), () -> mContext.getSystemService(InputMethodManager.class) .isStylusHandwritingAvailable()); final ViewConfiguration viewConfiguration = ViewConfiguration.get(mContext); mTouchSlop = viewConfiguration.getScaledTouchSlop(); final InputMethodManager inputMethodManager = mContext.getSystemService(InputMethodManager.class); mHandwritingInitiator = new HandwritingInitiator(viewConfiguration, inputMethodManager); Loading Loading
apct-tests/perftests/core/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ android_test { "apct-perftests-resources-manager-apps", "apct-perftests-utils", "collector-device-lib", "compatibility-device-util-axt", "core-tests-support", "guava", ], Loading
apct-tests/perftests/core/AndroidManifest.xml +10 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,16 @@ </intent-filter> </service> <service android:name="android.view.HandwritingImeService" android:label="Handwriting IME" android:permission="android.permission.BIND_INPUT_METHOD" android:exported="true"> <intent-filter> <action android:name="android.view.InputMethod"/> </intent-filter> <meta-data android:name="android.view.im" android:resource="@xml/ime_meta_handwriting"/> </service> </application> <instrumentation android:name="androidx.benchmark.junit4.AndroidBenchmarkRunner" Loading
apct-tests/perftests/core/res/xml/ime_meta_handwriting.xml 0 → 100644 +21 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2022 The Android Open Source Project ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <input-method xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="com.android.inputmethod.latin.settings.SettingsActivity" android:supportsStylusHandwriting="true"/>
apct-tests/perftests/core/src/android/view/HandwritingImeService.java 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.view; import android.content.ComponentName; import android.inputmethodservice.InputMethodService; public class HandwritingImeService extends InputMethodService { private static final String PACKAGE_NAME = "com.android.perftests.core"; private static ComponentName getComponentName() { return new ComponentName(PACKAGE_NAME, HandwritingImeService.class.getName()); } static String getImeId() { return getComponentName().flattenToShortString(); } }
apct-tests/perftests/core/src/android/view/HandwritingInitiatorPerfTest.java +17 −4 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import static android.view.MotionEvent.ACTION_UP; import static android.view.MotionEvent.TOOL_TYPE_FINGER; import static android.view.MotionEvent.TOOL_TYPE_STYLUS; import android.app.Instrumentation; import android.content.Context; import android.perftests.utils.BenchmarkState; Loading @@ -34,11 +33,15 @@ import androidx.test.filters.LargeTest; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import com.android.compatibility.common.util.PollingCheck; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import java.util.concurrent.TimeUnit; /** * Benchmark tests for {@link HandwritingInitiator} * Loading @@ -56,11 +59,21 @@ public class HandwritingInitiatorPerfTest { public PerfStatusReporter mPerfStatusReporter = new PerfStatusReporter(); @Before public void setup() { final Instrumentation mInstrumentation = InstrumentationRegistry.getInstrumentation(); mContext = mInstrumentation.getTargetContext(); public void setup() throws Exception { final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); mContext = instrumentation.getTargetContext(); String imeId = HandwritingImeService.getImeId(); instrumentation.getUiAutomation().executeShellCommand("ime enable " + imeId); instrumentation.getUiAutomation().executeShellCommand("ime set " + imeId); PollingCheck.check("Check that stylus handwriting is available", TimeUnit.SECONDS.toMillis(10), () -> mContext.getSystemService(InputMethodManager.class) .isStylusHandwritingAvailable()); final ViewConfiguration viewConfiguration = ViewConfiguration.get(mContext); mTouchSlop = viewConfiguration.getScaledTouchSlop(); final InputMethodManager inputMethodManager = mContext.getSystemService(InputMethodManager.class); mHandwritingInitiator = new HandwritingInitiator(viewConfiguration, inputMethodManager); Loading