diff --git a/DEPS b/DEPS index c349410b8d4..b7f0244d6b4 100644 --- a/DEPS +++ b/DEPS @@ -574,7 +574,7 @@ deps = { { # See tools/gradle/README.md for update instructions. # Version here means the CIPD tag. - 'version': 'version:8.9', + 'version': 'version:8.11.1', 'package': 'flutter/gradle' } ], @@ -614,7 +614,7 @@ deps = { 'packages': [ { 'package': 'flutter/android/sdk/all/${{platform}}', - 'version': 'version:35v1' + 'version': 'version:36v1' } ], 'condition': 'download_android_deps', diff --git a/engine/src/build/config/android/config.gni b/engine/src/build/config/android/config.gni index f02a3556eec..7051d9c398d 100644 --- a/engine/src/build/config/android/config.gni +++ b/engine/src/build/config/android/config.gni @@ -7,8 +7,8 @@ if (is_android) { if (!defined(default_android_sdk_root)) { default_android_sdk_root = "//flutter/third_party/android_tools/sdk" - default_android_sdk_version = "35" - default_android_sdk_build_tools_version = "35.0.0-rc4" + default_android_sdk_version = "36" + default_android_sdk_build_tools_version = "36.0.0" } declare_args() { diff --git a/engine/src/build/config/compiler/BUILD.gn b/engine/src/build/config/compiler/BUILD.gn index b657abe4145..243f6a37a48 100644 --- a/engine/src/build/config/compiler/BUILD.gn +++ b/engine/src/build/config/compiler/BUILD.gn @@ -583,7 +583,7 @@ config("runtime_library") { "m", ] - lib_dirs += [ "${android_toolchain_root}/lib/clang/17/lib/linux/" ] + lib_dirs += [ "${android_toolchain_root}/lib/clang/18/lib/linux/" ] current_android_cpu = current_cpu if (current_cpu == "arm64") { current_android_cpu = "aarch64" diff --git a/engine/src/flutter/shell/platform/android/AndroidManifest.xml b/engine/src/flutter/shell/platform/android/AndroidManifest.xml index 1f8e2363186..f9a98fc368b 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.gradle b/engine/src/flutter/shell/platform/android/build.gradle index 11dd5f89c44..6959c340fbc 100644 --- a/engine/src/flutter/shell/platform/android/build.gradle +++ b/engine/src/flutter/shell/platform/android/build.gradle @@ -8,7 +8,7 @@ buildscript { mavenCentral() } dependencies { - classpath "com.android.tools.build:gradle:8.7.2" + classpath "com.android.tools.build:gradle:8.9.1" } } @@ -21,7 +21,7 @@ apply plugin: "com.android.library" android { namespace "io.flutter.embedding" - compileSdk 35 + compileSdk 36 defaultConfig { minSdkVersion 21 diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java index 3ef78621fce..29990331267 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/AndroidTouchProcessor.java @@ -2,7 +2,6 @@ package io.flutter.embedding.android; import static io.flutter.Build.API_LEVELS; -import android.annotation.TargetApi; import android.content.Context; import android.graphics.Matrix; import android.os.Build; @@ -12,6 +11,7 @@ import android.view.MotionEvent; import android.view.ViewConfiguration; import androidx.annotation.IntDef; import androidx.annotation.NonNull; +import androidx.annotation.RequiresApi; import androidx.annotation.VisibleForTesting; import io.flutter.embedding.engine.renderer.FlutterRenderer; import java.nio.ByteBuffer; @@ -465,7 +465,7 @@ public class AndroidTouchProcessor { } } - @TargetApi(API_LEVELS.API_26) + @RequiresApi(API_LEVELS.API_26) private float getVerticalScrollFactorAbove26(@NonNull Context context) { return ViewConfiguration.get(context).getScaledVerticalScrollFactor(); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java index 2794f4bafce..bd6e23473ca 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java @@ -22,7 +22,6 @@ import static io.flutter.embedding.android.FlutterActivityLaunchConfigs.INITIAL_ import static io.flutter.embedding.android.FlutterActivityLaunchConfigs.NORMAL_THEME_META_DATA_KEY; import static io.flutter.embedding.android.FlutterActivityLaunchConfigs.deepLinkEnabled; -import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.content.Intent; @@ -698,7 +697,6 @@ public class FlutterActivity extends Activity } @NonNull - @TargetApi(API_LEVELS.API_33) @RequiresApi(API_LEVELS.API_33) private OnBackInvokedCallback createOnBackInvokedCallback() { if (Build.VERSION.SDK_INT >= API_LEVELS.API_34) { @@ -942,7 +940,6 @@ public class FlutterActivity extends Activity } } - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) public void startBackGesture(@NonNull BackEvent backEvent) { if (stillAttachedForEvent("startBackGesture")) { @@ -950,7 +947,6 @@ public class FlutterActivity extends Activity } } - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) public void updateBackGestureProgress(@NonNull BackEvent backEvent) { if (stillAttachedForEvent("updateBackGestureProgress")) { @@ -958,7 +954,6 @@ public class FlutterActivity extends Activity } } - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) public void commitBackGesture() { if (stillAttachedForEvent("commitBackGesture")) { @@ -966,7 +961,6 @@ public class FlutterActivity extends Activity } } - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) public void cancelBackGesture() { if (stillAttachedForEvent("cancelBackGesture")) { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java index e1e426f99ef..846e00b8548 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java @@ -7,7 +7,6 @@ package io.flutter.embedding.android; import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW; import static io.flutter.embedding.android.FlutterActivityLaunchConfigs.DEFAULT_INITIAL_ROUTE; -import android.annotation.TargetApi; import android.app.Activity; import android.content.ComponentCallbacks2; import android.content.Context; @@ -821,7 +820,6 @@ import java.util.List; * * @param backEvent The BackEvent object containing information about the touch. */ - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) void startBackGesture(@NonNull BackEvent backEvent) { ensureAlive(); @@ -844,7 +842,6 @@ import java.util.List; * * @param backEvent An BackEvent object describing the progress event. */ - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) void updateBackGestureProgress(@NonNull BackEvent backEvent) { ensureAlive(); @@ -869,7 +866,6 @@ import java.util.List; * navigation, including finalizing animations and updating the UI to reflect the navigation * outcome. */ - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) void commitBackGesture() { ensureAlive(); @@ -891,7 +887,6 @@ import java.util.List; * in response to the back gesture. This includes resetting UI elements to their state prior to * the gesture's start. */ - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) void cancelBackGesture() { ensureAlive(); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterImageView.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterImageView.java index df9d6b394dd..e88cc2df146 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterImageView.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterImageView.java @@ -7,7 +7,6 @@ package io.flutter.embedding.android; import static io.flutter.Build.API_LEVELS; import android.annotation.SuppressLint; -import android.annotation.TargetApi; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -15,7 +14,6 @@ import android.graphics.ColorSpace; import android.graphics.PixelFormat; import android.hardware.HardwareBuffer; import android.media.Image; -import android.media.Image.Plane; import android.media.ImageReader; import android.util.AttributeSet; import android.view.Surface; @@ -253,19 +251,18 @@ public class FlutterImageView extends View implements RenderSurface { } } - @TargetApi(API_LEVELS.API_29) private void updateCurrentBitmap() { if (android.os.Build.VERSION.SDK_INT >= API_LEVELS.API_29) { final HardwareBuffer buffer = currentImage.getHardwareBuffer(); currentBitmap = Bitmap.wrapHardwareBuffer(buffer, ColorSpace.get(ColorSpace.Named.SRGB)); buffer.close(); } else { - final Plane[] imagePlanes = currentImage.getPlanes(); + final Image.Plane[] imagePlanes = currentImage.getPlanes(); if (imagePlanes.length != 1) { return; } - final Plane imagePlane = imagePlanes[0]; + final Image.Plane imagePlane = imagePlanes[0]; final int desiredWidth = imagePlane.getRowStride() / imagePlane.getPixelStride(); final int desiredHeight = currentImage.getHeight(); 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 82ba15fa89e..a6b3d49690d 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 @@ -7,7 +7,6 @@ package io.flutter.embedding.android; import static io.flutter.Build.API_LEVELS; import android.annotation.SuppressLint; -import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.content.res.Configuration; @@ -537,7 +536,7 @@ public class FlutterView extends FrameLayout * Refresh {@link androidx.window.layout.WindowInfoTracker} and {@link android.view.DisplayCutout} * display features. Fold, hinge and cutout areas are populated here. */ - @TargetApi(API_LEVELS.API_28) + @RequiresApi(API_LEVELS.API_28) protected void setWindowInfoListenerDisplayFeatures(WindowLayoutInfo layoutInfo) { List newDisplayFeatures = layoutInfo.getDisplayFeatures(); List flutterDisplayFeatures = new ArrayList<>(); @@ -1048,7 +1047,6 @@ public class FlutterView extends FrameLayout // -------- Start: Mouse ------- @Override - @TargetApi(API_LEVELS.API_24) @RequiresApi(API_LEVELS.API_24) @NonNull public PointerIcon getSystemPointerIcon(int type) { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java index ae99b61d20a..31866d764db 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java @@ -6,7 +6,6 @@ package io.flutter.embedding.engine.renderer; import static io.flutter.Build.API_LEVELS; -import android.annotation.TargetApi; import android.content.ComponentCallbacks2; import android.graphics.Bitmap; import android.graphics.ImageFormat; @@ -23,6 +22,7 @@ import android.view.Surface; import androidx.annotation.Keep; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; import androidx.annotation.VisibleForTesting; import androidx.lifecycle.DefaultLifecycleObserver; import androidx.lifecycle.LifecycleOwner; @@ -408,7 +408,6 @@ public class FlutterRenderer implements TextureRegistry { // When we acquire the next image, close any ImageReaders that don't have any // more pending images. @Keep - @TargetApi(API_LEVELS.API_29) final class ImageReaderSurfaceProducer implements TextureRegistry.SurfaceProducer, TextureRegistry.ImageConsumer, @@ -741,7 +740,7 @@ public class FlutterRenderer implements TextureRegistry { } } - @TargetApi(API_LEVELS.API_33) + @RequiresApi(API_LEVELS.API_33) private void waitOnFence(Image image) { try { SyncFence fence = image.getFence(); @@ -844,7 +843,7 @@ public class FlutterRenderer implements TextureRegistry { } @Override - @TargetApi(API_LEVELS.API_29) + @RequiresApi(API_LEVELS.API_29) public Image acquireLatestImage() { PerImage r = dequeueImage(); if (r == null) { @@ -883,7 +882,7 @@ public class FlutterRenderer implements TextureRegistry { } } - @TargetApi(API_LEVELS.API_33) + @RequiresApi(API_LEVELS.API_33) private ImageReader createImageReader33() { final ImageReader.Builder builder = new ImageReader.Builder(requestedWidth, requestedHeight); // Allow for double buffering. @@ -900,7 +899,7 @@ public class FlutterRenderer implements TextureRegistry { return builder.build(); } - @TargetApi(API_LEVELS.API_29) + @RequiresApi(API_LEVELS.API_29) private ImageReader createImageReader29() { return ImageReader.newInstance( requestedWidth, @@ -1008,7 +1007,7 @@ public class FlutterRenderer implements TextureRegistry { } } - @TargetApi(API_LEVELS.API_33) + @RequiresApi(API_LEVELS.API_33) private void waitOnFence(Image image) { try { SyncFence fence = image.getFence(); @@ -1018,7 +1017,7 @@ public class FlutterRenderer implements TextureRegistry { } } - @TargetApi(API_LEVELS.API_29) + @RequiresApi(API_LEVELS.API_29) private void maybeWaitOnFence(Image image) { if (image == null) { return; @@ -1037,7 +1036,7 @@ public class FlutterRenderer implements TextureRegistry { } @Override - @TargetApi(API_LEVELS.API_29) + @RequiresApi(API_LEVELS.API_29) public Image acquireLatestImage() { Image r; synchronized (this) { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/BackGestureChannel.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/BackGestureChannel.java index 6fb8997d46b..bcbe16fdac7 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/BackGestureChannel.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/BackGestureChannel.java @@ -4,7 +4,6 @@ package io.flutter.embedding.engine.systemchannels; -import android.annotation.TargetApi; import android.window.BackEvent; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -60,7 +59,6 @@ public class BackGestureChannel { * * @param backEvent The BackEvent object containing information about the touch. */ - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) public void startBackGesture(@NonNull BackEvent backEvent) { Log.v(TAG, "Sending message to start back gesture"); @@ -74,7 +72,6 @@ public class BackGestureChannel { * * @param backEvent An BackEvent object describing the progress event. */ - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) public void updateBackGestureProgress(@NonNull BackEvent backEvent) { Log.v(TAG, "Sending message to update back gesture progress"); @@ -87,7 +84,6 @@ public class BackGestureChannel { *

This method should be called to signify the completion of a back gesture event and commit * the navigation action initiated by the gesture. */ - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) public void commitBackGesture() { Log.v(TAG, "Sending message to commit back gesture"); @@ -99,7 +95,6 @@ public class BackGestureChannel { * *

This method should be called when a back gesture is cancelled or the back button is pressed. */ - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) public void cancelBackGesture() { Log.v(TAG, "Sending message to cancel back gesture"); @@ -115,7 +110,6 @@ public class BackGestureChannel { channel.setMethodCallHandler(handler); } - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) private Map backEventToJsonMap(@NonNull BackEvent backEvent) { Map message = new HashMap<>(3); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/ScribeChannel.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/ScribeChannel.java index 7070000ab17..f9db0de84b7 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/ScribeChannel.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/ScribeChannel.java @@ -6,7 +6,6 @@ package io.flutter.embedding.engine.systemchannels; import static io.flutter.Build.API_LEVELS; -import android.annotation.TargetApi; import android.os.Build; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -129,7 +128,6 @@ public class ScribeChannel { * Responds to the {@code result} with success and a boolean indicating whether or not stylus * handwriting is available. */ - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) boolean isStylusHandwritingAvailable(); @@ -137,7 +135,6 @@ public class ScribeChannel { * Requests to start Scribe stylus handwriting, which will respond to the {@code result} with * either success if handwriting input has started or error otherwise. */ - @TargetApi(API_LEVELS.API_33) @RequiresApi(API_LEVELS.API_33) void startStylusHandwriting(); } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/ImeSyncDeferringInsetsCallback.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/ImeSyncDeferringInsetsCallback.java index 9aec85d1e1e..1b95a08e6cd 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/ImeSyncDeferringInsetsCallback.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/ImeSyncDeferringInsetsCallback.java @@ -7,7 +7,6 @@ package io.flutter.plugin.editing; import static io.flutter.Build.API_LEVELS; import android.annotation.SuppressLint; -import android.annotation.TargetApi; import android.graphics.Insets; import android.view.View; import android.view.WindowInsets; @@ -44,7 +43,6 @@ import java.util.List; // dispatched again, this time avoiding any flicker since the animation is now // complete. @VisibleForTesting -@TargetApi(API_LEVELS.API_30) @RequiresApi(API_LEVELS.API_30) @SuppressLint({"NewApi", "Override"}) @Keep diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java index aa96ea02645..5d36ebecebe 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java @@ -6,7 +6,6 @@ package io.flutter.plugin.editing; import static io.flutter.Build.API_LEVELS; -import android.annotation.TargetApi; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; @@ -29,7 +28,6 @@ import android.view.inputmethod.ExtractedTextRequest; import android.view.inputmethod.InputContentInfo; import android.view.inputmethod.InputMethodManager; import androidx.annotation.NonNull; -import androidx.annotation.RequiresApi; import androidx.core.view.inputmethod.InputConnectionCompat; import io.flutter.Log; import io.flutter.embedding.engine.FlutterJNI; @@ -495,8 +493,6 @@ public class InputConnectionAdaptor extends BaseInputConnection } @Override - @TargetApi(API_LEVELS.API_25) - @RequiresApi(API_LEVELS.API_25) public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) { // Ensure permission is granted. if (Build.VERSION.SDK_INT >= API_LEVELS.API_25 diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/ScribePlugin.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/ScribePlugin.java index 35fb2ff0d0d..607d3e68ab9 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/ScribePlugin.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/editing/ScribePlugin.java @@ -6,7 +6,6 @@ package io.flutter.plugin.editing; import static io.flutter.Build.API_LEVELS; -import android.annotation.TargetApi; import android.os.Build; import android.view.View; import android.view.inputmethod.InputMethodManager; @@ -70,7 +69,6 @@ public class ScribePlugin implements ScribeChannel.ScribeMethodHandler { *

Call this or isFeatureAvailable before calling startStylusHandwriting to make sure it's * available. */ - @TargetApi(API_LEVELS.API_34) @RequiresApi(API_LEVELS.API_34) @Override public boolean isStylusHandwritingAvailable() { @@ -83,7 +81,6 @@ public class ScribePlugin implements ScribeChannel.ScribeMethodHandler { *

Typically isStylusHandwritingAvailable should be called first to determine whether this is * supported by the IME. */ - @TargetApi(API_LEVELS.API_33) @RequiresApi(API_LEVELS.API_33) @Override public void startStylusHandwriting() { 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 1b5d398a982..1ef443f524c 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 @@ -183,26 +183,25 @@ public class LocalizationPlugin { */ @NonNull public static Locale localeFromString(@NonNull String localeString) { - // Normalize the locale string, replace all underscores with hyphens. - localeString = localeString.replace('_', '-'); + Locale.Builder localeBuilder = new Locale.Builder(); // Pre-API 21, we fall back to manually parsing the locale tag. - String parts[] = localeString.split("-", -1); + // Normalize the locale string, replace all underscores with hyphens. + String[] parts = localeString.replace('_', '-').split("-"); // Assume the first part is always the language code. - String languageCode = parts[0]; - String scriptCode = ""; - String countryCode = ""; + localeBuilder.setLanguage(parts[0]); + int index = 1; if (parts.length > index && parts[index].length() == 4) { - scriptCode = parts[index]; + localeBuilder.setScript(parts[index]); index++; } if (parts.length > index && parts[index].length() >= 2 && parts[index].length() <= 3) { - countryCode = parts[index]; + localeBuilder.setRegion(parts[index]); index++; } // Ignore the rest of the locale for this purpose. - return new Locale(languageCode, countryCode, scriptCode); + return localeBuilder.build(); } } diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/mouse/MouseCursorPlugin.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/mouse/MouseCursorPlugin.java index e6a4f7083bf..5a4e285f35d 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/mouse/MouseCursorPlugin.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/mouse/MouseCursorPlugin.java @@ -6,7 +6,6 @@ package io.flutter.plugin.mouse; import static io.flutter.Build.API_LEVELS; -import android.annotation.TargetApi; import android.view.PointerIcon; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; @@ -14,7 +13,6 @@ import io.flutter.embedding.engine.systemchannels.MouseCursorChannel; import java.util.HashMap; /** A mandatory plugin that handles mouse cursor requests. */ -@TargetApi(API_LEVELS.API_24) @RequiresApi(API_LEVELS.API_24) public class MouseCursorPlugin { @NonNull private final MouseCursorViewDelegate mView; diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/ImageReaderPlatformViewRenderTarget.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/ImageReaderPlatformViewRenderTarget.java index 4cf0cd01ed9..51348c3f34c 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/ImageReaderPlatformViewRenderTarget.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/ImageReaderPlatformViewRenderTarget.java @@ -2,7 +2,6 @@ package io.flutter.plugin.platform; import static io.flutter.Build.API_LEVELS; -import android.annotation.TargetApi; import android.graphics.ImageFormat; import android.hardware.HardwareBuffer; import android.media.Image; @@ -10,10 +9,10 @@ import android.media.ImageReader; import android.os.Build; import android.os.Handler; import android.view.Surface; +import androidx.annotation.RequiresApi; import io.flutter.Log; import io.flutter.view.TextureRegistry.ImageTextureEntry; -@TargetApi(API_LEVELS.API_29) public class ImageReaderPlatformViewRenderTarget implements PlatformViewRenderTarget { private ImageTextureEntry textureEntry; private ImageReader reader; @@ -50,7 +49,7 @@ public class ImageReaderPlatformViewRenderTarget implements PlatformViewRenderTa } }; - @TargetApi(API_LEVELS.API_33) + @RequiresApi(API_LEVELS.API_33) protected ImageReader createImageReader33() { final ImageReader.Builder builder = new ImageReader.Builder(bufferWidth, bufferHeight); // Allow for double buffering. @@ -69,7 +68,7 @@ public class ImageReaderPlatformViewRenderTarget implements PlatformViewRenderTa return reader; } - @TargetApi(API_LEVELS.API_29) + @RequiresApi(API_LEVELS.API_29) protected ImageReader createImageReader29() { final ImageReader reader = ImageReader.newInstance( diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewWrapper.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewWrapper.java index 1bce76fd09b..cf0a8f70a05 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewWrapper.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewWrapper.java @@ -7,7 +7,6 @@ package io.flutter.plugin.platform; import static io.flutter.Build.API_LEVELS; import android.annotation.SuppressLint; -import android.annotation.TargetApi; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; @@ -23,6 +22,7 @@ import android.view.accessibility.AccessibilityEvent; import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; import androidx.annotation.VisibleForTesting; import io.flutter.Log; import io.flutter.embedding.android.AndroidTouchProcessor; @@ -40,7 +40,7 @@ import io.flutter.util.ViewUtils; *

Since the view is in the Android view hierarchy, keyboard and accessibility interactions * behave normally. */ -@TargetApi(API_LEVELS.API_23) +@RequiresApi(API_LEVELS.API_23) public class PlatformViewWrapper extends FrameLayout { private static final String TAG = "PlatformViewWrapper"; 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 c329585e80f..0bcb4e9552f 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 @@ -6,7 +6,6 @@ package io.flutter.plugin.platform; import static io.flutter.Build.API_LEVELS; -import android.annotation.TargetApi; import android.content.ComponentCallbacks2; import android.content.Context; import android.content.MutableContextWrapper; @@ -21,6 +20,7 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; import androidx.annotation.UiThread; import androidx.annotation.VisibleForTesting; import io.flutter.Log; @@ -592,7 +592,7 @@ public class PlatformViewsController implements PlatformViewsAccessibilityDelega // Configures the view for Texture Layer Hybrid Composition mode, returning the associated // texture ID. - @TargetApi(API_LEVELS.API_23) + @RequiresApi(API_LEVELS.API_23) @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE) public long configureForTextureLayerComposition( @NonNull PlatformView platformView, diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SurfaceProducerPlatformViewRenderTarget.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SurfaceProducerPlatformViewRenderTarget.java index 03e28d28806..f8eacfb45b9 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SurfaceProducerPlatformViewRenderTarget.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SurfaceProducerPlatformViewRenderTarget.java @@ -2,11 +2,11 @@ package io.flutter.plugin.platform; import static io.flutter.Build.API_LEVELS; -import android.annotation.TargetApi; import android.view.Surface; +import androidx.annotation.RequiresApi; import io.flutter.view.TextureRegistry.SurfaceProducer; -@TargetApi(API_LEVELS.API_29) +@RequiresApi(API_LEVELS.API_29) public class SurfaceProducerPlatformViewRenderTarget implements PlatformViewRenderTarget { private static final String TAG = "SurfaceProducerRenderTarget"; private SurfaceProducer producer; 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 4f1bdd62b4e..0f2041d0985 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 @@ -3,14 +3,13 @@ package io.flutter.plugin.platform; import static android.content.ComponentCallbacks2.TRIM_MEMORY_COMPLETE; import static io.flutter.Build.API_LEVELS; -import android.annotation.TargetApi; import android.graphics.SurfaceTexture; import android.os.Build; import android.view.Surface; +import androidx.annotation.RequiresApi; import io.flutter.view.TextureRegistry; import io.flutter.view.TextureRegistry.SurfaceTextureEntry; -@TargetApi(API_LEVELS.API_26) public class SurfaceTexturePlatformViewRenderTarget implements PlatformViewRenderTarget { private static final String TAG = "SurfaceTexturePlatformViewRenderTarget"; @@ -101,6 +100,7 @@ public class SurfaceTexturePlatformViewRenderTarget implements PlatformViewRende } } + @RequiresApi(API_LEVELS.API_26) public Surface getSurface() { recreateSurfaceIfNeeded(); if (surfaceTexture == null || surfaceTexture.isReleased()) { diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java index cdde0687a4a..ec847066187 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/VirtualDisplayController.java @@ -7,7 +7,6 @@ package io.flutter.plugin.platform; import static android.view.View.OnFocusChangeListener; import static io.flutter.Build.API_LEVELS; -import android.annotation.TargetApi; import android.content.Context; import android.hardware.display.DisplayManager; import android.hardware.display.VirtualDisplay; @@ -18,6 +17,7 @@ import android.view.View; import android.view.View.OnFocusChangeListener; import android.view.ViewTreeObserver; import androidx.annotation.NonNull; +import androidx.annotation.RequiresApi; import androidx.annotation.VisibleForTesting; class VirtualDisplayController { @@ -232,7 +232,7 @@ class VirtualDisplayController { } // On Android versions 31+ resizing of a Virtual Display's Presentation is natively supported. - @TargetApi(API_LEVELS.API_31) + @RequiresApi(API_LEVELS.API_31) private void resize31( View embeddedView, int width, int height, final Runnable onNewSizeFrameAvailable) { renderTarget.resize(width, height); 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 ba56ff40076..472055effac 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 @@ -6,7 +6,6 @@ package io.flutter.plugin.text; import static io.flutter.Build.API_LEVELS; -import android.annotation.TargetApi; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; @@ -136,7 +135,6 @@ public class ProcessTextPlugin *

When an activity does not return a value. the request is completed successfully and returns * null. */ - @TargetApi(API_LEVELS.API_23) @RequiresApi(API_LEVELS.API_23) public boolean onActivityResult(int requestCode, int resultCode, @Nullable Intent intent) { // Return early if the result is not related to a request sent by this plugin. 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 e3550d13e19..914c6e2a9ba 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 @@ -7,7 +7,6 @@ package io.flutter.view; import static io.flutter.Build.API_LEVELS; import android.annotation.SuppressLint; -import android.annotation.TargetApi; import android.app.Activity; import android.content.ContentResolver; import android.content.Context; @@ -564,7 +563,6 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { accessibilityFocusedSemanticsNode, o -> o.hasFlag(Flag.HAS_IMPLICIT_SCROLLING))); } - @TargetApi(API_LEVELS.API_31) @RequiresApi(API_LEVELS.API_31) private void setBoldTextFlag() { if (rootAccessibilityView == null || rootAccessibilityView.getResources() == null) { @@ -1926,7 +1924,6 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { } } - @TargetApi(API_LEVELS.API_28) @RequiresApi(API_LEVELS.API_28) private void setAccessibilityPaneTitle(String title) { rootAccessibilityView.setAccessibilityPaneTitle(title); @@ -1975,7 +1972,6 @@ public class AccessibilityBridge extends AccessibilityNodeProvider { * *

The {@code layoutInDisplayCutoutMode} is added after API level 28. */ - @TargetApi(API_LEVELS.API_28) @RequiresApi(API_LEVELS.API_28) private boolean doesLayoutInDisplayCutoutModeRequireLeftInset() { Context context = rootAccessibilityView.getContext(); diff --git a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java index a539ba455cf..267a8183328 100644 --- a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java +++ b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/FlutterJNITest.java @@ -78,7 +78,10 @@ public class FlutterJNITest { Configuration config = mock(Configuration.class); DartExecutor dartExecutor = mock(DartExecutor.class); LocaleList localeList = - new LocaleList(new Locale("es", "MX"), new Locale("zh", "CN"), new Locale("en", "US")); + new LocaleList( + new Locale.Builder().setLanguage("es").setRegion("MX").build(), + new Locale.Builder().setLanguage("zh").setRegion("CN").build(), + new Locale.Builder().setLanguage("en").setRegion("US").build()); when(context.getResources()).thenReturn(resources); when(resources.getConfiguration()).thenReturn(config); when(config.getLocales()).thenReturn(localeList); diff --git a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/systemchannels/TextInputChannelTest.java b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/systemchannels/TextInputChannelTest.java index cfc7fab8740..9bbe291abd7 100644 --- a/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/systemchannels/TextInputChannelTest.java +++ b/engine/src/flutter/shell/platform/android/test/io/flutter/embedding/engine/systemchannels/TextInputChannelTest.java @@ -57,7 +57,9 @@ public class TextInputChannelTest { final TextInputChannel.Configuration configuration = TextInputChannel.Configuration.fromJson(arguments); - final Locale[] hintLocales = {new Locale("en"), new Locale("fr")}; + final Locale[] hintLocales = { + new Locale.Builder().setLanguage("en").build(), new Locale.Builder().setLanguage("fr").build() + }; assertEquals(configuration.hintLocales.length, hintLocales.length); assertEquals(configuration.hintLocales[0], hintLocales[0]); assertEquals(configuration.hintLocales[1], hintLocales[1]); diff --git a/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/editing/SpellCheckPluginTest.java b/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/editing/SpellCheckPluginTest.java index fd291b291ad..a724ceefa51 100644 --- a/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/editing/SpellCheckPluginTest.java +++ b/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/editing/SpellCheckPluginTest.java @@ -82,7 +82,10 @@ public class SpellCheckPluginTest { SpellCheckerSession fakeSpellCheckerSession = mock(SpellCheckerSession.class); when(fakeTextServicesManager.newSpellCheckerSession( - null, new Locale("en", "US"), spellCheckPlugin, true)) + null, + new Locale.Builder().setLanguage("en").setRegion("US").build(), + spellCheckPlugin, + true)) .thenReturn(fakeSpellCheckerSession); spellCheckPlugin.initiateSpellCheck("en-US", "Hello, wrold!", mockResult); @@ -118,7 +121,10 @@ public class SpellCheckPluginTest { SpellCheckerSession fakeSpellCheckerSession = mock(SpellCheckerSession.class); when(fakeTextServicesManager.newSpellCheckerSession( - null, new Locale("en", "US"), spellCheckPlugin, true)) + null, + new Locale.Builder().setLanguage("en").setRegion("US").build(), + spellCheckPlugin, + true)) .thenReturn(fakeSpellCheckerSession); spellCheckPlugin.performSpellCheck("en-US", "Hello, wrold!"); @@ -138,7 +144,7 @@ public class SpellCheckPluginTest { SpellCheckPlugin spellCheckPlugin = spy(new SpellCheckPlugin(fakeTextServicesManager, fakeSpellCheckChannel)); SpellCheckerSession fakeSpellCheckerSession = mock(SpellCheckerSession.class); - Locale english_US = new Locale("en", "US"); + Locale english_US = new Locale.Builder().setLanguage("en").setRegion("US").build(); when(fakeTextServicesManager.newSpellCheckerSession(null, english_US, spellCheckPlugin, true)) .thenReturn(fakeSpellCheckerSession); @@ -165,7 +171,7 @@ public class SpellCheckPluginTest { SpellCheckPlugin spellCheckPlugin = spy(new SpellCheckPlugin(fakeTextServicesManager, fakeSpellCheckChannel)); SpellCheckerSession fakeSpellCheckerSession = mock(SpellCheckerSession.class); - Locale english_US = new Locale("en", "US"); + Locale english_US = new Locale.Builder().setLanguage("en").setRegion("US").build(); when(fakeTextServicesManager.newSpellCheckerSession(null, english_US, spellCheckPlugin, true)) .thenReturn(fakeSpellCheckerSession); diff --git a/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/editing/TextInputPluginTest.java b/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/editing/TextInputPluginTest.java index a380fbe752b..ecf14072b8e 100644 --- a/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/editing/TextInputPluginTest.java +++ b/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/editing/TextInputPluginTest.java @@ -2808,7 +2808,7 @@ public class TextInputPluginTest { scribeChannel, mock(PlatformViewsController.class), mock(PlatformViewsController2.class)); - final Locale[] hintLocales = {new Locale("en")}; + final Locale[] hintLocales = {new Locale.Builder().setLanguage("en").build()}; textInputPlugin.setTextInputClient( 0, new TextInputChannel.Configuration( diff --git a/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/localization/LocalizationPluginTest.java b/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/localization/LocalizationPluginTest.java index 2db39e9cfb1..a4dd64f0750 100644 --- a/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/localization/LocalizationPluginTest.java +++ b/engine/src/flutter/shell/platform/android/test/io/flutter/plugin/localization/LocalizationPluginTest.java @@ -43,7 +43,10 @@ public class LocalizationPluginTest { Configuration config = mock(Configuration.class); DartExecutor dartExecutor = mock(DartExecutor.class); LocaleList localeList = - new LocaleList(new Locale("es", "MX"), new Locale("zh", "CN"), new Locale("en", "US")); + new LocaleList( + new Locale.Builder().setLanguage("es").setRegion("MX").build(), + new Locale.Builder().setLanguage("zh").setRegion("CN").build(), + new Locale.Builder().setLanguage("en").setRegion("US").build()); when(context.getResources()).thenReturn(resources); when(resources.getConfiguration()).thenReturn(config); when(config.getLocales()).thenReturn(localeList); @@ -81,7 +84,7 @@ public class LocalizationPluginTest { "fr", "FR", "", "it", "IT", "" }; - localeList = new LocaleList(new Locale("fr", "CH")); + localeList = new LocaleList(new Locale.Builder().setLanguage("fr").setRegion("CH").build()); when(config.getLocales()).thenReturn(localeList); result = flutterJNI.computePlatformResolvedLocale(supportedLocales); // The call will use the new (> API 24) algorithm. @@ -99,7 +102,8 @@ public class LocalizationPluginTest { "fr", "", "", "it", "IT", "" }; - localeList = new LocaleList(new Locale("fr", "CH")); + Locale testSecondLocaleFrCh = new Locale.Builder().setLanguage("fr").setRegion("CH").build(); + localeList = new LocaleList(testSecondLocaleFrCh); when(config.getLocales()).thenReturn(localeList); result = flutterJNI.computePlatformResolvedLocale(supportedLocales); // The call will use the new (> API 24) algorithm. @@ -116,7 +120,10 @@ public class LocalizationPluginTest { "es", "ES", "", "it", "IT", "" }; - localeList = new LocaleList(new Locale("fr", "CH"), new Locale("it", "CH")); + localeList = + new LocaleList( + new Locale.Builder().setLanguage("fr").setRegion("CH").build(), + new Locale.Builder().setLanguage("it").setRegion("CH").build()); when(config.getLocales()).thenReturn(localeList); result = flutterJNI.computePlatformResolvedLocale(supportedLocales); // The call will use the new (> API 24) algorithm. @@ -130,7 +137,7 @@ public class LocalizationPluginTest { "zh", "CN", "Hans", "zh", "HK", "Hant", }; - localeList = new LocaleList(new Locale("zh", "CN")); + localeList = new LocaleList(new Locale.Builder().setLanguage("zh").setRegion("CN").build()); when(config.getLocales()).thenReturn(localeList); result = flutterJNI.computePlatformResolvedLocale(supportedLocales); assertEquals(result.length, 3); @@ -151,7 +158,10 @@ public class LocalizationPluginTest { Configuration config = mock(Configuration.class); DartExecutor dartExecutor = mock(DartExecutor.class); LocaleList localeList = - new LocaleList(new Locale("es", "MX"), new Locale("zh", "CN"), new Locale("en", "US")); + new LocaleList( + new Locale.Builder().setLanguage("es").setRegion("MX").build(), + new Locale.Builder().setLanguage("zh").setRegion("CN").build(), + new Locale.Builder().setLanguage("en").setRegion("US").build()); when(context.getResources()).thenReturn(resources); when(resources.getConfiguration()).thenReturn(config); when(config.getLocales()).thenReturn(localeList); @@ -189,7 +199,7 @@ public class LocalizationPluginTest { "fr", "FR", "", "it", "IT", "" }; - localeList = new LocaleList(new Locale("fr", "CH")); + localeList = new LocaleList(new Locale.Builder().setLanguage("fr").setRegion("CH").build()); when(config.getLocales()).thenReturn(localeList); result = flutterJNI.computePlatformResolvedLocale(supportedLocales); // The call will use the new (> API 24) algorithm. @@ -207,7 +217,7 @@ public class LocalizationPluginTest { "fr", "", "", "it", "IT", "" }; - localeList = new LocaleList(new Locale("fr", "CH")); + localeList = new LocaleList(new Locale.Builder().setLanguage("fr").setRegion("CH").build()); when(config.getLocales()).thenReturn(localeList); result = flutterJNI.computePlatformResolvedLocale(supportedLocales); // The call will use the new (> API 24) algorithm. @@ -224,7 +234,10 @@ public class LocalizationPluginTest { "es", "ES", "", "it", "IT", "" }; - localeList = new LocaleList(new Locale("fr", "CH"), new Locale("it", "CH")); + localeList = + new LocaleList( + new Locale.Builder().setLanguage("fr").setRegion("CH").build(), + new Locale.Builder().setLanguage("it").setRegion("CH").build()); when(config.getLocales()).thenReturn(localeList); result = flutterJNI.computePlatformResolvedLocale(supportedLocales); // The call will use the new (> API 24) algorithm. @@ -340,31 +353,35 @@ public class LocalizationPluginTest { @Test public void localeFromString_languageOnly() { Locale locale = LocalizationPlugin.localeFromString("en"); - assertEquals(locale, new Locale("en")); + assertEquals(locale, new Locale.Builder().setLanguage("en").build()); } @Test public void localeFromString_languageAndCountry() { Locale locale = LocalizationPlugin.localeFromString("en-US"); - assertEquals(locale, new Locale("en", "US")); + assertEquals(locale, new Locale.Builder().setLanguage("en").setRegion("US").build()); } @Test public void localeFromString_languageCountryAndVariant() { Locale locale = LocalizationPlugin.localeFromString("zh-Hans-CN"); - assertEquals(locale, new Locale("zh", "CN", "Hans")); + Locale testLocale = + new Locale.Builder().setLanguage("zh").setRegion("CN").setScript("Hans").build(); + assertEquals(locale, testLocale); } @Test public void localeFromString_underscore() { Locale locale = LocalizationPlugin.localeFromString("zh_Hans_CN"); - assertEquals(locale, new Locale("zh", "CN", "Hans")); + Locale testLocale = + new Locale.Builder().setLanguage("zh").setRegion("CN").setScript("Hans").build(); + assertEquals(locale, testLocale); } @Test public void localeFromString_additionalVariantsAreIgnored() { Locale locale = LocalizationPlugin.localeFromString("de-DE-u-co-phonebk"); - assertEquals(locale, new Locale("de", "DE")); + assertEquals(locale, new Locale.Builder().setLanguage("de").setRegion("DE").build()); } @Test diff --git a/engine/src/flutter/shell/platform/android/test_runner/build.gradle b/engine/src/flutter/shell/platform/android/test_runner/build.gradle index d2cbcb84164..de525bdf39a 100644 --- a/engine/src/flutter/shell/platform/android/test_runner/build.gradle +++ b/engine/src/flutter/shell/platform/android/test_runner/build.gradle @@ -4,7 +4,7 @@ buildscript { mavenCentral() } dependencies { - classpath "com.android.tools.build:gradle:8.7.2" + classpath "com.android.tools.build:gradle:8.9.1" } } @@ -33,7 +33,7 @@ println "==========================================" android { namespace 'io.flutter.app.test' - compileSdk 35 + compileSdk 36 defaultConfig { minSdkVersion 21 diff --git a/engine/src/flutter/testing/android/native_activity/native_activity.gni b/engine/src/flutter/testing/android/native_activity/native_activity.gni index 89692a307fc..3cf0b61f8d6 100644 --- a/engine/src/flutter/testing/android/native_activity/native_activity.gni +++ b/engine/src/flutter/testing/android/native_activity/native_activity.gni @@ -6,12 +6,12 @@ import("//build/config/android/config.gni") import("//flutter/tools/templater/templater.gni") android_buildtools = - "//flutter/third_party/android_tools/sdk/build-tools/35.0.0-rc4" + "//flutter/third_party/android_tools/sdk/build-tools/36.0.0" aapt2 = "$android_buildtools/aapt2" zipalign = "$android_buildtools/zipalign" apksigner = "$android_buildtools/apksigner" android_jar = - "//flutter/third_party/android_tools/sdk/platforms/android-35/android.jar" + "//flutter/third_party/android_tools/sdk/platforms/android-36/android.jar" src_root = "//flutter/testing/android/native_activity" # A drop in replacement for an executable or shared library target. Providing a diff --git a/engine/src/flutter/tools/android_sdk/packages.txt b/engine/src/flutter/tools/android_sdk/packages.txt index c4f49cd6bc8..e102a0d847a 100644 --- a/engine/src/flutter/tools/android_sdk/packages.txt +++ b/engine/src/flutter/tools/android_sdk/packages.txt @@ -1,6 +1,6 @@ -platforms;android-35:platforms +platforms;android-36:platforms cmdline-tools;latest:cmdline-tools -build-tools;35.0.0-rc4:build-tools +build-tools;36.0.0:build-tools platform-tools:platform-tools tools:tools -ndk;26.3.11579264:ndk +ndk;27.0.12077973:ndk diff --git a/engine/src/flutter/tools/cipd/android_embedding_bundle/build.gradle b/engine/src/flutter/tools/cipd/android_embedding_bundle/build.gradle index f6811553ae0..78edce934ef 100644 --- a/engine/src/flutter/tools/cipd/android_embedding_bundle/build.gradle +++ b/engine/src/flutter/tools/cipd/android_embedding_bundle/build.gradle @@ -13,7 +13,7 @@ buildscript { mavenCentral() } dependencies { - classpath "com.android.tools.build:gradle:7.3.0" + classpath "com.android.tools.build:gradle:8.9.1" } } @@ -33,7 +33,7 @@ allprojects { apply plugin: "com.android.application" android { - compileSdk 35 + compileSdk 36 } configurations { diff --git a/engine/src/flutter/tools/javadoc/gen_javadoc.py b/engine/src/flutter/tools/javadoc/gen_javadoc.py index 88d58ef44d9..b12a10be7c2 100755 --- a/engine/src/flutter/tools/javadoc/gen_javadoc.py +++ b/engine/src/flutter/tools/javadoc/gen_javadoc.py @@ -48,7 +48,7 @@ def main(): os.makedirs(args.out_dir) android_jar_path = os.path.join( - args.src_dir, 'flutter', 'third_party', 'android_tools', 'sdk', 'platforms', 'android-35', + args.src_dir, 'flutter', 'third_party', 'android_tools', 'sdk', 'platforms', 'android-36', 'android.jar' ) if not os.path.exists(android_jar_path):