From a588c85d8dde503762e06e469d9dbdd2da5a4772 Mon Sep 17 00:00:00 2001 From: Mohellebi abdessalem <116356835+AbdeMohlbi@users.noreply.github.com> Date: Mon, 15 Dec 2025 15:44:07 +0100 Subject: [PATCH] Bump minSdk to `24` in `engine` (#175508) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Relands #175278 this PR bumps used minSdk version in the `engine` to `24` . ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] All existing and new tests are passing. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Signed-off-by: dependabot[bot] Signed-off-by: StepSecurity Bot Signed-off-by: jwlilly Signed-off-by: huycozy Co-authored-by: engine-flutter-autoroll Co-authored-by: Matthew Kosarek Co-authored-by: Abdelaziz Mahdy Co-authored-by: Victoria Ashworth <15619084+vashworth@users.noreply.github.com> Co-authored-by: Kate Lovett Co-authored-by: Reid Baker <1063596+reidbaker@users.noreply.github.com> Co-authored-by: Ben Konyi Co-authored-by: Flop <38378650+hgraceb@users.noreply.github.com> Co-authored-by: Victor Sanni Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Co-authored-by: Slava Egorov Co-authored-by: Flutter GitHub Bot Co-authored-by: Elijah Okoroh Co-authored-by: Bruno Leroux Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com> Co-authored-by: zhongliugo Co-authored-by: auto-submit[bot] <98614782+auto-submit[bot]@users.noreply.github.com> Co-authored-by: auto-submit[bot] Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com> Co-authored-by: Felipe Peter Co-authored-by: Daco Harkes Co-authored-by: Ahmed Mohamed Sameh Co-authored-by: Simon Binder Co-authored-by: ANUJ KUMAR <77888283+shivanuj13@users.noreply.github.com> Co-authored-by: anuj.kumar Co-authored-by: Michael Goderbauer Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: Pierre <6655696+guidezpl@users.noreply.github.com> Co-authored-by: StepSecurity Bot Co-authored-by: Pierre-Louis Co-authored-by: Zachary Anderson Co-authored-by: bungeman Co-authored-by: jesswrd Co-authored-by: John Lilly <31510811+jwlilly@users.noreply.github.com> Co-authored-by: Camille Simon <43054281+camsim99@users.noreply.github.com> Co-authored-by: b-luk <97480502+b-luk@users.noreply.github.com> Co-authored-by: flutter-pub-roller-bot <137456488+flutter-pub-roller-bot@users.noreply.github.com> Co-authored-by: Michel Feinstein Co-authored-by: Matej Knopp Co-authored-by: Tess Strickland Co-authored-by: Huy Co-authored-by: Kostia Sokolovskyi Co-authored-by: LouiseHsu Co-authored-by: Mouad Debbar Co-authored-by: Tim Maffett Co-authored-by: Aaron Clarke Co-authored-by: Renzo Olivares Co-authored-by: Renzo Olivares Co-authored-by: Nebojša Cvetković Co-authored-by: Tirth Co-authored-by: Ivan Inozemtsev Co-authored-by: Jason Simmons Co-authored-by: Nicholas Shahan Co-authored-by: Jon Ihlas Co-authored-by: Robert Ancell Co-authored-by: Harry Terkelsen <1961493+harryterkelsen@users.noreply.github.com> Co-authored-by: Jackson Gardner Co-authored-by: Jim Graham Co-authored-by: DoLT Co-authored-by: Kevin Moore Co-authored-by: John "codefu" McDole Co-authored-by: Dev TtangKong Co-authored-by: Tong Mu Co-authored-by: Matt Boetger Co-authored-by: Kaylee Lubick Co-authored-by: Ramon Farizel <45459898+RamonFarizel@users.noreply.github.com> Co-authored-by: chunhtai <47866232+chunhtai@users.noreply.github.com> Co-authored-by: Lau Ching Jun Co-authored-by: Rusino Co-authored-by: Reid Baker --- engine/src/build/config/android/config.gni | 2 +- engine/src/build/toolchain/android/BUILD.gn | 2 +- .../platform/android/AndroidManifest.xml | 2 +- .../flutter/shell/platform/android/BUILD.gn | 1 - .../embedding/android/FlutterView.java | 2 +- .../plugin/editing/TextInputPlugin.java | 2 +- .../localization/LocalizationPlugin.java | 35 ++++-------------- .../plugin/platform/PlatformPlugin.java | 36 +++++++++---------- .../platform/PlatformViewsController.java | 3 +- ...urfaceTexturePlatformViewRenderTarget.java | 5 --- .../plugin/text/ProcessTextPlugin.java | 9 ----- .../android/io/flutter/util/PathUtils.java | 9 +---- .../android/io/flutter/util/Predicate.java | 11 ------ .../io/flutter/view/AccessibilityBridge.java | 15 ++++---- .../view/AccessibilityViewEmbedder.java | 12 ++----- 15 files changed, 38 insertions(+), 108 deletions(-) delete mode 100644 engine/src/flutter/shell/platform/android/io/flutter/util/Predicate.java diff --git a/engine/src/build/config/android/config.gni b/engine/src/build/config/android/config.gni index 0cf362de747..faf04fe2c9c 100644 --- a/engine/src/build/config/android/config.gni +++ b/engine/src/build/config/android/config.gni @@ -19,7 +19,7 @@ if (is_android) { # Unused. Required for GN files maintained in other buildroots. enable_java_templates = false - android_api_level = 22 + android_api_level = 24 } # Host stuff ----------------------------------------------------------------- diff --git a/engine/src/build/toolchain/android/BUILD.gn b/engine/src/build/toolchain/android/BUILD.gn index 4bd89c1046a..1fd53092ddb 100644 --- a/engine/src/build/toolchain/android/BUILD.gn +++ b/engine/src/build/toolchain/android/BUILD.gn @@ -146,7 +146,7 @@ android_toolchains_helper("arm64") { # This toolchain should only be used to build the target # //third_party/vulkan_validation_layers. This is because vulkan validation # layers requires API level >= 26, but Flutter officially supports down to API -# level 22, which is the default value of the android_api_level argument. +# level 24, which is the default value of the android_api_level argument. android_toolchains_helper("arm64_apilevel26") { toolchain_cpu = "arm64" extra_toolchain_args = { diff --git a/engine/src/flutter/shell/platform/android/AndroidManifest.xml b/engine/src/flutter/shell/platform/android/AndroidManifest.xml index f9a98fc368b..b2e2c9e0dfb 100644 --- a/engine/src/flutter/shell/platform/android/AndroidManifest.xml +++ b/engine/src/flutter/shell/platform/android/AndroidManifest.xml @@ -5,7 +5,7 @@ --> - + diff --git a/engine/src/flutter/shell/platform/android/BUILD.gn b/engine/src/flutter/shell/platform/android/BUILD.gn index f6f495271e7..0fac68b10f3 100644 --- a/engine/src/flutter/shell/platform/android/BUILD.gn +++ b/engine/src/flutter/shell/platform/android/BUILD.gn @@ -371,7 +371,6 @@ android_java_sources = [ "io/flutter/util/HandlerCompat.java", "io/flutter/util/PathUtils.java", "io/flutter/util/Preconditions.java", - "io/flutter/util/Predicate.java", "io/flutter/util/TraceSection.java", "io/flutter/util/ViewUtils.java", "io/flutter/view/AccessibilityBridge.java", diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java index 5feac48ce0c..ccedb57b047 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java @@ -619,7 +619,7 @@ public class FlutterView extends FrameLayout return ZeroSides.RIGHT; } else if (rotation == Surface.ROTATION_270) { // In android API >= 23, the nav bar always appears on the "bottom" (USB) side. - return Build.VERSION.SDK_INT >= API_LEVELS.API_23 ? ZeroSides.LEFT : ZeroSides.RIGHT; + return ZeroSides.LEFT; } // Ambiguous orientation due to landscape left/right default. Zero both sides. else if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java index 4f1b5ee27c5..67cda46e3b2 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java @@ -364,7 +364,7 @@ public class TextInputPlugin implements ListenableEditingState.EditingStateWatch } outAttrs.imeOptions |= enterAction; - if (Build.VERSION.SDK_INT >= API_LEVELS.API_24 && configuration.hintLocales != null) { + if (configuration.hintLocales != null) { outAttrs.hintLocales = new LocaleList(configuration.hintLocales); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/localization/LocalizationPlugin.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/localization/LocalizationPlugin.java index 1ef443f524c..090faabfd8b 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/localization/LocalizationPlugin.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/localization/LocalizationPlugin.java @@ -106,7 +106,7 @@ public class LocalizationPlugin { return platformResolvedLocale; } return supportedLocales.get(0); - } else if (Build.VERSION.SDK_INT >= API_LEVELS.API_24) { + } else { // Modern locale resolution without languageRange // https://developer.android.com/guide/topics/resources/multilingual-support#postN LocaleList localeList = context.getResources().getConfiguration().getLocales(); @@ -133,25 +133,6 @@ public class LocalizationPlugin { } return supportedLocales.get(0); } - - // Legacy locale resolution - // https://developer.android.com/guide/topics/resources/multilingual-support#preN - Locale preferredLocale = context.getResources().getConfiguration().locale; - if (preferredLocale != null) { - // Look for exact match. - for (Locale locale : supportedLocales) { - if (preferredLocale.equals(locale)) { - return locale; - } - } - // Look for exact language only match. - for (Locale locale : supportedLocales) { - if (preferredLocale.getLanguage().equals(locale.toString())) { - return locale; - } - } - } - return supportedLocales.get(0); } /** @@ -162,15 +143,11 @@ public class LocalizationPlugin { @SuppressWarnings("deprecation") public void sendLocalesToFlutter(@NonNull Configuration config) { List locales = new ArrayList<>(); - if (Build.VERSION.SDK_INT >= API_LEVELS.API_24) { - LocaleList localeList = config.getLocales(); - int localeCount = localeList.size(); - for (int index = 0; index < localeCount; ++index) { - Locale locale = localeList.get(index); - locales.add(locale); - } - } else { - locales.add(config.locale); + LocaleList localeList = config.getLocales(); + int localeCount = localeList.size(); + for (int index = 0; index < localeCount; ++index) { + Locale locale = localeList.get(index); + locales.add(locale); } localizationChannel.sendLocales(locales); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java index 3c3ceea6f7b..cdd0ad35d14 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java @@ -202,9 +202,7 @@ public class PlatformPlugin { view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP); break; case HEAVY_IMPACT: - if (Build.VERSION.SDK_INT >= API_LEVELS.API_23) { - view.performHapticFeedback(HapticFeedbackConstants.CONTEXT_CLICK); - } + view.performHapticFeedback(HapticFeedbackConstants.CONTEXT_CLICK); break; case SELECTION_CLICK: view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK); @@ -463,25 +461,23 @@ public class PlatformPlugin { // If transparent, SDK 29 and higher may apply a translucent scrim behind the bar to ensure // proper contrast. This can be overridden with // SystemChromeStyle.systemStatusBarContrastEnforced. - if (Build.VERSION.SDK_INT >= API_LEVELS.API_23) { - if (systemChromeStyle.statusBarIconBrightness != null) { - switch (systemChromeStyle.statusBarIconBrightness) { - case DARK: - // Dark status bar icon brightness. - // Light status bar appearance. - windowInsetsControllerCompat.setAppearanceLightStatusBars(true); - break; - case LIGHT: - // Light status bar icon brightness. - // Dark status bar appearance. - windowInsetsControllerCompat.setAppearanceLightStatusBars(false); - break; - } + if (systemChromeStyle.statusBarIconBrightness != null) { + switch (systemChromeStyle.statusBarIconBrightness) { + case DARK: + // Dark status bar icon brightness. + // Light status bar appearance. + windowInsetsControllerCompat.setAppearanceLightStatusBars(true); + break; + case LIGHT: + // Light status bar icon brightness. + // Dark status bar appearance. + windowInsetsControllerCompat.setAppearanceLightStatusBars(false); + break; } + } - if (systemChromeStyle.statusBarColor != null) { - window.setStatusBarColor(systemChromeStyle.statusBarColor); - } + if (systemChromeStyle.statusBarColor != null) { + window.setStatusBarColor(systemChromeStyle.statusBarColor); } // You can't override the enforced contrast for a transparent status bar until SDK 29. // This overrides the translucent scrim that may be placed behind the bar on SDK 29+ to ensure diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java index 22bacd050c1..b45ca244961 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java @@ -229,8 +229,7 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega // view hierarchy via callbacks such as ViewParent#onDescendantInvalidated(). // - The API level is <23, due to TLHC implementation API requirements. final boolean supportsTextureLayerMode = - Build.VERSION.SDK_INT >= API_LEVELS.API_23 - && !ViewUtils.hasChildViewOfType(embeddedView, VIEW_TYPES_REQUIRE_NON_TLHC); + !ViewUtils.hasChildViewOfType(embeddedView, VIEW_TYPES_REQUIRE_NON_TLHC); // Fall back to Hybrid Composition or Virtual Display when necessary, depending on which // fallback mode is requested. diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SurfaceTexturePlatformViewRenderTarget.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SurfaceTexturePlatformViewRenderTarget.java index 51b9f467e68..d87f58b80a8 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SurfaceTexturePlatformViewRenderTarget.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SurfaceTexturePlatformViewRenderTarget.java @@ -61,11 +61,6 @@ public class SurfaceTexturePlatformViewRenderTarget implements PlatformViewRende /** Implementation of PlatformViewRenderTarget */ public SurfaceTexturePlatformViewRenderTarget(SurfaceTextureEntry surfaceTextureEntry) { - if (Build.VERSION.SDK_INT < API_LEVELS.API_23) { - throw new UnsupportedOperationException( - "Platform views cannot be displayed below API level 23" - + "You can prevent this issue by setting `minSdkVersion: 23` in build.gradle."); - } this.surfaceTextureEntry = surfaceTextureEntry; this.surfaceTexture = surfaceTextureEntry.surfaceTexture(); surfaceTextureEntry.setOnTrimMemoryListener(trimMemoryListener); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/text/ProcessTextPlugin.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/text/ProcessTextPlugin.java index 6383bdd4a96..d9213988fd2 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/text/ProcessTextPlugin.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/text/ProcessTextPlugin.java @@ -71,11 +71,6 @@ public class ProcessTextPlugin return; } - if (Build.VERSION.SDK_INT < API_LEVELS.API_23) { - result.error("error", "Android version not supported", null); - return; - } - if (resolveInfosById == null) { result.error("error", "Can not process text actions before calling queryTextActions", null); return; @@ -106,10 +101,6 @@ public class ProcessTextPlugin private void cacheResolveInfos() { resolveInfosById = new HashMap(); - if (Build.VERSION.SDK_INT < API_LEVELS.API_23) { - return; - } - Intent intent = new Intent().setAction(Intent.ACTION_PROCESS_TEXT).setType("text/plain"); List infos; diff --git a/engine/src/flutter/shell/platform/android/io/flutter/util/PathUtils.java b/engine/src/flutter/shell/platform/android/io/flutter/util/PathUtils.java index 15b6d1e7528..1222261c7a9 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/util/PathUtils.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/util/PathUtils.java @@ -4,10 +4,7 @@ package io.flutter.util; -import static io.flutter.Build.API_LEVELS; - import android.content.Context; -import android.os.Build; import androidx.annotation.NonNull; import java.io.File; @@ -50,10 +47,6 @@ public final class PathUtils { } private static String getDataDirPath(Context applicationContext) { - if (Build.VERSION.SDK_INT >= API_LEVELS.API_24) { - return applicationContext.getDataDir().getPath(); - } else { - return applicationContext.getApplicationInfo().dataDir; - } + return applicationContext.getDataDir().getPath(); } } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/util/Predicate.java b/engine/src/flutter/shell/platform/android/io/flutter/util/Predicate.java deleted file mode 100644 index 074fbd6b3ec..00000000000 --- a/engine/src/flutter/shell/platform/android/io/flutter/util/Predicate.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package io.flutter.util; - -// TODO(dnfield): remove this if/when we can use appcompat to support it. -// java.util.function.Predicate isn't available until API24 -public interface Predicate { - public abstract boolean test(T t); -} diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java b/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java index f05ce4c96c2..45c8e1dc79f 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java @@ -34,7 +34,6 @@ import io.flutter.BuildConfig; import io.flutter.Log; import io.flutter.embedding.engine.systemchannels.AccessibilityChannel; import io.flutter.plugin.platform.PlatformViewsAccessibilityDelegate; -import io.flutter.util.Predicate; import io.flutter.util.ViewUtils; import io.flutter.view.AccessibilityStringBuilder.LocaleStringAttribute; import io.flutter.view.AccessibilityStringBuilder.SpellOutStringAttribute; @@ -45,6 +44,7 @@ import java.nio.ByteOrder; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.*; +import java.util.function.Predicate; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -271,7 +271,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { // not get left behind. @NonNull private final List flutterNavigationStack = new ArrayList<>(); - // TODO(mattcarroll): why do we need previouseRouteId if we have flutterNavigationStack + // TODO(mattcarroll): why do we need previousRouteId if we have flutterNavigationStack private int previousRouteId = ROOT_NODE_ID; // Tracks the left system inset of the screen because Flutter needs to manually adjust @@ -516,7 +516,8 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { this.contentResolver.registerContentObserver(transitionUri, false, animationScaleObserver); // Tells Flutter whether the text should be bolded or not. If the user changes bold text - // setting, the configuration will change and trigger a re-build of the accessibilityBridge. + // setting, the configuration will change and trigger a re-build of the + // accessibilityBridge. if (Build.VERSION.SDK_INT >= API_LEVELS.API_31) { setBoldTextFlag(); } @@ -719,9 +720,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { if (flutterSemanticsTree.containsKey(ROOT_NODE_ID)) { result.addChild(rootAccessibilityView, ROOT_NODE_ID); } - if (Build.VERSION.SDK_INT >= API_LEVELS.API_24) { - result.setImportantForAccessibility(false); - } + result.setImportantForAccessibility(false); return result; } @@ -755,9 +754,7 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { // Accessibility Scanner uses isImportantForAccessibility to decide whether to check // or skip this node. - if (Build.VERSION.SDK_INT >= API_LEVELS.API_24) { - result.setImportantForAccessibility(isImportant(semanticsNode)); - } + result.setImportantForAccessibility(isImportant(semanticsNode)); // Work around for https://github.com/flutter/flutter/issues/21030 result.setViewIdResourceName(""); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java b/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java index 7260d4a8681..6c0286caf9d 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java @@ -244,15 +244,9 @@ class AccessibilityViewEmbedder { output.setRangeInfo(input.getRangeInfo()); output.setError(input.getError()); output.setMaxTextLength(input.getMaxTextLength()); - if (Build.VERSION.SDK_INT >= API_LEVELS.API_23) { - output.setContextClickable(input.isContextClickable()); - // TODO(amirh): copy traversal before and after. - // https://github.com/flutter/flutter/issues/29718 - } - if (Build.VERSION.SDK_INT >= API_LEVELS.API_24) { - output.setDrawingOrder(input.getDrawingOrder()); - output.setImportantForAccessibility(input.isImportantForAccessibility()); - } + output.setContextClickable(input.isContextClickable()); + output.setDrawingOrder(input.getDrawingOrder()); + output.setImportantForAccessibility(input.isImportantForAccessibility()); if (Build.VERSION.SDK_INT >= API_LEVELS.API_26) { output.setAvailableExtraData(input.getAvailableExtraData()); output.setHintText(input.getHintText());