summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ActivityManagerPerfTests/utils/Android.bp2
-rw-r--r--tests/ActivityManagerPerfTests/utils/src/com/android/frameworks/perftests/am/util/Utils.java2
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt5
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt5
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt5
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWithLockOverlayApp.kt5
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt6
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenCameraOnDoubleClickPowerButton.kt8
-rw-r--r--tests/FlickerTests/src/com/android/server/wm/flicker/launch/TaskTransitionTest.kt2
-rw-r--r--tests/InputMethodStressTest/Android.bp5
-rw-r--r--tests/InputMethodStressTest/AndroidManifest.xml2
-rw-r--r--tests/InputMethodStressTest/AndroidTest.xml1
-rw-r--r--tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/AutoShowTest.java12
-rw-r--r--tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/DefaultImeVisibilityTest.java97
-rw-r--r--tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/DisableLockScreenRule.java53
-rw-r--r--tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ImeOpenCloseStressTest.java14
-rw-r--r--tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ImeStressTestRule.java153
-rw-r--r--tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/NotificationTest.java12
-rw-r--r--tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/PressHomeBeforeTestRule.java34
-rw-r--r--tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ScreenOrientationRule.java66
-rw-r--r--tests/SharedLibraryLoadingTest/AndroidTest.xml1
-rw-r--r--tests/SilkFX/assets/gainmaps/city_night.jpgbin2993575 -> 2995396 bytes
-rw-r--r--tests/SilkFX/assets/gainmaps/desert_palms.jpgbin3870215 -> 3859886 bytes
-rw-r--r--tests/SilkFX/assets/gainmaps/desert_sunset.jpgbin2578199 -> 2577663 bytes
-rw-r--r--tests/SilkFX/assets/gainmaps/desert_wanda.jpgbin1952120 -> 1925203 bytes
-rw-r--r--tests/SilkFX/assets/gainmaps/fountain_night.jpgbin3545222 -> 3579758 bytes
-rw-r--r--tests/SilkFX/assets/gainmaps/grand_canyon.jpgbin4732012 -> 4714624 bytes
-rw-r--r--tests/SilkFX/assets/gainmaps/lamps.jpgbin1646480 -> 1645109 bytes
-rw-r--r--tests/SilkFX/assets/gainmaps/mountain_lake.jpgbin3248097 -> 3242535 bytes
-rw-r--r--tests/SilkFX/assets/gainmaps/mountains.jpgbin4939241 -> 4936427 bytes
-rw-r--r--tests/SilkFX/assets/gainmaps/sunflower.jpgbin2530867 -> 2525581 bytes
-rw-r--r--tests/SilkFX/assets/gainmaps/train_station_night.jpgbin3277087 -> 3281254 bytes
32 files changed, 296 insertions, 194 deletions
diff --git a/tests/ActivityManagerPerfTests/utils/Android.bp b/tests/ActivityManagerPerfTests/utils/Android.bp
index 99c43c8d8fca..5902c1cbda15 100644
--- a/tests/ActivityManagerPerfTests/utils/Android.bp
+++ b/tests/ActivityManagerPerfTests/utils/Android.bp
@@ -32,6 +32,6 @@ java_test {
static_libs: [
"androidx.test.rules",
"junit",
- "ub-uiautomator",
+ "androidx.test.uiautomator_uiautomator",
],
}
diff --git a/tests/ActivityManagerPerfTests/utils/src/com/android/frameworks/perftests/am/util/Utils.java b/tests/ActivityManagerPerfTests/utils/src/com/android/frameworks/perftests/am/util/Utils.java
index fc787bafa93a..9bd94f2a9a1e 100644
--- a/tests/ActivityManagerPerfTests/utils/src/com/android/frameworks/perftests/am/util/Utils.java
+++ b/tests/ActivityManagerPerfTests/utils/src/com/android/frameworks/perftests/am/util/Utils.java
@@ -19,10 +19,10 @@ package com.android.frameworks.perftests.am.util;
import android.content.Intent;
import android.os.RemoteException;
import android.os.ResultReceiver;
-import android.support.test.uiautomator.UiDevice;
import android.util.Log;
import androidx.test.InstrumentationRegistry;
+import androidx.test.uiautomator.UiDevice;
import java.io.IOException;
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt
index a72c12dcb463..c5a21a80d8d0 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/helpers/PipAppHelper.kt
@@ -250,7 +250,10 @@ open class PipAppHelper(instrumentation: Instrumentation) :
waitConditions = arrayOf(ConditionsFactory.hasPipWindow())
)
- wmHelper.StateSyncBuilder().withPipShown().waitForAndVerify()
+ wmHelper.StateSyncBuilder()
+ .withWindowSurfaceAppeared(this)
+ .withPipShown()
+ .waitForAndVerify()
}
/** Expand the PIP window back to full screen via intent and wait until the app is visible */
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt
index 862efbd6a897..b1a267ac27b4 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationCold.kt
@@ -80,6 +80,11 @@ open class OpenAppFromLockNotificationCold(flicker: FlickerTest) :
/** {@inheritDoc} */
@Test
@Ignore("Display is off at the start")
+ override fun taskBarWindowIsAlwaysVisible() {}
+
+ /** {@inheritDoc} */
+ @Test
+ @Ignore("Display is off at the start")
override fun statusBarLayerIsVisibleAtStartAndEnd() =
super.statusBarLayerIsVisibleAtStartAndEnd()
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt
index 0ace64767dde..e41432555ded 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWarm.kt
@@ -97,6 +97,11 @@ class OpenAppFromLockNotificationWarm(flicker: FlickerTest) : OpenAppFromNotific
/** {@inheritDoc} */
@Test
+ @Ignore("Not applicable to this CUJ. Display starts locked and app is full screen at the end")
+ override fun taskBarWindowIsAlwaysVisible() {}
+
+ /** {@inheritDoc} */
+ @Test
@Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
override fun statusBarLayerPositionAtStartAndEnd() {}
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWithLockOverlayApp.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWithLockOverlayApp.kt
index 8f07f213521b..0b09e248b221 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWithLockOverlayApp.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromLockNotificationWithLockOverlayApp.kt
@@ -117,6 +117,11 @@ class OpenAppFromLockNotificationWithLockOverlayApp(flicker: FlickerTest) :
@Test
override fun entireScreenCovered() = super.entireScreenCovered()
+ @FlakyTest(bugId = 278227468)
+ @Test
+ override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
+ super.visibleWindowsShownMoreThanOneConsecutiveEntry()
+
companion object {
/**
* Creates the test configurations.
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt
index 4a9507aabf75..23cb1d49619f 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenAppFromNotificationWarm.kt
@@ -191,12 +191,6 @@ open class OpenAppFromNotificationWarm(flicker: FlickerTest) : OpenAppTransition
@Postsubmit
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
- /** {@inheritDoc} */
- @Postsubmit
- @Test
- override fun visibleLayersShownMoreThanOneConsecutiveEntry() =
- super.visibleLayersShownMoreThanOneConsecutiveEntry()
-
companion object {
/**
* Creates the test configurations.
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenCameraOnDoubleClickPowerButton.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenCameraOnDoubleClickPowerButton.kt
index 18e49fe1078f..ae9ca8007dc8 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenCameraOnDoubleClickPowerButton.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/OpenCameraOnDoubleClickPowerButton.kt
@@ -102,7 +102,7 @@ class OpenCameraOnDoubleClickPowerButton(flicker: FlickerTest) :
@Postsubmit @Test override fun entireScreenCovered() = super.entireScreenCovered()
- @Postsubmit
+ @Ignore("Not applicable to this CUJ. App is full screen at the end")
@Test
override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
@@ -127,11 +127,11 @@ class OpenCameraOnDoubleClickPowerButton(flicker: FlickerTest) :
@Test
override fun statusBarWindowIsAlwaysVisible() = super.statusBarWindowIsAlwaysVisible()
- @Postsubmit
+ @Ignore("Not applicable to this CUJ. App is full screen at the end")
@Test
override fun taskBarLayerIsVisibleAtStartAndEnd() = super.taskBarLayerIsVisibleAtStartAndEnd()
- @Postsubmit
+ @Ignore("Not applicable to this CUJ. App is full screen at the end")
@Test
override fun taskBarWindowIsAlwaysVisible() = super.taskBarWindowIsAlwaysVisible()
@@ -145,7 +145,7 @@ class OpenCameraOnDoubleClickPowerButton(flicker: FlickerTest) :
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
- @Postsubmit
+ @Ignore("Not applicable to this CUJ. App is full screen at the end")
@Test
override fun navBarWindowIsVisibleAtStartAndEnd() {
super.navBarWindowIsVisibleAtStartAndEnd()
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/TaskTransitionTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/TaskTransitionTest.kt
index 6fa65fd940ec..be735477dc40 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/launch/TaskTransitionTest.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/launch/TaskTransitionTest.kt
@@ -118,7 +118,7 @@ class TaskTransitionTest(flicker: FlickerTest) : BaseTest(flicker) {
}
/** Checks that a color background is visible while the task transition is occurring. */
- @Presubmit
+ @FlakyTest(bugId = 265007895)
@Test
fun transitionHasColorBackground() {
val backgroundColorLayer = ComponentNameMatcher("", "Animation Background")
diff --git a/tests/InputMethodStressTest/Android.bp b/tests/InputMethodStressTest/Android.bp
index 0ad38768238a..27640a5f51bc 100644
--- a/tests/InputMethodStressTest/Android.bp
+++ b/tests/InputMethodStressTest/Android.bp
@@ -32,5 +32,8 @@ android_test {
"general-tests",
"vts",
],
- sdk_version: "31",
+ data: [
+ ":SimpleTestIme",
+ ],
+ sdk_version: "current",
}
diff --git a/tests/InputMethodStressTest/AndroidManifest.xml b/tests/InputMethodStressTest/AndroidManifest.xml
index 2d183bcb81fd..62eee0270cac 100644
--- a/tests/InputMethodStressTest/AndroidManifest.xml
+++ b/tests/InputMethodStressTest/AndroidManifest.xml
@@ -17,7 +17,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.inputmethod.stresstest">
-
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<application>
<activity android:name=".ImeStressTestUtil$TestActivity"
android:configChanges="orientation|screenSize"/>
diff --git a/tests/InputMethodStressTest/AndroidTest.xml b/tests/InputMethodStressTest/AndroidTest.xml
index 9ac41351f684..bedf0990a188 100644
--- a/tests/InputMethodStressTest/AndroidTest.xml
+++ b/tests/InputMethodStressTest/AndroidTest.xml
@@ -25,6 +25,7 @@
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="SimpleTestIme.apk" />
<option name="test-file-name" value="InputMethodStressTest.apk" />
</target_preparer>
diff --git a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/AutoShowTest.java b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/AutoShowTest.java
index 9c70e6e568c4..3d257b29287f 100644
--- a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/AutoShowTest.java
+++ b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/AutoShowTest.java
@@ -61,14 +61,10 @@ import java.util.List;
@RunWith(Parameterized.class)
public final class AutoShowTest {
- @Rule(order = 0) public DisableLockScreenRule mDisableLockScreenRule =
- new DisableLockScreenRule();
- @Rule(order = 1) public UnlockScreenRule mUnlockScreenRule = new UnlockScreenRule();
- @Rule(order = 2) public ScreenOrientationRule mScreenOrientationRule =
- new ScreenOrientationRule(true /* isPortrait */);
- @Rule(order = 3) public PressHomeBeforeTestRule mPressHomeBeforeTestRule =
- new PressHomeBeforeTestRule();
- @Rule(order = 4) public ScreenCaptureRule mScreenCaptureRule =
+ @Rule(order = 0) public UnlockScreenRule mUnlockScreenRule = new UnlockScreenRule();
+ @Rule(order = 1) public ImeStressTestRule mImeStressTestRule =
+ new ImeStressTestRule(true /* useSimpleTestIme */);
+ @Rule(order = 2) public ScreenCaptureRule mScreenCaptureRule =
new ScreenCaptureRule("/sdcard/InputMethodStressTest");
@Parameterized.Parameters(
name = "windowFocusFlags={0}, softInputVisibility={1}, softInputAdjustment={2}")
diff --git a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/DefaultImeVisibilityTest.java b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/DefaultImeVisibilityTest.java
new file mode 100644
index 000000000000..299cbf1a84c7
--- /dev/null
+++ b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/DefaultImeVisibilityTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2023 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 com.android.inputmethod.stresstest;
+
+import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
+import static android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED;
+
+import static com.android.inputmethod.stresstest.ImeStressTestUtil.REQUEST_FOCUS_ON_CREATE;
+import static com.android.inputmethod.stresstest.ImeStressTestUtil.TestActivity.createIntent;
+import static com.android.inputmethod.stresstest.ImeStressTestUtil.callOnMainSync;
+import static com.android.inputmethod.stresstest.ImeStressTestUtil.verifyWindowAndViewFocus;
+import static com.android.inputmethod.stresstest.ImeStressTestUtil.waitOnMainUntilImeIsHidden;
+import static com.android.inputmethod.stresstest.ImeStressTestUtil.waitOnMainUntilImeIsShown;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Intent;
+import android.platform.test.annotations.RootPermissionTest;
+import android.platform.test.rule.UnlockScreenRule;
+import android.widget.EditText;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Test IME visibility by using system default IME to ensure the behavior is consistent
+ * across Android platform versions.
+ */
+@RootPermissionTest
+@RunWith(Parameterized.class)
+public final class DefaultImeVisibilityTest {
+
+ @Rule(order = 0)
+ public UnlockScreenRule mUnlockScreenRule = new UnlockScreenRule();
+ // Use system default IME for test.
+ @Rule(order = 1)
+ public ImeStressTestRule mImeStressTestRule =
+ new ImeStressTestRule(false /* useSimpleTestIme */);
+
+ @Rule(order = 2)
+ public ScreenCaptureRule mScreenCaptureRule =
+ new ScreenCaptureRule("/sdcard/InputMethodStressTest");
+
+ private static final int NUM_TEST_ITERATIONS = 10;
+
+ @Parameterized.Parameters(name = "isPortrait={0}")
+ public static List<Boolean> isPortraitCases() {
+ // Test in both portrait and landscape mode.
+ return Arrays.asList(true, false);
+ }
+
+ public DefaultImeVisibilityTest(boolean isPortrait) {
+ mImeStressTestRule.setIsPortrait(isPortrait);
+ }
+
+ @Test
+ public void showHideDefaultIme() {
+ Intent intent =
+ createIntent(
+ 0x0, /* No window focus flags */
+ SOFT_INPUT_STATE_UNSPECIFIED | SOFT_INPUT_ADJUST_RESIZE,
+ Collections.singletonList(REQUEST_FOCUS_ON_CREATE));
+ ImeStressTestUtil.TestActivity activity = ImeStressTestUtil.TestActivity.start(intent);
+ EditText editText = activity.getEditText();
+ for (int i = 0; i < NUM_TEST_ITERATIONS; i++) {
+
+ boolean showResult = callOnMainSync(activity::showImeWithInputMethodManager);
+ assertThat(showResult).isTrue();
+ verifyWindowAndViewFocus(editText, true, true);
+ waitOnMainUntilImeIsShown(editText);
+
+ boolean hideResult = callOnMainSync(activity::hideImeWithInputMethodManager);
+ assertThat(hideResult).isTrue();
+ waitOnMainUntilImeIsHidden(editText);
+ }
+ }
+}
diff --git a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/DisableLockScreenRule.java b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/DisableLockScreenRule.java
deleted file mode 100644
index d95decff2d86..000000000000
--- a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/DisableLockScreenRule.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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 com.android.inputmethod.stresstest;
-
-import android.support.test.uiautomator.UiDevice;
-
-import androidx.test.platform.app.InstrumentationRegistry;
-
-import org.junit.rules.TestWatcher;
-import org.junit.runner.Description;
-
-import java.io.IOException;
-
-/** Disable lock screen during the test. */
-public class DisableLockScreenRule extends TestWatcher {
- private static final String LOCK_SCREEN_OFF_COMMAND = "locksettings set-disabled true";
- private static final String LOCK_SCREEN_ON_COMMAND = "locksettings set-disabled false";
-
- private final UiDevice mUiDevice =
- UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
-
- @Override
- protected void starting(Description description) {
- try {
- mUiDevice.executeShellCommand(LOCK_SCREEN_OFF_COMMAND);
- } catch (IOException e) {
- throw new RuntimeException("Could not disable lock screen.", e);
- }
- }
-
- @Override
- protected void finished(Description description) {
- try {
- mUiDevice.executeShellCommand(LOCK_SCREEN_ON_COMMAND);
- } catch (IOException e) {
- throw new RuntimeException("Could not enable lock screen.", e);
- }
- }
-}
diff --git a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ImeOpenCloseStressTest.java b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ImeOpenCloseStressTest.java
index 9d4aefb69386..7632ab08b655 100644
--- a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ImeOpenCloseStressTest.java
+++ b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ImeOpenCloseStressTest.java
@@ -68,14 +68,10 @@ public final class ImeOpenCloseStressTest {
private static final String TAG = "ImeOpenCloseStressTest";
private static final int NUM_TEST_ITERATIONS = 10;
- @Rule(order = 0) public DisableLockScreenRule mDisableLockScreenRule =
- new DisableLockScreenRule();
- @Rule(order = 1) public UnlockScreenRule mUnlockScreenRule = new UnlockScreenRule();
- @Rule(order = 2) public ScreenOrientationRule mScreenOrientationRule =
- new ScreenOrientationRule(true /* isPortrait */);
- @Rule(order = 3) public PressHomeBeforeTestRule mPressHomeBeforeTestRule =
- new PressHomeBeforeTestRule();
- @Rule(order = 4) public ScreenCaptureRule mScreenCaptureRule =
+ @Rule(order = 0) public UnlockScreenRule mUnlockScreenRule = new UnlockScreenRule();
+ @Rule(order = 1) public ImeStressTestRule mImeStressTestRule =
+ new ImeStressTestRule(true /* useSimpleTestIme */);
+ @Rule(order = 2) public ScreenCaptureRule mScreenCaptureRule =
new ScreenCaptureRule("/sdcard/InputMethodStressTest");
private final Instrumentation mInstrumentation;
@@ -499,8 +495,6 @@ public final class ImeOpenCloseStressTest {
@Test
public void testRotateScreenWithKeyboardOn() throws Exception {
- // TODO(b/256739702): Keyboard disappears after rotating screen to landscape mode if
- // android:configChanges="orientation|screenSize" is not set
Intent intent =
createIntent(
mWindowFocusFlags,
diff --git a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ImeStressTestRule.java b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ImeStressTestRule.java
new file mode 100644
index 000000000000..12104b298dac
--- /dev/null
+++ b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ImeStressTestRule.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2023 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 com.android.inputmethod.stresstest;
+
+import android.app.Instrumentation;
+import android.os.RemoteException;
+import android.support.test.uiautomator.UiDevice;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.junit.rules.TestWatcher;
+import org.junit.runner.Description;
+
+import java.io.IOException;
+
+/**
+ * Do setup and cleanup for Ime stress tests, including disabling lock and auto-rotate screen,
+ * pressing home and enabling a simple test Ime during the tests.
+ */
+public class ImeStressTestRule extends TestWatcher {
+ private static final String LOCK_SCREEN_OFF_COMMAND = "locksettings set-disabled true";
+ private static final String LOCK_SCREEN_ON_COMMAND = "locksettings set-disabled false";
+ private static final String SET_PORTRAIT_MODE_COMMAND = "settings put system user_rotation 0";
+ private static final String SET_LANDSCAPE_MODE_COMMAND = "settings put system user_rotation 1";
+ private static final String SIMPLE_IME_ID =
+ "com.android.apps.inputmethod.simpleime/.SimpleInputMethodService";
+ private static final String ENABLE_IME_COMMAND = "ime enable " + SIMPLE_IME_ID;
+ private static final String SET_IME_COMMAND = "ime set " + SIMPLE_IME_ID;
+ private static final String DISABLE_IME_COMMAND = "ime disable " + SIMPLE_IME_ID;
+ private static final String RESET_IME_COMMAND = "ime reset";
+
+ @NonNull private final Instrumentation mInstrumentation;
+ @NonNull private final UiDevice mUiDevice;
+ // Whether the screen orientation is set to portrait.
+ private boolean mIsPortrait;
+ // Whether to use a simple test Ime or system default Ime for test.
+ private final boolean mUseSimpleTestIme;
+
+ public ImeStressTestRule(boolean useSimpleTestIme) {
+ mInstrumentation = InstrumentationRegistry.getInstrumentation();
+ mUiDevice = UiDevice.getInstance(mInstrumentation);
+ // Default is portrait mode
+ mIsPortrait = true;
+ mUseSimpleTestIme = useSimpleTestIme;
+ }
+
+ public void setIsPortrait(boolean isPortrait) {
+ mIsPortrait = isPortrait;
+ }
+
+ @Override
+ protected void starting(Description description) {
+ disableLockScreen();
+ setOrientation();
+ mUiDevice.pressHome();
+ if (mUseSimpleTestIme) {
+ enableSimpleIme();
+ } else {
+ resetImeToDefault();
+ }
+
+ mInstrumentation.waitForIdleSync();
+ }
+
+ @Override
+ protected void finished(Description description) {
+ if (mUseSimpleTestIme) {
+ disableSimpleIme();
+ }
+ unfreezeRotation();
+ restoreLockScreen();
+ }
+
+ private void disableLockScreen() {
+ try {
+ executeShellCommand(LOCK_SCREEN_OFF_COMMAND);
+ } catch (IOException e) {
+ throw new RuntimeException("Could not disable lock screen.", e);
+ }
+ }
+
+ private void restoreLockScreen() {
+ try {
+ executeShellCommand(LOCK_SCREEN_ON_COMMAND);
+ } catch (IOException e) {
+ throw new RuntimeException("Could not enable lock screen.", e);
+ }
+ }
+
+ private void setOrientation() {
+ try {
+ mUiDevice.freezeRotation();
+ executeShellCommand(
+ mIsPortrait ? SET_PORTRAIT_MODE_COMMAND : SET_LANDSCAPE_MODE_COMMAND);
+ } catch (IOException e) {
+ throw new RuntimeException("Could not set screen orientation.", e);
+ } catch (RemoteException e) {
+ throw new RuntimeException("Could not freeze rotation.", e);
+ }
+ }
+
+ private void unfreezeRotation() {
+ try {
+ mUiDevice.unfreezeRotation();
+ } catch (RemoteException e) {
+ throw new RuntimeException("Could not unfreeze screen rotation.", e);
+ }
+ }
+
+ private void enableSimpleIme() {
+ try {
+ executeShellCommand(ENABLE_IME_COMMAND);
+ executeShellCommand(SET_IME_COMMAND);
+ } catch (IOException e) {
+ throw new RuntimeException("Could not enable SimpleTestIme.", e);
+ }
+ }
+
+ private void disableSimpleIme() {
+ try {
+ executeShellCommand(DISABLE_IME_COMMAND);
+ } catch (IOException e) {
+ throw new RuntimeException("Could not disable SimpleTestIme.", e);
+ }
+ }
+
+ private void resetImeToDefault() {
+ try {
+ executeShellCommand(RESET_IME_COMMAND);
+ } catch (IOException e) {
+ throw new RuntimeException("Could not reset Ime to default.", e);
+ }
+ }
+
+ private @NonNull String executeShellCommand(@NonNull String cmd) throws IOException {
+ return mUiDevice.executeShellCommand(cmd);
+ }
+}
diff --git a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/NotificationTest.java b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/NotificationTest.java
index d2708ad47712..f4a04a163ebb 100644
--- a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/NotificationTest.java
+++ b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/NotificationTest.java
@@ -77,11 +77,10 @@ public final class NotificationTest {
private static final BySelector REPLY_SEND_BUTTON_SELECTOR =
By.res("com.android.systemui", "remote_input_send").enabled(true);
- @Rule
- public UnlockScreenRule mUnlockScreenRule = new UnlockScreenRule();
-
- @Rule
- public ScreenCaptureRule mScreenCaptureRule =
+ @Rule(order = 0) public UnlockScreenRule mUnlockScreenRule = new UnlockScreenRule();
+ @Rule(order = 1) public ImeStressTestRule mImeStressTestRule =
+ new ImeStressTestRule(true /* useSimpleTestIme */);
+ @Rule(order = 2) public ScreenCaptureRule mScreenCaptureRule =
new ScreenCaptureRule("/sdcard/InputMethodStressTest");
private Context mContext;
@@ -141,7 +140,8 @@ public final class NotificationTest {
// Post inline reply notification.
PendingIntent pendingIntent = PendingIntent.getBroadcast(
- mContext, REPLY_REQUEST_CODE, new Intent().setAction(ACTION_REPLY),
+ mContext, REPLY_REQUEST_CODE,
+ new Intent().setAction(ACTION_REPLY).setClass(mContext, NotificationTest.class),
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
RemoteInput remoteInput = new RemoteInput.Builder(REPLY_INPUT_KEY)
.setLabel(REPLY_INPUT_LABEL)
diff --git a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/PressHomeBeforeTestRule.java b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/PressHomeBeforeTestRule.java
deleted file mode 100644
index 6586f630fae4..000000000000
--- a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/PressHomeBeforeTestRule.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2023 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 com.android.inputmethod.stresstest;
-
-import android.support.test.uiautomator.UiDevice;
-
-import androidx.test.platform.app.InstrumentationRegistry;
-
-import org.junit.rules.TestWatcher;
-import org.junit.runner.Description;
-
-/** This rule will press home before a test case. */
-public class PressHomeBeforeTestRule extends TestWatcher {
- private final UiDevice mUiDevice =
- UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
-
- @Override
- protected void starting(Description description) {
- mUiDevice.pressHome();
- }
-}
diff --git a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ScreenOrientationRule.java b/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ScreenOrientationRule.java
deleted file mode 100644
index bc3b1efcf6b5..000000000000
--- a/tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/ScreenOrientationRule.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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 com.android.inputmethod.stresstest;
-
-import android.os.RemoteException;
-import android.support.test.uiautomator.UiDevice;
-
-import androidx.test.platform.app.InstrumentationRegistry;
-
-import org.junit.rules.TestWatcher;
-import org.junit.runner.Description;
-
-import java.io.IOException;
-
-/**
- * Disable auto-rotate during the test and set the screen orientation to portrait or landscape
- * before the test starts.
- */
-public class ScreenOrientationRule extends TestWatcher {
- private static final String SET_PORTRAIT_MODE_CMD = "settings put system user_rotation 0";
- private static final String SET_LANDSCAPE_MODE_CMD = "settings put system user_rotation 1";
-
- private final boolean mIsPortrait;
- private final UiDevice mUiDevice =
- UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
-
- ScreenOrientationRule(boolean isPortrait) {
- mIsPortrait = isPortrait;
- }
-
- @Override
- protected void starting(Description description) {
- try {
- mUiDevice.freezeRotation();
- mUiDevice.executeShellCommand(mIsPortrait ? SET_PORTRAIT_MODE_CMD :
- SET_LANDSCAPE_MODE_CMD);
- } catch (IOException e) {
- throw new RuntimeException("Could not set screen orientation.", e);
- } catch (RemoteException e) {
- throw new RuntimeException("Could not freeze rotation.", e);
- }
- }
-
- @Override
- protected void finished(Description description) {
- try {
- mUiDevice.unfreezeRotation();
- } catch (RemoteException e) {
- throw new RuntimeException("Could not unfreeze screen rotation.", e);
- }
- }
-}
diff --git a/tests/SharedLibraryLoadingTest/AndroidTest.xml b/tests/SharedLibraryLoadingTest/AndroidTest.xml
index 947453d07bd9..ad0584724fdc 100644
--- a/tests/SharedLibraryLoadingTest/AndroidTest.xml
+++ b/tests/SharedLibraryLoadingTest/AndroidTest.xml
@@ -22,7 +22,6 @@
<target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
- <option name="cleanup" value="false" />
<option name="remount-system" value="true" />
<option name="push"
value="SharedLibraryLoadingTests_StandardSharedLibrary.apk->/product/app/SharedLibraryLoadingTests_StandardSharedLibrary.apk" />
diff --git a/tests/SilkFX/assets/gainmaps/city_night.jpg b/tests/SilkFX/assets/gainmaps/city_night.jpg
index cdb4311ddcbe..ba26ed6a5780 100644
--- a/tests/SilkFX/assets/gainmaps/city_night.jpg
+++ b/tests/SilkFX/assets/gainmaps/city_night.jpg
Binary files differ
diff --git a/tests/SilkFX/assets/gainmaps/desert_palms.jpg b/tests/SilkFX/assets/gainmaps/desert_palms.jpg
index c337aadc2d4d..048178670a96 100644
--- a/tests/SilkFX/assets/gainmaps/desert_palms.jpg
+++ b/tests/SilkFX/assets/gainmaps/desert_palms.jpg
Binary files differ
diff --git a/tests/SilkFX/assets/gainmaps/desert_sunset.jpg b/tests/SilkFX/assets/gainmaps/desert_sunset.jpg
index fa15f5606af6..919a1574a4b9 100644
--- a/tests/SilkFX/assets/gainmaps/desert_sunset.jpg
+++ b/tests/SilkFX/assets/gainmaps/desert_sunset.jpg
Binary files differ
diff --git a/tests/SilkFX/assets/gainmaps/desert_wanda.jpg b/tests/SilkFX/assets/gainmaps/desert_wanda.jpg
index 33f69a92bac3..f5a2ef9c53ea 100644
--- a/tests/SilkFX/assets/gainmaps/desert_wanda.jpg
+++ b/tests/SilkFX/assets/gainmaps/desert_wanda.jpg
Binary files differ
diff --git a/tests/SilkFX/assets/gainmaps/fountain_night.jpg b/tests/SilkFX/assets/gainmaps/fountain_night.jpg
index 863127b7ac59..d8b2d759e4c0 100644
--- a/tests/SilkFX/assets/gainmaps/fountain_night.jpg
+++ b/tests/SilkFX/assets/gainmaps/fountain_night.jpg
Binary files differ
diff --git a/tests/SilkFX/assets/gainmaps/grand_canyon.jpg b/tests/SilkFX/assets/gainmaps/grand_canyon.jpg
index 12cd9665776e..2f605bbb0a7e 100644
--- a/tests/SilkFX/assets/gainmaps/grand_canyon.jpg
+++ b/tests/SilkFX/assets/gainmaps/grand_canyon.jpg
Binary files differ
diff --git a/tests/SilkFX/assets/gainmaps/lamps.jpg b/tests/SilkFX/assets/gainmaps/lamps.jpg
index 65bda89ad660..768665f643cb 100644
--- a/tests/SilkFX/assets/gainmaps/lamps.jpg
+++ b/tests/SilkFX/assets/gainmaps/lamps.jpg
Binary files differ
diff --git a/tests/SilkFX/assets/gainmaps/mountain_lake.jpg b/tests/SilkFX/assets/gainmaps/mountain_lake.jpg
index b2b10d287c69..b7981fdca6da 100644
--- a/tests/SilkFX/assets/gainmaps/mountain_lake.jpg
+++ b/tests/SilkFX/assets/gainmaps/mountain_lake.jpg
Binary files differ
diff --git a/tests/SilkFX/assets/gainmaps/mountains.jpg b/tests/SilkFX/assets/gainmaps/mountains.jpg
index 82acd45fc0d8..fe69993e0706 100644
--- a/tests/SilkFX/assets/gainmaps/mountains.jpg
+++ b/tests/SilkFX/assets/gainmaps/mountains.jpg
Binary files differ
diff --git a/tests/SilkFX/assets/gainmaps/sunflower.jpg b/tests/SilkFX/assets/gainmaps/sunflower.jpg
index 55b1b14c0ff4..4b17614d66bf 100644
--- a/tests/SilkFX/assets/gainmaps/sunflower.jpg
+++ b/tests/SilkFX/assets/gainmaps/sunflower.jpg
Binary files differ
diff --git a/tests/SilkFX/assets/gainmaps/train_station_night.jpg b/tests/SilkFX/assets/gainmaps/train_station_night.jpg
index 45142bb326ee..ecd45ee1e629 100644
--- a/tests/SilkFX/assets/gainmaps/train_station_night.jpg
+++ b/tests/SilkFX/assets/gainmaps/train_station_night.jpg
Binary files differ