summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/AppJankTest/src/android/app/jank/tests/JankUtils.java1
-rw-r--r--tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt18
-rw-r--r--tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/splitscreen/EnterSystemSplitTest.kt3
-rw-r--r--tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromFixedOrientationTest.kt2
-rw-r--r--tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/BottomHalfPipAppHelper.kt27
-rw-r--r--tests/FlickerTests/test-apps/flickerapp/res/layout/activity_bottom_half_pip.xml154
-rw-r--r--tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/BottomHalfPipActivity.java49
-rw-r--r--tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/PipActivity.java2
-rw-r--r--tests/Input/AndroidManifest.xml2
-rw-r--r--tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt41
-rw-r--r--tests/Input/src/com/android/test/input/CaptureEventActivity.kt85
-rw-r--r--tests/Input/src/com/android/test/input/UinputRecordingIntegrationTests.kt1
-rw-r--r--tests/InputScreenshotTest/robotests/Android.bp1
-rw-r--r--tests/Internal/Android.bp1
-rw-r--r--tests/PlatformCompatGating/src/com/android/tests/gating/PlatformCompatPermissionsTest.java25
-rw-r--r--tests/testables/tests/AndroidTest.xml1
16 files changed, 286 insertions, 127 deletions
diff --git a/tests/AppJankTest/src/android/app/jank/tests/JankUtils.java b/tests/AppJankTest/src/android/app/jank/tests/JankUtils.java
index df92898d76b1..9640a84eb9ca 100644
--- a/tests/AppJankTest/src/android/app/jank/tests/JankUtils.java
+++ b/tests/AppJankTest/src/android/app/jank/tests/JankUtils.java
@@ -29,6 +29,7 @@ public class JankUtils {
AppJankStats jankStats = new AppJankStats(
/*App Uid*/APP_ID,
/*Widget Id*/"test widget id",
+ /*navigationComponent*/null,
/*Widget Category*/AppJankStats.WIDGET_CATEGORY_SCROLL,
/*Widget State*/AppJankStats.WIDGET_STATE_SCROLLING,
/*Total Frames*/100,
diff --git a/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt
index 08b5f38a4655..75bd5d157bb2 100644
--- a/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt
+++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/open/MainActivityStartsSecondaryWithAlwaysExpandTest.kt
@@ -17,7 +17,6 @@
package com.android.server.wm.flicker.activityembedding.open
import android.graphics.Rect
-import android.platform.test.annotations.Presubmit
import android.tools.flicker.junit.FlickerParametersRunnerFactory
import android.tools.flicker.legacy.FlickerBuilder
import android.tools.flicker.legacy.LegacyFlickerTest
@@ -68,13 +67,21 @@ class MainActivityStartsSecondaryWithAlwaysExpandTest(flicker: LegacyFlickerTest
}
}
- @Ignore("Not applicable to this CUJ.") override fun navBarWindowIsVisibleAtStartAndEnd() {}
+ @Ignore("Not applicable to this CUJ.")
+ @Test
+ override fun navBarWindowIsVisibleAtStartAndEnd() {}
- @FlakyTest(bugId = 291575593) override fun entireScreenCovered() {}
+ @FlakyTest(bugId = 291575593)
+ @Test
+ override fun entireScreenCovered() {}
- @Ignore("Not applicable to this CUJ.") override fun statusBarWindowIsAlwaysVisible() {}
+ @Ignore("Not applicable to this CUJ.")
+ @Test
+ override fun statusBarWindowIsAlwaysVisible() {}
- @Ignore("Not applicable to this CUJ.") override fun statusBarLayerPositionAtStartAndEnd() {}
+ @Ignore("Not applicable to this CUJ.")
+ @Test
+ override fun statusBarLayerPositionAtStartAndEnd() {}
/** Transition begins with a split. */
@FlakyTest(bugId = 286952194)
@@ -122,7 +129,6 @@ class MainActivityStartsSecondaryWithAlwaysExpandTest(flicker: LegacyFlickerTest
/** Always expand activity is on top of the split. */
@FlakyTest(bugId = 286952194)
- @Presubmit
@Test
fun endsWithAlwaysExpandActivityOnTop() {
flicker.assertWmEnd {
diff --git a/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/splitscreen/EnterSystemSplitTest.kt b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/splitscreen/EnterSystemSplitTest.kt
index 0ca8f37b239b..e41364595648 100644
--- a/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/splitscreen/EnterSystemSplitTest.kt
+++ b/tests/FlickerTests/ActivityEmbedding/src/com/android/server/wm/flicker/activityembedding/splitscreen/EnterSystemSplitTest.kt
@@ -176,12 +176,15 @@ class EnterSystemSplitTest(flicker: LegacyFlickerTest) : ActivityEmbeddingTestBa
}
@Ignore("Not applicable to this CUJ.")
+ @Test
override fun visibleLayersShownMoreThanOneConsecutiveEntry() {}
@FlakyTest(bugId = 342596801)
+ @Test
override fun entireScreenCovered() = super.entireScreenCovered()
@FlakyTest(bugId = 342596801)
+ @Test
override fun visibleWindowsShownMoreThanOneConsecutiveEntry() =
super.visibleWindowsShownMoreThanOneConsecutiveEntry()
diff --git a/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromFixedOrientationTest.kt b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromFixedOrientationTest.kt
index b8f11dcf8970..ad083fa428a9 100644
--- a/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromFixedOrientationTest.kt
+++ b/tests/FlickerTests/IME/src/com/android/server/wm/flicker/ime/ShowImeOnAppStartWhenLaunchingAppFromFixedOrientationTest.kt
@@ -16,7 +16,6 @@
package com.android.server.wm.flicker.ime
-import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.tools.Rotation
import android.tools.flicker.junit.FlickerParametersRunnerFactory
@@ -81,7 +80,6 @@ class ShowImeOnAppStartWhenLaunchingAppFromFixedOrientationTest(flicker: LegacyF
}
@FlakyTest(bugId = 290767483)
- @Postsubmit
@Test
fun imeLayerAlphaOneAfterSnapshotStartingWindowRemoval() {
val layerTrace = flicker.reader.readLayersTrace() ?: error("Unable to read layers trace")
diff --git a/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/BottomHalfPipAppHelper.kt b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/BottomHalfPipAppHelper.kt
index ed2cff4a9515..fe344c9b79f2 100644
--- a/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/BottomHalfPipAppHelper.kt
+++ b/tests/FlickerTests/test-apps/app-helpers/src/com/android/server/wm/flicker/helpers/BottomHalfPipAppHelper.kt
@@ -18,25 +18,28 @@ package com.android.server.wm.flicker.helpers
import android.app.Instrumentation
import android.content.Intent
-import android.tools.traces.parsers.toFlickerComponent
import android.tools.traces.parsers.WindowManagerStateHelper
-import com.android.server.wm.flicker.testapp.ActivityOptions
+import android.tools.traces.parsers.toFlickerComponent
+import com.android.server.wm.flicker.testapp.ActivityOptions.BottomHalfPip
class BottomHalfPipAppHelper(
instrumentation: Instrumentation,
private val useLaunchingActivity: Boolean = false,
+ private val fillTaskOnCreate: Boolean = true,
) : PipAppHelper(
instrumentation,
- appName = ActivityOptions.BottomHalfPip.LABEL,
- componentNameMatcher = ActivityOptions.BottomHalfPip.COMPONENT
- .toFlickerComponent()
+ appName = BottomHalfPip.LABEL,
+ componentNameMatcher = BottomHalfPip.COMPONENT.toFlickerComponent()
) {
override val openAppIntent: Intent
get() = super.openAppIntent.apply {
component = if (useLaunchingActivity) {
- ActivityOptions.BottomHalfPip.LAUNCHING_APP_COMPONENT
+ BottomHalfPip.LAUNCHING_APP_COMPONENT
} else {
- ActivityOptions.BottomHalfPip.COMPONENT
+ BottomHalfPip.COMPONENT
+ }
+ if (fillTaskOnCreate) {
+ putExtra(BottomHalfPip.EXTRA_BOTTOM_HALF_LAYOUT, false.toString())
}
}
@@ -44,9 +47,17 @@ class BottomHalfPipAppHelper(
launchViaIntent(
wmHelper,
Intent().apply {
- component = ActivityOptions.BottomHalfPip.COMPONENT
+ component = BottomHalfPip.COMPONENT
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
)
}
+
+ fun toggleBottomHalfLayout() {
+ clickObject(TOGGLE_BOTTOM_HALF_LAYOUT_ID)
+ }
+
+ companion object {
+ private const val TOGGLE_BOTTOM_HALF_LAYOUT_ID = "toggle_bottom_half_layout"
+ }
} \ No newline at end of file
diff --git a/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_bottom_half_pip.xml b/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_bottom_half_pip.xml
new file mode 100644
index 000000000000..2f9c3aa82057
--- /dev/null
+++ b/tests/FlickerTests/test-apps/flickerapp/res/layout/activity_bottom_half_pip.xml
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2024 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.
+ -->
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:background="@android:color/holo_blue_bright">
+
+ <!-- All the buttons (and other clickable elements) should be arranged in a way so that it is
+ possible to "cycle" over all them by clicking on the D-Pad DOWN button. The way we do it
+ here is by arranging them this vertical LL and by relying on the nextFocusDown attribute
+ where things are arranged differently and to circle back up to the top once we reach the
+ bottom. -->
+
+ <Button
+ android:id="@+id/enter_pip"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Enter PIP"
+ android:onClick="enterPip"/>
+
+ <Button
+ android:id="@+id/toggle_bottom_half_layout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Set Bottom Half Layout"
+ android:onClick="toggleBottomHalfLayout"/>
+
+ <CheckBox
+ android:id="@+id/with_custom_actions"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="With custom actions"/>
+
+ <RadioGroup
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:checkedButton="@id/enter_pip_on_leave_disabled">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Enter PiP on home press"/>
+
+ <RadioButton
+ android:id="@+id/enter_pip_on_leave_disabled"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Disabled"
+ android:onClick="onAutoPipSelected"/>
+
+ <RadioButton
+ android:id="@+id/enter_pip_on_leave_manual"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Via code behind"
+ android:onClick="onAutoPipSelected"/>
+
+ <RadioButton
+ android:id="@+id/enter_pip_on_leave_autoenter"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Auto-enter PiP"
+ android:onClick="onAutoPipSelected"/>
+ </RadioGroup>
+
+ <RadioGroup
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:checkedButton="@id/ratio_default">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Ratio"/>
+
+ <RadioButton
+ android:id="@+id/ratio_default"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Default"
+ android:onClick="onRatioSelected"/>
+
+ <RadioButton
+ android:id="@+id/ratio_square"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Square [1:1]"
+ android:onClick="onRatioSelected"/>
+
+ <RadioButton
+ android:id="@+id/ratio_wide"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Wide [2:1]"
+ android:onClick="onRatioSelected"/>
+
+ <RadioButton
+ android:id="@+id/ratio_tall"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Tall [1:2]"
+ android:onClick="onRatioSelected"/>
+ </RadioGroup>
+
+ <CheckBox
+ android:id="@+id/set_source_rect_hint"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Set SourceRectHint"/>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Media Session"/>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <Button
+ android:id="@+id/media_session_start"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:nextFocusDown="@id/media_session_stop"
+ android:text="Start"/>
+
+ <Button
+ android:id="@+id/media_session_stop"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:nextFocusDown="@id/enter_pip"
+ android:text="Stop"/>
+
+ </LinearLayout>
+
+</LinearLayout>
diff --git a/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/BottomHalfPipActivity.java b/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/BottomHalfPipActivity.java
index 3d4865572486..3bbb94515f69 100644
--- a/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/BottomHalfPipActivity.java
+++ b/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/BottomHalfPipActivity.java
@@ -16,9 +16,14 @@
package com.android.server.wm.flicker.testapp;
+import static com.android.server.wm.flicker.testapp.ActivityOptions.BottomHalfPip.EXTRA_BOTTOM_HALF_LAYOUT;
+
import android.app.Activity;
+import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
+import android.view.Gravity;
+import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.WindowManager;
@@ -26,11 +31,13 @@ import androidx.annotation.NonNull;
public class BottomHalfPipActivity extends PipActivity {
+ private boolean mUseBottomHalfLayout;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_bottom_half_pip);
setTheme(R.style.TranslucentTheme);
- updateLayout();
}
@Override
@@ -41,14 +48,28 @@ public class BottomHalfPipActivity extends PipActivity {
}
/**
+ * Toggles the layout mode between fill task and half-bottom modes.
+ */
+ public void toggleBottomHalfLayout(View v) {
+ mUseBottomHalfLayout = !mUseBottomHalfLayout;
+ updateLayout();
+ }
+
+ /**
* Sets to match parent layout if the activity is
- * {@link Activity#isInPictureInPictureMode()}. Otherwise, set to bottom half
- * layout.
+ * {@link Activity#isInPictureInPictureMode()}. Otherwise,
+ * follows {@link #mUseBottomHalfLayout}.
*
* @see #setToBottomHalfMode(boolean)
*/
private void updateLayout() {
- setToBottomHalfMode(!isInPictureInPictureMode());
+ final boolean useBottomHalfLayout;
+ if (isInPictureInPictureMode()) {
+ useBottomHalfLayout = false;
+ } else {
+ useBottomHalfLayout = mUseBottomHalfLayout;
+ }
+ setToBottomHalfMode(useBottomHalfLayout);
}
/**
@@ -57,15 +78,31 @@ public class BottomHalfPipActivity extends PipActivity {
*/
private void setToBottomHalfMode(boolean useBottomHalfLayout) {
final WindowManager.LayoutParams attrs = getWindow().getAttributes();
+ attrs.gravity = Gravity.BOTTOM;
if (useBottomHalfLayout) {
final int taskHeight = getWindowManager().getCurrentWindowMetrics().getBounds()
.height();
- attrs.y = taskHeight / 2;
attrs.height = taskHeight / 2;
} else {
- attrs.y = 0;
attrs.height = LayoutParams.MATCH_PARENT;
}
getWindow().setAttributes(attrs);
}
+
+ @Override
+ void handleIntentExtra(@NonNull Intent intent) {
+ super.handleIntentExtra(intent);
+ if (intent.hasExtra(EXTRA_BOTTOM_HALF_LAYOUT)) {
+ final String booleanString = intent.getStringExtra(EXTRA_BOTTOM_HALF_LAYOUT);
+ // We don't use Boolean#parseBoolean here because the impl only checks if the string
+ // equals to "true", and returns for any other cases. We use our own impl here to
+ // prevent false positive.
+ if ("true".equals(booleanString)) {
+ mUseBottomHalfLayout = true;
+ } else if ("false".equals(booleanString)) {
+ mUseBottomHalfLayout = false;
+ }
+ }
+ updateLayout();
+ }
}
diff --git a/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/PipActivity.java b/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/PipActivity.java
index 13d7f7f0d521..ee25ab2fb66c 100644
--- a/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/PipActivity.java
+++ b/tests/FlickerTests/test-apps/flickerapp/src/com/android/server/wm/flicker/testapp/PipActivity.java
@@ -350,7 +350,7 @@ public class PipActivity extends Activity {
mMediaSession.setActive(newState != STATE_STOPPED);
}
- private void handleIntentExtra(Intent intent) {
+ void handleIntentExtra(Intent intent) {
// Set the fixed orientation if requested
if (intent.hasExtra(EXTRA_PIP_ORIENTATION)) {
final int ori = Integer.parseInt(getIntent().getStringExtra(EXTRA_PIP_ORIENTATION));
diff --git a/tests/Input/AndroidManifest.xml b/tests/Input/AndroidManifest.xml
index 914adc40194d..8d380f0d72a6 100644
--- a/tests/Input/AndroidManifest.xml
+++ b/tests/Input/AndroidManifest.xml
@@ -32,7 +32,7 @@
android:process=":externalProcess">
</activity>
- <activity android:name="com.android.test.input.CaptureEventActivity"
+ <activity android:name="com.android.cts.input.CaptureEventActivity"
android:label="Capture events"
android:configChanges="touchscreen|uiMode|orientation|screenSize|screenLayout|keyboardHidden|uiMode|navigation|keyboard|density|fontScale|layoutDirection|locale|mcc|mnc|smallestScreenSize"
android:enableOnBackInvokedCallback="false"
diff --git a/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt b/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt
index 4d7085feb98f..8c04f647fb2f 100644
--- a/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt
+++ b/tests/Input/src/com/android/server/input/KeyGestureControllerTests.kt
@@ -59,6 +59,7 @@ import junitparams.Parameters
import org.junit.After
import org.junit.Assert.assertArrayEquals
import org.junit.Assert.assertEquals
+import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Rule
@@ -830,6 +831,18 @@ class KeyGestureControllerTests {
KeyEvent.META_META_ON or KeyEvent.META_ALT_ON,
intArrayOf(KeyGestureEvent.ACTION_GESTURE_COMPLETE)
),
+ TestData(
+ "META + ALT + 'V' -> Toggle Voice Access",
+ intArrayOf(
+ KeyEvent.KEYCODE_META_LEFT,
+ KeyEvent.KEYCODE_ALT_LEFT,
+ KeyEvent.KEYCODE_V
+ ),
+ KeyGestureEvent.KEY_GESTURE_TYPE_TOGGLE_VOICE_ACCESS,
+ intArrayOf(KeyEvent.KEYCODE_V),
+ KeyEvent.META_META_ON or KeyEvent.META_ALT_ON,
+ intArrayOf(KeyGestureEvent.ACTION_GESTURE_COMPLETE)
+ ),
)
}
@@ -843,6 +856,7 @@ class KeyGestureControllerTests {
com.android.hardware.input.Flags.FLAG_KEYBOARD_A11Y_STICKY_KEYS_FLAG,
com.android.hardware.input.Flags.FLAG_KEYBOARD_A11Y_MOUSE_KEYS,
com.android.hardware.input.Flags.FLAG_ENABLE_TALKBACK_AND_MAGNIFIER_KEY_GESTURES,
+ com.android.hardware.input.Flags.FLAG_ENABLE_VOICE_ACCESS_KEY_GESTURES,
com.android.window.flags.Flags.FLAG_ENABLE_MOVE_TO_NEXT_DISPLAY_SHORTCUT,
com.android.window.flags.Flags.FLAG_ENABLE_TASK_RESIZING_KEYBOARD_SHORTCUTS
)
@@ -861,6 +875,7 @@ class KeyGestureControllerTests {
com.android.hardware.input.Flags.FLAG_KEYBOARD_A11Y_STICKY_KEYS_FLAG,
com.android.hardware.input.Flags.FLAG_KEYBOARD_A11Y_MOUSE_KEYS,
com.android.hardware.input.Flags.FLAG_ENABLE_TALKBACK_AND_MAGNIFIER_KEY_GESTURES,
+ com.android.hardware.input.Flags.FLAG_ENABLE_VOICE_ACCESS_KEY_GESTURES,
com.android.window.flags.Flags.FLAG_ENABLE_MOVE_TO_NEXT_DISPLAY_SHORTCUT,
com.android.window.flags.Flags.FLAG_ENABLE_TASK_RESIZING_KEYBOARD_SHORTCUTS
)
@@ -1452,20 +1467,32 @@ class KeyGestureControllerTests {
@Parameters(method = "customInputGesturesTestArguments")
fun testCustomKeyGestures(test: TestData) {
setupKeyGestureController()
+ val trigger = InputGestureData.createKeyTrigger(
+ test.expectedKeys[0],
+ test.expectedModifierState
+ )
val builder = InputGestureData.Builder()
.setKeyGestureType(test.expectedKeyGestureType)
- .setTrigger(
- InputGestureData.createKeyTrigger(
- test.expectedKeys[0],
- test.expectedModifierState
- )
- )
+ .setTrigger(trigger)
if (test.expectedAppLaunchData != null) {
builder.setAppLaunchData(test.expectedAppLaunchData)
}
val inputGestureData = builder.build()
- keyGestureController.addCustomInputGesture(0, inputGestureData.aidlData)
+ assertNull(
+ test.toString(),
+ keyGestureController.getInputGesture(0, trigger.aidlTrigger)
+ )
+ assertEquals(
+ test.toString(),
+ InputManager.CUSTOM_INPUT_GESTURE_RESULT_SUCCESS,
+ keyGestureController.addCustomInputGesture(0, builder.build().aidlData)
+ )
+ assertEquals(
+ test.toString(),
+ inputGestureData.aidlData,
+ keyGestureController.getInputGesture(0, trigger.aidlTrigger)
+ )
testKeyGestureInternal(test)
}
diff --git a/tests/Input/src/com/android/test/input/CaptureEventActivity.kt b/tests/Input/src/com/android/test/input/CaptureEventActivity.kt
deleted file mode 100644
index d54e3470d9c4..000000000000
--- a/tests/Input/src/com/android/test/input/CaptureEventActivity.kt
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2024 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.test.input
-
-import android.app.Activity
-import android.os.Bundle
-import android.view.InputEvent
-import android.view.KeyEvent
-import android.view.MotionEvent
-import java.util.concurrent.LinkedBlockingQueue
-import java.util.concurrent.TimeUnit
-import org.junit.Assert.assertNull
-
-class CaptureEventActivity : Activity() {
- private val events = LinkedBlockingQueue<InputEvent>()
- var shouldHandleKeyEvents = true
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
-
- // Set the fixed orientation if requested
- if (intent.hasExtra(EXTRA_FIXED_ORIENTATION)) {
- val orientation = intent.getIntExtra(EXTRA_FIXED_ORIENTATION, 0)
- setRequestedOrientation(orientation)
- }
-
- // Set the flag if requested
- if (intent.hasExtra(EXTRA_WINDOW_FLAGS)) {
- val flags = intent.getIntExtra(EXTRA_WINDOW_FLAGS, 0)
- window.addFlags(flags)
- }
- }
-
- override fun dispatchGenericMotionEvent(ev: MotionEvent?): Boolean {
- events.add(MotionEvent.obtain(ev))
- return true
- }
-
- override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
- events.add(MotionEvent.obtain(ev))
- return true
- }
-
- override fun dispatchKeyEvent(event: KeyEvent?): Boolean {
- events.add(KeyEvent(event))
- return shouldHandleKeyEvents
- }
-
- override fun dispatchTrackballEvent(ev: MotionEvent?): Boolean {
- events.add(MotionEvent.obtain(ev))
- return true
- }
-
- fun getInputEvent(): InputEvent? {
- return events.poll(5, TimeUnit.SECONDS)
- }
-
- fun hasReceivedEvents(): Boolean {
- return !events.isEmpty()
- }
-
- fun assertNoEvents() {
- val event = events.poll(100, TimeUnit.MILLISECONDS)
- assertNull("Expected no events, but received $event", event)
- }
-
- companion object {
- const val EXTRA_FIXED_ORIENTATION = "fixed_orientation"
- const val EXTRA_WINDOW_FLAGS = "window_flags"
- }
-}
diff --git a/tests/Input/src/com/android/test/input/UinputRecordingIntegrationTests.kt b/tests/Input/src/com/android/test/input/UinputRecordingIntegrationTests.kt
index 0b281d8d39e2..9e0f7347943d 100644
--- a/tests/Input/src/com/android/test/input/UinputRecordingIntegrationTests.kt
+++ b/tests/Input/src/com/android/test/input/UinputRecordingIntegrationTests.kt
@@ -28,6 +28,7 @@ import android.view.InputEvent
import android.view.MotionEvent
import androidx.test.platform.app.InstrumentationRegistry
import com.android.cts.input.BatchedEventSplitter
+import com.android.cts.input.CaptureEventActivity
import com.android.cts.input.InputJsonParser
import com.android.cts.input.VirtualDisplayActivityScenario
import com.android.cts.input.inputeventmatchers.isResampled
diff --git a/tests/InputScreenshotTest/robotests/Android.bp b/tests/InputScreenshotTest/robotests/Android.bp
index b2414a85c095..63a13849ee7f 100644
--- a/tests/InputScreenshotTest/robotests/Android.bp
+++ b/tests/InputScreenshotTest/robotests/Android.bp
@@ -66,7 +66,6 @@ android_robolectric_test {
"android.test.mock.stubs.system",
"truth",
],
- upstream: true,
java_resource_dirs: ["config"],
instrumentation_for: "InputRoboApp",
diff --git a/tests/Internal/Android.bp b/tests/Internal/Android.bp
index 9f35c7b7fa33..e294da101fb7 100644
--- a/tests/Internal/Android.bp
+++ b/tests/Internal/Android.bp
@@ -65,6 +65,7 @@ android_ravenwood_test {
"src/com/android/internal/util/ParcellingTests.java",
],
auto_gen_config: true,
+ team: "trendy_team_ravenwood",
}
java_test_helper_library {
diff --git a/tests/PlatformCompatGating/src/com/android/tests/gating/PlatformCompatPermissionsTest.java b/tests/PlatformCompatGating/src/com/android/tests/gating/PlatformCompatPermissionsTest.java
index 060133df0a40..e7e3d10c958b 100644
--- a/tests/PlatformCompatGating/src/com/android/tests/gating/PlatformCompatPermissionsTest.java
+++ b/tests/PlatformCompatGating/src/com/android/tests/gating/PlatformCompatPermissionsTest.java
@@ -81,7 +81,8 @@ public final class PlatformCompatPermissionsTest {
thrown.expect(SecurityException.class);
final String packageName = mContext.getPackageName();
- mPlatformCompat.reportChange(1, mPackageManager.getApplicationInfo(packageName, 0));
+ mPlatformCompat.reportChange(1,
+ mPackageManager.getApplicationInfo(packageName, Process.myUid()));
}
@Test
@@ -90,7 +91,8 @@ public final class PlatformCompatPermissionsTest {
mUiAutomation.adoptShellPermissionIdentity(LOG_COMPAT_CHANGE);
final String packageName = mContext.getPackageName();
- mPlatformCompat.reportChange(1, mPackageManager.getApplicationInfo(packageName, 0));
+ mPlatformCompat.reportChange(1,
+ mPackageManager.getApplicationInfo(packageName, Process.myUid()));
}
@Test
@@ -99,7 +101,7 @@ public final class PlatformCompatPermissionsTest {
thrown.expect(SecurityException.class);
final String packageName = mContext.getPackageName();
- mPlatformCompat.reportChangeByPackageName(1, packageName, 0);
+ mPlatformCompat.reportChangeByPackageName(1, packageName, Process.myUid());
}
@Test
@@ -108,7 +110,7 @@ public final class PlatformCompatPermissionsTest {
mUiAutomation.adoptShellPermissionIdentity(LOG_COMPAT_CHANGE);
final String packageName = mContext.getPackageName();
- mPlatformCompat.reportChangeByPackageName(1, packageName, 0);
+ mPlatformCompat.reportChangeByPackageName(1, packageName, Process.myUid());
}
@Test
@@ -133,7 +135,8 @@ public final class PlatformCompatPermissionsTest {
thrown.expect(SecurityException.class);
final String packageName = mContext.getPackageName();
- mPlatformCompat.isChangeEnabled(1, mPackageManager.getApplicationInfo(packageName, 0));
+ mPlatformCompat.isChangeEnabled(1,
+ mPackageManager.getApplicationInfo(packageName, Process.myUid()));
}
@Test
@@ -143,7 +146,8 @@ public final class PlatformCompatPermissionsTest {
mUiAutomation.adoptShellPermissionIdentity(READ_COMPAT_CHANGE_CONFIG);
final String packageName = mContext.getPackageName();
- mPlatformCompat.isChangeEnabled(1, mPackageManager.getApplicationInfo(packageName, 0));
+ mPlatformCompat.isChangeEnabled(1,
+ mPackageManager.getApplicationInfo(packageName, Process.myUid()));
}
@Test
@@ -152,7 +156,8 @@ public final class PlatformCompatPermissionsTest {
mUiAutomation.adoptShellPermissionIdentity(READ_COMPAT_CHANGE_CONFIG, LOG_COMPAT_CHANGE);
final String packageName = mContext.getPackageName();
- mPlatformCompat.isChangeEnabled(1, mPackageManager.getApplicationInfo(packageName, 0));
+ mPlatformCompat.isChangeEnabled(1,
+ mPackageManager.getApplicationInfo(packageName, Process.myUid()));
}
@Test
@@ -161,7 +166,7 @@ public final class PlatformCompatPermissionsTest {
thrown.expect(SecurityException.class);
final String packageName = mContext.getPackageName();
- mPlatformCompat.isChangeEnabledByPackageName(1, packageName, 0);
+ mPlatformCompat.isChangeEnabledByPackageName(1, packageName, Process.myUid());
}
@Test
@@ -171,7 +176,7 @@ public final class PlatformCompatPermissionsTest {
mUiAutomation.adoptShellPermissionIdentity(READ_COMPAT_CHANGE_CONFIG);
final String packageName = mContext.getPackageName();
- mPlatformCompat.isChangeEnabledByPackageName(1, packageName, 0);
+ mPlatformCompat.isChangeEnabledByPackageName(1, packageName, Process.myUid());
}
@Test
@@ -180,7 +185,7 @@ public final class PlatformCompatPermissionsTest {
mUiAutomation.adoptShellPermissionIdentity(READ_COMPAT_CHANGE_CONFIG, LOG_COMPAT_CHANGE);
final String packageName = mContext.getPackageName();
- mPlatformCompat.isChangeEnabledByPackageName(1, packageName, 0);
+ mPlatformCompat.isChangeEnabledByPackageName(1, packageName, Process.myUid());
}
@Test
diff --git a/tests/testables/tests/AndroidTest.xml b/tests/testables/tests/AndroidTest.xml
index 85f6e6257770..392bf67cb13b 100644
--- a/tests/testables/tests/AndroidTest.xml
+++ b/tests/testables/tests/AndroidTest.xml
@@ -45,6 +45,7 @@
<metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
<option name="directory-keys" value="/data/user/0/com.android.testables/files"/>
+ <option name="directory-keys" value="/data/user/10/com.android.testables/files"/>
<option name="collect-on-run-ended-only" value="true"/>
<option name="clean-up" value="true"/>
</metrics_collector>