Skip to content

Commit c617fd7

Browse files
authored
Upgrade android SDK to API 32 (flutter#33524)
1 parent 172a120 commit c617fd7

File tree

16 files changed

+59
-186
lines changed

16 files changed

+59
-186
lines changed

DEPS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ allowed_hosts = [
111111
]
112112

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

116116
# Fuchsia compatibility
117117
#
@@ -571,7 +571,7 @@ deps = {
571571
'packages': [
572572
{
573573
'package': 'flutter/android/sdk/all/${{platform}}',
574-
'version': 'version:31v8'
574+
'version': 'version:32v1'
575575
}
576576
],
577577
'condition': 'download_android_deps',

shell/platform/android/io/flutter/embedding/android/FlutterView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ public View findViewByAccessibilityIdTraversal(int accessibilityId) {
10281028
* @param currentView The root view.
10291029
* @return A descendant of currentView or currentView itself.
10301030
*/
1031-
@SuppressLint("PrivateApi")
1031+
@SuppressLint("DiscouragedPrivateApi")
10321032
private View findViewByAccessibilityIdRootedAtCurrentView(int accessibilityId, View currentView) {
10331033
Method getAccessibilityViewIdMethod;
10341034
try {

shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
package io.flutter.embedding.engine.renderer;
66

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

shell/platform/android/io/flutter/plugin/localization/LocalizationPlugin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
package io.flutter.plugin.localization;
66

7+
import android.annotation.SuppressLint;
78
import android.content.Context;
89
import android.content.res.Configuration;
910
import android.content.res.Resources;
@@ -22,6 +23,7 @@ public class LocalizationPlugin {
2223
@NonNull private final LocalizationChannel localizationChannel;
2324
@NonNull private final Context context;
2425

26+
@SuppressLint("AppBundleLocaleChanges") // This is optionally turned on by apps.
2527
@VisibleForTesting
2628
final LocalizationChannel.LocalizationMessageHandler localizationMessageHandler =
2729
new LocalizationChannel.LocalizationMessageHandler() {

shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
package io.flutter.plugin.platform;
66

7+
import android.annotation.TargetApi;
78
import android.app.Activity;
89
import android.app.ActivityManager.TaskDescription;
910
import android.content.ClipData;
@@ -243,8 +244,7 @@ public void onSystemUiVisibilityChange(int visibility) {
243244
private void setSystemChromeEnabledSystemUIMode(PlatformChannel.SystemUiMode systemUiMode) {
244245
int enabledOverlays;
245246

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

366366
@SuppressWarnings("deprecation")
367+
@TargetApi(21)
367368
private void setSystemChromeSystemUIOverlayStyle(
368369
PlatformChannel.SystemChromeStyle systemChromeStyle) {
369370
Window window = activity.getWindow();

shell/platform/android/io/flutter/view/AccessibilityBridge.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2758,6 +2758,8 @@ private SpannableString createSpannableString(String string, List<StringAttribut
27582758
* @param eventOrigin the view in the embedded view's hierarchy that sent the event.
27592759
* @return True if the event was sent.
27602760
*/
2761+
// AccessibilityEvent has many irrelevant cases that would be confusing to list.
2762+
@SuppressLint("SwitchIntDef")
27612763
public boolean externalViewRequestSendAccessibilityEvent(
27622764
View embeddedView, View eventOrigin, AccessibilityEvent event) {
27632765
if (!accessibilityViewEmbedder.requestSendAccessibilityEvent(

shell/platform/android/io/flutter/view/AccessibilityViewEmbedder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ private static class ReflectionAccessors {
434434
private @Nullable final Field childNodeIdsField;
435435
private @Nullable final Method longArrayGetIndex;
436436

437-
@SuppressLint("PrivateApi")
437+
@SuppressLint("DiscouragedPrivateApi,PrivateApi")
438438
private ReflectionAccessors() {
439439
Method getSourceNodeId = null;
440440
Method getParentNodeId = null;

shell/platform/android/test_runner/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ println "AVAILABLE PROCESSORS: $availableProcessors"
3333
println "=========================================="
3434

3535
android {
36-
compileSdkVersion 31
36+
compileSdkVersion 32
3737

3838
defaultConfig {
3939
minSdkVersion 16

testing/android_background_image/android/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ android {
1616
// The others are irrelevant for a test application.
1717
disable 'UnpackedNativeCode','MissingApplicationIcon','GoogleAppIndexingApiWarning','GoogleAppIndexingWarning','GradleDependency','NewerVersionAvailable'
1818
}
19-
buildToolsVersion = '31.0.0'
20-
compileSdkVersion 31
19+
buildToolsVersion = '33.0.0-rc4'
20+
compileSdkVersion 32
2121
compileOptions {
2222
sourceCompatibility JavaVersion.VERSION_11
2323
targetCompatibility JavaVersion.VERSION_11
2424
}
2525
defaultConfig {
2626
applicationId 'dev.flutter.android_background_image'
2727
minSdkVersion 16
28-
targetSdkVersion 31
28+
targetSdkVersion 32
2929
versionCode 1
3030
versionName '1.0'
3131
}

testing/scenario_app/android/app/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ android {
1515
// The others are irrelevant for a test application.
1616
disable 'UnpackedNativeCode','MissingApplicationIcon','GoogleAppIndexingApiWarning','GoogleAppIndexingWarning','GradleDependency','NewerVersionAvailable','Registered'
1717
}
18-
buildToolsVersion = '31.0.0'
19-
compileSdkVersion 31
18+
buildToolsVersion = '33.0.0-rc4'
19+
compileSdkVersion 32
2020
compileOptions {
2121
sourceCompatibility JavaVersion.VERSION_11
2222
targetCompatibility JavaVersion.VERSION_11
2323
}
2424
defaultConfig {
2525
applicationId 'dev.flutter.scenarios'
2626
minSdkVersion 18
27-
targetSdkVersion 31
27+
targetSdkVersion 32
2828
versionCode 1
2929
versionName '1.0'
3030
testInstrumentationRunner 'dev.flutter.TestRunner'

tools/android_lint/baseline.xml

Lines changed: 20 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<issues format="4" by="lint 26.1.1">
2+
<issues format="6" by="lint 7.2.0" type="baseline" client="" dependencies="true" name="" variant="all" version="7.2.0">
33

44
<issue
55
id="InlinedApi"
@@ -8,7 +8,7 @@
88
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
99
<location
1010
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java"
11-
line="221"
11+
line="267"
1212
column="16"/>
1313
</issue>
1414

@@ -19,7 +19,7 @@
1919
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
2020
<location
2121
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java"
22-
line="225"
22+
line="271"
2323
column="16"/>
2424
</issue>
2525

@@ -30,58 +30,36 @@
3030
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
3131
<location
3232
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/systemchannels/PlatformChannel.java"
33-
line="229"
33+
line="275"
3434
column="16"/>
3535
</issue>
3636

37-
<issue
38-
id="InlinedApi"
39-
message="Field requires API level 21 (current min is 16): `android.view.HapticFeedbackConstants#CLOCK_TICK`"
40-
errorLine1=" view.performHapticFeedback(HapticFeedbackConstants.CLOCK_TICK);"
41-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
42-
<location
43-
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java"
44-
line="121"
45-
column="44"/>
46-
</issue>
47-
48-
<issue
49-
id="InlinedApi"
50-
message="Field requires API level 19 (current min is 16): `android.view.View#SYSTEM_UI_FLAG_IMMERSIVE_STICKY`"
51-
errorLine1=" enabledOverlays |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;"
52-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
53-
<location
54-
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java"
55-
line="154"
56-
column="32"/>
57-
</issue>
58-
5937
<issue
6038
id="InlinedApi"
6139
message="Field requires API level 17 (current min is 16): `android.view.View#LAYOUT_DIRECTION_LTR`"
62-
errorLine1=" return direction == View.LAYOUT_DIRECTION_LTR || direction == View.LAYOUT_DIRECTION_RTL;"
63-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
40+
errorLine1=" return direction == View.LAYOUT_DIRECTION_LTR || direction == View.LAYOUT_DIRECTION_RTL;"
41+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
6442
<location
6543
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java"
66-
line="370"
67-
column="29"/>
44+
line="661"
45+
column="25"/>
6846
</issue>
6947

7048
<issue
7149
id="InlinedApi"
7250
message="Field requires API level 17 (current min is 16): `android.view.View#LAYOUT_DIRECTION_RTL`"
73-
errorLine1=" return direction == View.LAYOUT_DIRECTION_LTR || direction == View.LAYOUT_DIRECTION_RTL;"
74-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
51+
errorLine1=" return direction == View.LAYOUT_DIRECTION_LTR || direction == View.LAYOUT_DIRECTION_RTL;"
52+
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
7553
<location
7654
file="../../../flutter/shell/platform/android/io/flutter/plugin/platform/PlatformViewsController.java"
77-
line="370"
78-
column="71"/>
55+
line="661"
56+
column="67"/>
7957
</issue>
8058

8159
<issue
8260
id="OldTargetApi"
8361
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."
84-
errorLine1=" &lt;uses-sdk android:minSdkVersion=&quot;16&quot; android:targetSdkVersion=&quot;21&quot; />"
62+
errorLine1=" &lt;uses-sdk android:minSdkVersion=&quot;16&quot; android:targetSdkVersion=&quot;31&quot; />"
8563
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
8664
<location
8765
file="../../../flutter/shell/platform/android/AndroidManifest.xml"
@@ -100,103 +78,26 @@
10078
column="82"/>
10179
</issue>
10280

103-
<issue
104-
id="UseSparseArrays"
105-
message="Use `new SparseArray&lt;SemanticsNode>(...)` instead for better performance"
106-
errorLine1=" private final Map&lt;Integer, SemanticsNode> flutterSemanticsTree = new HashMap&lt;>();"
107-
errorLine2=" ~~~~~~~~~~~~~~~">
108-
<location
109-
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
110-
line="130"
111-
column="70"/>
112-
</issue>
113-
114-
<issue
115-
id="UseSparseArrays"
116-
message="Use `new SparseArray&lt;CustomAccessibilityAction>(...)` instead for better performance"
117-
errorLine1=" private final Map&lt;Integer, CustomAccessibilityAction> customAccessibilityActions = new HashMap&lt;>();"
118-
errorLine2=" ~~~~~~~~~~~~~~~">
119-
<location
120-
file="../../../flutter/shell/platform/android/io/flutter/view/AccessibilityBridge.java"
121-
line="155"
122-
column="88"/>
123-
</issue>
124-
125-
<issue
126-
id="UseSparseArrays"
127-
message="Use `new SparseArray&lt;BinaryReply>(...)` instead for better performance"
128-
errorLine1=" this.pendingReplies = new HashMap&lt;>();"
129-
errorLine2=" ~~~~~~~~~~~~~~~">
130-
<location
131-
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/dart/DartMessenger.java"
132-
line="43"
133-
column="27"/>
134-
</issue>
135-
13681
<issue
13782
id="ClickableViewAccessibility"
13883
message="Custom view `FlutterView` overrides `onTouchEvent` but not `performClick`"
13984
errorLine1=" public boolean onTouchEvent(MotionEvent event) {"
14085
errorLine2=" ~~~~~~~~~~~~">
14186
<location
142-
file="../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java"
143-
line="367"
87+
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
88+
line="436"
14489
column="18"/>
14590
</issue>
14691

14792
<issue
14893
id="ClickableViewAccessibility"
14994
message="Custom view `FlutterView` overrides `onTouchEvent` but not `performClick`"
150-
errorLine1=" public boolean onTouchEvent(MotionEvent event) {"
151-
errorLine2=" ~~~~~~~~~~~~">
152-
<location
153-
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
154-
line="391"
155-
column="20"/>
156-
</issue>
157-
158-
<issue
159-
id="UseValueOf"
160-
message="Use `Boolean.valueOf(true)` instead"
161-
errorLine1=" messageContent.add(new Boolean(true));"
162-
errorLine2=" ~~~~~~~~~~~~~~~~~">
163-
<location
164-
file="../../../flutter/shell/platform/android/test/io/flutter/plugin/common/StandardMessageCodecTest.java"
165-
line="87"
166-
column="24"/>
167-
</issue>
168-
169-
<issue
170-
id="UseValueOf"
171-
message="Use `Boolean.valueOf(false)` instead"
172-
errorLine1=" messageContent.add(new Boolean(false));"
173-
errorLine2=" ~~~~~~~~~~~~~~~~~~">
174-
<location
175-
file="../../../flutter/shell/platform/android/test/io/flutter/plugin/common/StandardMessageCodecTest.java"
176-
line="88"
177-
column="24"/>
178-
</issue>
179-
180-
<issue
181-
id="Recycle"
182-
message="This `SurfaceTexture` should be freed up after use with `#release()`"
183-
errorLine1=" final SurfaceTexture surfaceTexture = new SurfaceTexture(0);"
184-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
185-
<location
186-
file="../../../flutter/shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java"
187-
line="97"
188-
column="43"/>
189-
</issue>
190-
191-
<issue
192-
id="Recycle"
193-
message="This `SurfaceTexture` should be freed up after use with `#release()`"
194-
errorLine1=" final SurfaceTexture surfaceTexture = new SurfaceTexture(0);"
195-
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
95+
errorLine1=" public boolean onTouchEvent(@NonNull MotionEvent event) {"
96+
errorLine2=" ~~~~~~~~~~~~">
19697
<location
197-
file="../../../flutter/shell/platform/android/io/flutter/view/FlutterView.java"
198-
line="876"
199-
column="43"/>
98+
file="../../../flutter/shell/platform/android/io/flutter/embedding/android/FlutterView.java"
99+
line="911"
100+
column="18"/>
200101
</issue>
201102

202103
</issues>

tools/android_lint/lint.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,13 @@
77
compatible all the way back to API 16. See
88
https://developer.android.com/studio/write/java8-support.html#supported_features -->
99
<ignore regexp="^Try-with-resources requires API level 19"/>
10-
</issue>
10+
</issue>
11+
<issue id="UnknownNullness" severity="ignore" />
12+
<issue id="SyntheticAccessor" severity="ignore" />
13+
<!-- Flutter provides custom splash screens as a feature -->
14+
<issue id="CustomSplashScreen" severity="ignore" />
15+
<!-- See https://github.com/flutter/flutter/issues/105061 -->
16+
<issue id="ScopedStorage" severity="ignore" />
17+
<!-- See https://github.com/flutter/flutter/issues/105067 -->
18+
<issue id="LambdaLast" severity="ignore" />
1119
</lint>

0 commit comments

Comments
 (0)