Skip to content

Commit 49ee864

Browse files
brettchabotcopybara-androidxtest
authored andcommitted
Increment compile and target SDK for gradle tests to 36
PiperOrigin-RevId: 789777754
1 parent d24393a commit 49ee864

File tree

44 files changed

+36
-700
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+36
-700
lines changed

MODULE.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ maven.install(
5252
"androidx.concurrent:concurrent-futures-ktx:1.2.0",
5353
"androidx.core:core:1.6.0",
5454
"androidx.lifecycle:lifecycle-common:2.3.1",
55-
"androidx.multidex:multidex:2.0.0",
5655
"androidx.tracing:tracing:1.1.0",
5756
"androidx.window:window-java:1.1.0",
5857
"androidx.window:window-core:1.1.0",

build_extensions/android_library_test.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def axt_android_library_test(
1010
data = [],
1111
device_list = None,
1212
manifest = None,
13-
multidex = None,
1413
deps = [],
1514
**kwargs):
1615
"""Placeholder for future instrumentation test support.

build_extensions/mainDexClasses.rules

Lines changed: 0 additions & 20 deletions
This file was deleted.

core/javatests/androidx/test/core/app/BUILD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ licenses(["notice"])
1818
android_binary(
1919
name = "ActivityScenarioTest_target",
2020
manifest = "AndroidManifest_target.xml",
21-
multidex = "legacy",
2221
deps = [
2322
"//core/javatests/androidx/test/core/app/testing",
2423
"//core/javatests/androidx/test/core/app/testing:manifest",
25-
"@maven//:androidx_multidex_multidex",
2624
],
2725
)
2826

espresso/core/java/androidx/test/espresso/base/InputManagerEventInjectionStrategy.java

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ final class InputManagerEventInjectionStrategy implements EventInjectionStrategy
4949
new ReflectiveMethod<>(
5050
InputManager.class, "injectInputEvent", InputEvent.class, Integer.TYPE);
5151

52-
// only used on APIs < 23
53-
private final ReflectiveMethod<InputManager> getInstanceMethod =
54-
new ReflectiveMethod<>(InputManager.class, "getInstance");
55-
;
56-
5752
// hardcoded copies of private InputManager fields.
5853
// historically these were obtained via reflection, but that seems
5954
// wasteful as these values have not changed since they were introduced
@@ -72,7 +67,9 @@ final class InputManagerEventInjectionStrategy implements EventInjectionStrategy
7267
public boolean injectKeyEvent(KeyEvent keyEvent) throws InjectEventSecurityException {
7368
try {
7469
return injectInputEventMethod.invoke(
75-
getInputManager(), keyEvent, INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
70+
getContext().getSystemService(InputManager.class),
71+
keyEvent,
72+
INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
7673
} catch (ReflectionException e) {
7774
// annoyingly, ReflectiveMethod always rewraps the underlying exception
7875
Throwable cause = e.getCause().getCause();
@@ -104,7 +101,8 @@ private boolean innerInjectMotionEvent(MotionEvent motionEvent, boolean shouldRe
104101
}
105102
int eventMode =
106103
sync ? INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH : INJECT_INPUT_EVENT_MODE_ASYNC;
107-
return injectInputEventMethod.invoke(getInputManager(), motionEvent, eventMode);
104+
return injectInputEventMethod.invoke(
105+
getContext().getSystemService(InputManager.class), motionEvent, eventMode);
108106
} catch (ReflectionException e) {
109107
Throwable cause = e.getCause().getCause();
110108
if (cause instanceof SecurityException) {
@@ -140,14 +138,6 @@ private static boolean isFromTouchpadInGlassDevice(MotionEvent motionEvent) {
140138
&& ((motionEvent.getSource() & InputDevice.SOURCE_TOUCHPAD) != 0);
141139
}
142140

143-
private InputManager getInputManager() {
144-
if (Build.VERSION.SDK_INT < 23) {
145-
return getInstanceMethod.invokeStatic();
146-
} else {
147-
return getContext().getSystemService(InputManager.class);
148-
}
149-
}
150-
151141
private static Context getContext() {
152142
try {
153143
return InstrumentationRegistry.getInstrumentation().getTargetContext();

espresso/core/java/androidx/test/espresso/matcher/ViewMatchers.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import android.content.res.Resources;
2828
import android.graphics.Color;
2929
import android.graphics.Rect;
30-
import android.os.Build;
3130
import android.util.DisplayMetrics;
3231
import android.util.TypedValue;
3332
import android.view.View;
@@ -1709,13 +1708,7 @@ public static Matcher<View> hasTextColor(final int colorResId) {
17091708
protected boolean matchesSafely(TextView textView, Description mismatchDescription) {
17101709
context = textView.getContext();
17111710
int textViewColor = textView.getCurrentTextColor();
1712-
int expectedColor;
1713-
1714-
if (Build.VERSION.SDK_INT <= 22) {
1715-
expectedColor = context.getResources().getColor(colorResId);
1716-
} else {
1717-
expectedColor = context.getColor(colorResId);
1718-
}
1711+
int expectedColor = context.getColor(colorResId);
17191712

17201713
mismatchDescription
17211714
.appendText("textView.getCurrentTextColor() was ")
@@ -1729,10 +1722,7 @@ protected void describeMoreTo(Description description) {
17291722
if (context == null) {
17301723
description.appendText("ID ").appendValue(colorResId);
17311724
} else {
1732-
int color =
1733-
(Build.VERSION.SDK_INT <= 22)
1734-
? context.getResources().getColor(colorResId)
1735-
: context.getColor(colorResId);
1725+
int color = context.getColor(colorResId);
17361726
description.appendText("value " + getColorHex(color));
17371727
}
17381728
}

espresso/core/javatests/androidx/test/espresso/action/ClickActionIntegrationTest.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@
2222
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
2323
import static androidx.test.espresso.matcher.ViewMatchers.withId;
2424
import static androidx.test.espresso.matcher.ViewMatchers.withText;
25-
import static org.junit.Assert.assertTrue;
2625

2726
import android.view.InputDevice;
2827
import android.view.MotionEvent;
2928
import androidx.test.ext.junit.rules.ActivityScenarioRule;
3029
import androidx.test.ext.junit.runners.AndroidJUnit4;
3130
import androidx.test.filters.LargeTest;
32-
import androidx.test.filters.SdkSuppress;
3331
import androidx.test.ui.app.LargeViewActivity;
3432
import androidx.test.ui.app.R;
3533
import org.junit.Rule;
@@ -60,17 +58,4 @@ public void rightClickTest() {
6058
onView(withText(R.string.context_item_2_text)).check(matches(isDisplayed()));
6159
onView(withText(R.string.context_item_3_text)).check(matches(isDisplayed()));
6260
}
63-
64-
@Test
65-
@SdkSuppress(maxSdkVersion = 13)
66-
public void rightClickTest_unsupportedApiLevel() {
67-
boolean exceptionThrown = false;
68-
try {
69-
onView(withId(R.id.large_view)).perform(click(0, 0));
70-
} catch (UnsupportedOperationException e) {
71-
exceptionThrown = true;
72-
} finally {
73-
assertTrue(exceptionThrown);
74-
}
75-
}
7661
}

espresso/core/javatests/androidx/test/espresso/matcher/ViewMatchers1Test.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
import android.graphics.Color;
5858
import android.graphics.Point;
5959
import android.graphics.Rect;
60-
import android.os.Build;
6160
import android.text.SpannedString;
6261
import android.text.method.TransformationMethod;
6362
import android.view.View;
@@ -576,13 +575,7 @@ public void hasTextColorTest() {
576575
TextView textView = new TextView(context);
577576
textView.setText("text");
578577

579-
int color;
580-
if (Build.VERSION.SDK_INT <= 22) {
581-
color = context.getResources().getColor(R.color.green);
582-
} else {
583-
color = context.getColor(R.color.green);
584-
}
585-
578+
int color = context.getColor(R.color.green);
586579
textView.setTextColor(color);
587580

588581
assertTrue(hasTextColor(R.color.green).matches(textView));

gradle-tests/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
1111

1212
ext {
1313
minSdk = 23
14-
targetSdk = 34
15-
compileSdk = 34
14+
targetSdk = 36
15+
compileSdk = 36
1616
emulatorApi = 33
1717
}

gradle-tests/espresso/accessibility/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ android {
1616
defaultConfig {
1717
minSdk rootProject.ext.minSdk
1818
targetSdk rootProject.ext.targetSdk
19-
multiDexEnabled = true
2019
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2120
}
2221

@@ -44,7 +43,6 @@ android {
4443
}
4544

4645
dependencies {
47-
androidTestImplementation "androidx.multidex:multidex:2.0.0"
4846
androidTestImplementation libs.ext.junit
4947
androidTestImplementation libs.espresso.accessibility
5048
androidTestImplementation libs.espresso.core

0 commit comments

Comments
 (0)