Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bump targetSdkVersion to 33 #583

Merged
merged 6 commits into from
Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ apply plugin: 'com.android.application'
apply plugin: 'de.mobilej.unmock'

android {
compileSdk 32
compileSdk 33
defaultConfig {
applicationId 'io.appium.uiautomator2'
minSdkVersion 21
targetSdkVersion 32
targetSdkVersion 33
versionCode 147
archivesBaseName = 'appium-uiautomator2'
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.appium.uiautomator2.utils;

import android.accessibilityservice.AccessibilityService;
import android.os.Build;
import android.os.SystemClock;
import android.view.accessibility.AccessibilityNodeInfo;
Expand All @@ -28,6 +29,9 @@
import java.util.Objects;

import static androidx.test.internal.util.Checks.checkNotNull;

import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;

import io.appium.uiautomator2.common.exceptions.UiAutomator2Exception;
import io.appium.uiautomator2.core.UiAutomatorBridge;
import io.appium.uiautomator2.model.internal.CustomUiDevice;
Expand All @@ -47,8 +51,13 @@ public class AXWindowHelpers {
*/
private static void clearAccessibilityCache() {
try {
// This call invokes `AccessibilityInteractionClient.getInstance().clearCache();` method
UiAutomatorBridge.getInstance().getUiAutomation().setServiceInfo(null);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
AccessibilityService accessibilityService = getInstrumentation().getContext().getSystemService(AccessibilityService.class);
accessibilityService.clearCache();
} else {
// This call invokes `AccessibilityInteractionClient.getInstance().clearCache();` method
UiAutomatorBridge.getInstance().getUiAutomation().setServiceInfo(null);
}
} catch (NullPointerException npe) {
// it is fine
// ignore
Expand Down
Loading