Bump minSdk to 24 in engine (#175508)

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.

<!-- Links -->
[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] <support@github.com>
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
Signed-off-by: jwlilly <lilly.john.w@gmail.com>
Signed-off-by: huycozy <huy@nevercode.io>
Co-authored-by: engine-flutter-autoroll <engine-flutter-autoroll@skia.org>
Co-authored-by: Matthew Kosarek <matt.kosarek@canonical.com>
Co-authored-by: Abdelaziz Mahdy <zezohassam@gmail.com>
Co-authored-by: Victoria Ashworth <15619084+vashworth@users.noreply.github.com>
Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: Reid Baker <1063596+reidbaker@users.noreply.github.com>
Co-authored-by: Ben Konyi <bkonyi@google.com>
Co-authored-by: Flop <38378650+hgraceb@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
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 <vegorov@google.com>
Co-authored-by: Flutter GitHub Bot <fluttergithubbot@gmail.com>
Co-authored-by: Elijah Okoroh <okorohelijah@google.com>
Co-authored-by: Bruno Leroux <bruno.leroux@gmail.com>
Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
Co-authored-by: zhongliugo <zhongliu88889@gmail.com>
Co-authored-by: auto-submit[bot] <98614782+auto-submit[bot]@users.noreply.github.com>
Co-authored-by: auto-submit[bot] <flutter-engprod-team@google.com>
Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
Co-authored-by: Felipe Peter <mr-peipei@web.de>
Co-authored-by: Daco Harkes <dacoharkes@google.com>
Co-authored-by: Ahmed Mohamed Sameh <ahmedsameha1@gmail.com>
Co-authored-by: Simon Binder <simon@journeyapps.com>
Co-authored-by: ANUJ KUMAR <77888283+shivanuj13@users.noreply.github.com>
Co-authored-by: anuj.kumar <anuj.kumar@powerup.money>
Co-authored-by: Michael Goderbauer <goderbauer@google.com>
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 <bot@stepsecurity.io>
Co-authored-by: Pierre-Louis <plg@google.com>
Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
Co-authored-by: bungeman <bungeman@chromium.org>
Co-authored-by: jesswrd <jesswon@google.com>
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 <feinstein@users.noreply.github.com>
Co-authored-by: Matej Knopp <matej.knopp@gmail.com>
Co-authored-by: Tess Strickland <sstrickl@google.com>
Co-authored-by: Huy <huy@nevercode.io>
Co-authored-by: Kostia Sokolovskyi <sokolovskyi.konstantin@gmail.com>
Co-authored-by: LouiseHsu <louisehsu@google.com>
Co-authored-by: Mouad Debbar <mdebbar@google.com>
Co-authored-by: Tim Maffett <timmaffett@gmail.com>
Co-authored-by: Aaron Clarke <aaclarke@google.com>
Co-authored-by: Renzo Olivares <rmolivares@renzo-olivares.dev>
Co-authored-by: Renzo Olivares <roliv@google.com>
Co-authored-by: Nebojša Cvetković <nebkat@gmail.com>
Co-authored-by: Tirth <pateltirth454@gmail.com>
Co-authored-by: Ivan Inozemtsev <iinozemtsev@google.com>
Co-authored-by: Jason Simmons <jason-simmons@users.noreply.github.com>
Co-authored-by: Nicholas Shahan <nshahan@google.com>
Co-authored-by: Jon Ihlas <jon.i@hotmail.fr>
Co-authored-by: Robert Ancell <robert.ancell@canonical.com>
Co-authored-by: Harry Terkelsen <1961493+harryterkelsen@users.noreply.github.com>
Co-authored-by: Jackson Gardner <jacksongardner@google.com>
Co-authored-by: Jim Graham <flar@google.com>
Co-authored-by: DoLT <dolt@guide.inc>
Co-authored-by: Kevin Moore <kevmoo@users.noreply.github.com>
Co-authored-by: John "codefu" McDole <codefu@google.com>
Co-authored-by: Dev TtangKong <ttankkeo112@gmail.com>
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Matt Boetger <matt.boetger@gmail.com>
Co-authored-by: Kaylee Lubick <kjlubick@users.noreply.github.com>
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 <chingjun@google.com>
Co-authored-by: Rusino <Rusino@users.noreply.github.com>
Co-authored-by: Reid Baker <reidbaker@google.com>
This commit is contained in:
Mohellebi abdessalem 2025-12-15 15:44:07 +01:00 committed by GitHub
parent acad4ee328
commit a588c85d8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 38 additions and 108 deletions

View File

@ -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 -----------------------------------------------------------------

View File

@ -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 = {

View File

@ -5,7 +5,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.flutter.embedding" android:versionCode="1" android:versionName="0.0.1">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="36" />
<uses-sdk android:minSdkVersion="24" android:targetSdkVersion="36" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true" />

View File

@ -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",

View File

@ -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) {

View File

@ -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);
}

View File

@ -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<Locale> 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);

View File

@ -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

View File

@ -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.

View File

@ -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);

View File

@ -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<String, ResolveInfo>();
if (Build.VERSION.SDK_INT < API_LEVELS.API_23) {
return;
}
Intent intent = new Intent().setAction(Intent.ACTION_PROCESS_TEXT).setType("text/plain");
List<ResolveInfo> infos;

View File

@ -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();
}
}

View File

@ -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<T> {
public abstract boolean test(T t);
}

View File

@ -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<Integer> 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("");

View File

@ -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());