Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Upgrade android SDK to API 32 #33524

Merged
merged 14 commits into from
Jun 2, 2022
Merged
4 changes: 2 additions & 2 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ allowed_hosts = [
]

deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + 'f582982073b6f04b7a70bc284bac8fafa6c0a846',
'src': 'https://github.com/flutter/buildroot.git' + '@' + '8ce3dadcb6bb3e05570e1b5748fbc2716d264bb0',

# Fuchsia compatibility
#
Expand Down Expand Up @@ -571,7 +571,7 @@ deps = {
'packages': [
{
'package': 'flutter/android/sdk/all/${{platform}}',
'version': 'version:31v8'
'version': 'version:32v1'
}
],
'condition': 'download_android_deps',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ public View findViewByAccessibilityIdTraversal(int accessibilityId) {
* @param currentView The root view.
* @return A descendant of currentView or currentView itself.
*/
@SuppressLint("PrivateApi")
@SuppressLint("DiscouragedPrivateApi")
private View findViewByAccessibilityIdRootedAtCurrentView(int accessibilityId, View currentView) {
Method getAccessibilityViewIdMethod;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

package io.flutter.embedding.engine.renderer;

import android.annotation.TargetApi;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
Expand Down Expand Up @@ -34,7 +33,6 @@
* <p>{@link io.flutter.embedding.android.FlutterSurfaceView} and {@link
* io.flutter.embedding.android.FlutterTextureView} are implementations of {@link RenderSurface}.
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public class FlutterRenderer implements TextureRegistry {
private static final String TAG = "FlutterRenderer";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package io.flutter.plugin.localization;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
Expand All @@ -22,6 +23,7 @@ public class LocalizationPlugin {
@NonNull private final LocalizationChannel localizationChannel;
@NonNull private final Context context;

@SuppressLint("AppBundleLocaleChanges") // This is optionally turned on by apps.
@VisibleForTesting
final LocalizationChannel.LocalizationMessageHandler localizationMessageHandler =
new LocalizationChannel.LocalizationMessageHandler() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package io.flutter.plugin.platform;

import android.annotation.TargetApi;
import android.app.Activity;
import android.app.ActivityManager.TaskDescription;
import android.content.ClipData;
Expand Down Expand Up @@ -243,8 +244,7 @@ public void onSystemUiVisibilityChange(int visibility) {
private void setSystemChromeEnabledSystemUIMode(PlatformChannel.SystemUiMode systemUiMode) {
int enabledOverlays;

if (systemUiMode == PlatformChannel.SystemUiMode.LEAN_BACK
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (systemUiMode == PlatformChannel.SystemUiMode.LEAN_BACK) {
// LEAN BACK
// Available starting at SDK 16
// Should not show overlays, tap to reveal overlays, needs onChange callback
Expand Down Expand Up @@ -364,6 +364,7 @@ private void restoreSystemChromeSystemUIOverlays() {
}

@SuppressWarnings("deprecation")
@TargetApi(21)
private void setSystemChromeSystemUIOverlayStyle(
PlatformChannel.SystemChromeStyle systemChromeStyle) {
Window window = activity.getWindow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2758,6 +2758,8 @@ private SpannableString createSpannableString(String string, List<StringAttribut
* @param eventOrigin the view in the embedded view's hierarchy that sent the event.
* @return True if the event was sent.
*/
// AccessibilityEvent has many irrelevant cases that would be confusing to list.
@SuppressLint("SwitchIntDef")
public boolean externalViewRequestSendAccessibilityEvent(
View embeddedView, View eventOrigin, AccessibilityEvent event) {
if (!accessibilityViewEmbedder.requestSendAccessibilityEvent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ private static class ReflectionAccessors {
private @Nullable final Field childNodeIdsField;
private @Nullable final Method longArrayGetIndex;

@SuppressLint("PrivateApi")
@SuppressLint("DiscouragedPrivateApi,PrivateApi")
private ReflectionAccessors() {
Method getSourceNodeId = null;
Method getParentNodeId = null;
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/android/test_runner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ println "AVAILABLE PROCESSORS: $availableProcessors"
println "=========================================="

android {
compileSdkVersion 31
compileSdkVersion 32

defaultConfig {
minSdkVersion 16
Expand Down
6 changes: 3 additions & 3 deletions testing/android_background_image/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ android {
// The others are irrelevant for a test application.
disable 'UnpackedNativeCode','MissingApplicationIcon','GoogleAppIndexingApiWarning','GoogleAppIndexingWarning','GradleDependency','NewerVersionAvailable'
}
buildToolsVersion = '31.0.0'
compileSdkVersion 31
buildToolsVersion = '33.0.0-rc4'
compileSdkVersion 32
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
defaultConfig {
applicationId 'dev.flutter.android_background_image'
minSdkVersion 16
targetSdkVersion 31
targetSdkVersion 32
versionCode 1
versionName '1.0'
}
Expand Down
6 changes: 3 additions & 3 deletions testing/scenario_app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ android {
// The others are irrelevant for a test application.
disable 'UnpackedNativeCode','MissingApplicationIcon','GoogleAppIndexingApiWarning','GoogleAppIndexingWarning','GradleDependency','NewerVersionAvailable','Registered'
}
buildToolsVersion = '31.0.0'
compileSdkVersion 31
buildToolsVersion = '33.0.0-rc4'
compileSdkVersion 32
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
defaultConfig {
applicationId 'dev.flutter.scenarios'
minSdkVersion 18
targetSdkVersion 31
targetSdkVersion 32
versionCode 1
versionName '1.0'
testInstrumentationRunner 'dev.flutter.TestRunner'
Expand Down
139 changes: 20 additions & 119 deletions tools/android_lint/baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="4" by="lint 26.1.1">
<issues format="6" by="lint 7.2.0" type="baseline" client="" dependencies="true" name="" variant="all" version="7.2.0">

<issue
id="InlinedApi"
Expand All @@ -8,7 +8,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java"
line="221"
line="267"
column="16"/>
</issue>

Expand All @@ -19,7 +19,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java"
line="225"
line="271"
column="16"/>
</issue>

Expand All @@ -30,58 +30,36 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java"
line="229"
line="275"
column="16"/>
</issue>

<issue
id="InlinedApi"
message="Field requires API level 21 (current min is 16): `android.view.HapticFeedbackConstants#CLOCK_TICK`"
errorLine1=" view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java"
line="121"
column="44"/>
</issue>

<issue
id="InlinedApi"
message="Field requires API level 19 (current min is 16): `android.view.View#SYSTEM_UI_FLAG_IMMERSIVE_STICKY`"
errorLine1=" enabledOverlays |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java"
line="154"
column="32"/>
</issue>

<issue
id="InlinedApi"
message="Field requires API level 17 (current min is 16): `android.view.View#LAYOUT_DIRECTION_LTR`"
errorLine1=" return direction == View.LAYOUT_DIRECTION_LTR || direction == View.LAYOUT_DIRECTION_RTL;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
errorLine1=" return direction == View.LAYOUT_DIRECTION_LTR || direction == View.LAYOUT_DIRECTION_RTL;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java"
line="370"
column="29"/>
line="661"
column="25"/>
</issue>

<issue
id="InlinedApi"
message="Field requires API level 17 (current min is 16): `android.view.View#LAYOUT_DIRECTION_RTL`"
errorLine1=" return direction == View.LAYOUT_DIRECTION_LTR || direction == View.LAYOUT_DIRECTION_RTL;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
errorLine1=" return direction == View.LAYOUT_DIRECTION_LTR || direction == View.LAYOUT_DIRECTION_RTL;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java"
line="370"
column="71"/>
line="661"
column="67"/>
</issue>

<issue
id="OldTargetApi"
message="Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the `android.os.Build.VERSION_CODES` javadoc for details."
errorLine1=" &lt;uses-sdk android:minSdkVersion=&quot;16&quot; android:targetSdkVersion=&quot;21&quot; />"
errorLine1=" &lt;uses-sdk android:minSdkVersion=&quot;16&quot; android:targetSdkVersion=&quot;31&quot; />"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/AndroidManifest.xml"
Expand All @@ -100,103 +78,26 @@
column="82"/>
</issue>

<issue
id="UseSparseArrays"
message="Use `new SparseArray&lt;SemanticsNode>(...)` instead for better performance"
errorLine1=" private final Map&lt;Integer, SemanticsNode> flutterSemanticsTree = new HashMap&lt;>();"
errorLine2=" ~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="130"
column="70"/>
</issue>

<issue
id="UseSparseArrays"
message="Use `new SparseArray&lt;CustomAccessibilityAction>(...)` instead for better performance"
errorLine1=" private final Map&lt;Integer, CustomAccessibilityAction> customAccessibilityActions = new HashMap&lt;>();"
errorLine2=" ~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
line="155"
column="88"/>
</issue>

<issue
id="UseSparseArrays"
message="Use `new SparseArray&lt;BinaryReply>(...)` instead for better performance"
errorLine1=" this.pendingReplies = new HashMap&lt;>();"
errorLine2=" ~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java"
line="43"
column="27"/>
</issue>

<issue
id="ClickableViewAccessibility"
message="Custom view `FlutterView` overrides `onTouchEvent` but not `performClick`"
errorLine1=" public boolean onTouchEvent(MotionEvent event) {"
errorLine2=" ~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java"
line="367"
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="436"
column="18"/>
</issue>

<issue
id="ClickableViewAccessibility"
message="Custom view `FlutterView` overrides `onTouchEvent` but not `performClick`"
errorLine1=" public boolean onTouchEvent(MotionEvent event) {"
errorLine2=" ~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="391"
column="20"/>
</issue>

<issue
id="UseValueOf"
message="Use `Boolean.valueOf(true)` instead"
errorLine1=" messageContent.add(new Boolean(true));"
errorLine2=" ~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/test/io/flutter/plugin/common/StandardMessageCodecTest.java"
line="87"
column="24"/>
</issue>

<issue
id="UseValueOf"
message="Use `Boolean.valueOf(false)` instead"
errorLine1=" messageContent.add(new Boolean(false));"
errorLine2=" ~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/test/io/flutter/plugin/common/StandardMessageCodecTest.java"
line="88"
column="24"/>
</issue>

<issue
id="Recycle"
message="This `SurfaceTexture` should be freed up after use with `#release()`"
errorLine1=" final SurfaceTexture surfaceTexture = new SurfaceTexture(0);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java"
line="97"
column="43"/>
</issue>

<issue
id="Recycle"
message="This `SurfaceTexture` should be freed up after use with `#release()`"
errorLine1=" final SurfaceTexture surfaceTexture = new SurfaceTexture(0);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
errorLine1=" public boolean onTouchEvent(@NonNull MotionEvent event) {"
errorLine2=" ~~~~~~~~~~~~">
<location
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
line="876"
column="43"/>
file="../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java"
line="911"
column="18"/>
</issue>

</issues>
10 changes: 9 additions & 1 deletion tools/android_lint/lint.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@
compatible all the way back to API 16. See
https://developer.android.com/studio/write/java8-support.html#supported_features -->
<ignore regexp="^Try-with-resources requires API level 19"/>
</issue>
</issue>
<issue id="UnknownNullness" severity="ignore" />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also part of the Kotlin interop, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one in particular causes something on the order of ~500 errors

<issue id="SyntheticAccessor" severity="ignore" />
<!-- Flutter provides custom splash screens as a feature -->
<issue id="CustomSplashScreen" severity="ignore" />
<!-- See https://github.com/flutter/flutter/issues/105061 -->
<issue id="ScopedStorage" severity="ignore" />
<!-- See https://github.com/flutter/flutter/issues/105067 -->
<issue id="LambdaLast" severity="ignore" />
</lint>
Loading