Skip to content

Commit

Permalink
[Re-land] Upgrade Android SDK to 34 "UpsideDownCake" (flutter#47839)
Browse files Browse the repository at this point in the history
The difference between this PR and the original is the change to the `AndroidManifest.xml`. For context, right before the original PR landed, [a change to upgrade the target sdk](flutter#47683) in the manifest from 31 to 33 landed. It also removed the lint complaining about using an old target sdk version from the baseline lint file. So this change upgrading the sdk, but not the target sdk in the manifest, triggered the lint again.

For the rest of the PR, [see the description of the original PR](flutter#47609).

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
  • Loading branch information
gmackall authored Nov 9, 2023
1 parent 145785a commit f2c6b50
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 78 deletions.
6 changes: 3 additions & 3 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ platform_properties:
# CIPD flutter/java/openjdk/$platform
dependencies: >-
[
{"dependency": "open_jdk", "version": "version:11"},
{"dependency": "open_jdk", "version": "version:17"},
{"dependency": "gradle_cache", "version": "none"}
]
device_type: none
Expand All @@ -49,7 +49,7 @@ platform_properties:
# CIPD flutter/java/openjdk/$platform
dependencies: >-
[
{"dependency": "open_jdk", "version": "version:11"}
{"dependency": "open_jdk", "version": "version:17"}
]
device_type: none
cpu: x86
Expand Down Expand Up @@ -79,7 +79,7 @@ platform_properties:
# CIPD flutter/java/openjdk/$platform
dependencies: >-
[
{"dependency": "open_jdk", "version": "version:11"}
{"dependency": "open_jdk", "version": "version:17"}
]
device_type: none
os: Windows-10
Expand Down
6 changes: 3 additions & 3 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ allowed_hosts = [
]

deps = {
'src': 'https://github.com/flutter/buildroot.git' + '@' + '5ced4367fee2721f6eda34802dc28b1335637c63',
'src': 'https://github.com/flutter/buildroot.git' + '@' + '44ca359ea6fada2fa1bb007b81994fa4dc8ce2ec',

'src/flutter/third_party/rapidjson':
Var('fuchsia_git') + '/third_party/rapidjson' + '@' + 'ef3564c5c8824989393b87df25355baf35ff544b',
Expand Down Expand Up @@ -766,7 +766,7 @@ deps = {
'packages': [
{
'package': 'flutter/android/sdk/all/${{platform}}',
'version': 'version:33v6'
'version': 'version:34v3'
}
],
'condition': 'download_android_deps',
Expand Down Expand Up @@ -798,7 +798,7 @@ deps = {
'packages': [
{
'package': 'flutter/java/openjdk/${{platform}}',
'version': 'version:11'
'version': 'version:17'
}
],
'condition': 'download_android_deps',
Expand Down
2 changes: 1 addition & 1 deletion shell/platform/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.flutter.app" android:versionCode="1" android:versionName="0.0.1">

<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="33" />
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="34" />
<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" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public FlutterView(@NonNull Context context, @NonNull RenderMode renderMode) {
renderSurface = flutterTextureView;
} else {
throw new IllegalArgumentException(
String.format("RenderMode not supported with this constructor: %s", renderMode));
"RenderMode not supported with this constructor: " + renderMode);
}

init();
Expand Down Expand Up @@ -327,7 +327,7 @@ public FlutterView(
renderSurface = flutterTextureView;
} else {
throw new IllegalArgumentException(
String.format("RenderMode not supported with this constructor: %s", renderMode));
"RenderMode not supported with this constructor: " + renderMode);
}

init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,17 +330,17 @@ public void installDeferredComponent(int loadingUnitId, @Nullable String compone
case SplitInstallErrorCode.NETWORK_ERROR:
flutterJNI.deferredComponentInstallFailure(
loadingUnitId,
String.format(
"Install of deferred component module \"%s\" failed with a network error",
componentName),
"Install of deferred component module \""
+ componentName
+ "\" failed with a network error",
true);
break;
case SplitInstallErrorCode.MODULE_UNAVAILABLE:
flutterJNI.deferredComponentInstallFailure(
loadingUnitId,
String.format(
"Install of deferred component module \"%s\" failed as it is unavailable",
componentName),
"Install of deferred component module \""
+ componentName
+ "\" failed as it is unavailable",
false);
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* EmbeddedView
*/
@Keep
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@TargetApi(Build.VERSION_CODES.KITKAT)
class SingleViewPresentation extends Presentation {
private static final String TAG = "PlatformViewsController";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ public void itReleaseEngineWhenOnDestroy() {
}

@Test
@Config(minSdk = Build.VERSION_CODES.JELLY_BEAN, maxSdk = Build.VERSION_CODES.P)
@Config(minSdk = Build.VERSION_CODES.KITKAT, maxSdk = Build.VERSION_CODES.P)
public void fullyDrawn_beforeAndroidQ() {
Intent intent = FlutterActivityWithReportFullyDrawn.createDefaultIntent(ctx);
ActivityController<FlutterActivityWithReportFullyDrawn> activityController =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public void computePlatformResolvedLocale_fromAndroidN() {
// Tests the legacy pre API 24 algorithm.
@Test
@Config(
minSdk = Build.VERSION_CODES.JELLY_BEAN,
minSdk = Build.VERSION_CODES.KITKAT,
maxSdk = Build.VERSION_CODES.M,
qualifiers = "es-rMX")
public void computePlatformResolvedLocale_emptySupportedLocales_beforeAndroidN() {
Expand All @@ -252,7 +252,7 @@ public void computePlatformResolvedLocale_emptySupportedLocales_beforeAndroidN()
}

@Test
@Config(minSdk = Build.VERSION_CODES.JELLY_BEAN, maxSdk = Build.VERSION_CODES.M, qualifiers = "")
@Config(minSdk = Build.VERSION_CODES.KITKAT, maxSdk = Build.VERSION_CODES.M, qualifiers = "")
public void computePlatformResolvedLocale_selectFirstLocaleWhenNoUserSetting_beforeAndroidN() {
FlutterJNI flutterJNI = new FlutterJNI();
DartExecutor dartExecutor = mock(DartExecutor.class);
Expand All @@ -273,7 +273,7 @@ public void computePlatformResolvedLocale_selectFirstLocaleWhenNoUserSetting_bef

@Test
@Config(
minSdk = Build.VERSION_CODES.JELLY_BEAN,
minSdk = Build.VERSION_CODES.KITKAT,
maxSdk = Build.VERSION_CODES.M,
qualifiers = "fr-rCH")
public void computePlatformResolvedLocale_selectFirstLocaleWhenNoExactMatch_beforeAndroidN() {
Expand All @@ -299,7 +299,7 @@ public void computePlatformResolvedLocale_selectFirstLocaleWhenNoExactMatch_befo

@Test
@Config(
minSdk = Build.VERSION_CODES.JELLY_BEAN,
minSdk = Build.VERSION_CODES.KITKAT,
maxSdk = Build.VERSION_CODES.M,
qualifiers = "it-rIT")
public void computePlatformResolvedLocale_selectExactMatchLocale_beforeAndroidN() {
Expand All @@ -325,7 +325,7 @@ public void computePlatformResolvedLocale_selectExactMatchLocale_beforeAndroidN(

@Test
@Config(
minSdk = Build.VERSION_CODES.JELLY_BEAN,
minSdk = Build.VERSION_CODES.KITKAT,
maxSdk = Build.VERSION_CODES.M,
qualifiers = "fr-rCH")
public void computePlatformResolvedLocale_selectOnlyLanguageLocale_beforeAndroidN() {
Expand All @@ -351,35 +351,35 @@ public void computePlatformResolvedLocale_selectOnlyLanguageLocale_beforeAndroid
}

// Tests the legacy pre API 21 algorithm.
@Config(sdk = 16)
@Config(sdk = Build.VERSION_CODES.KITKAT)
@Test
public void localeFromString_languageOnly() {
Locale locale = LocalizationPlugin.localeFromString("en");
assertEquals(locale, new Locale("en"));
}

@Config(sdk = 16)
@Config(sdk = Build.VERSION_CODES.KITKAT)
@Test
public void localeFromString_languageAndCountry() {
Locale locale = LocalizationPlugin.localeFromString("en-US");
assertEquals(locale, new Locale("en", "US"));
}

@Config(sdk = 16)
@Config(sdk = Build.VERSION_CODES.KITKAT)
@Test
public void localeFromString_languageCountryAndVariant() {
Locale locale = LocalizationPlugin.localeFromString("zh-Hans-CN");
assertEquals(locale, new Locale("zh", "CN", "Hans"));
}

@Config(sdk = 16)
@Config(sdk = Build.VERSION_CODES.KITKAT)
@Test
public void localeFromString_underscore() {
Locale locale = LocalizationPlugin.localeFromString("zh_Hans_CN");
assertEquals(locale, new Locale("zh", "CN", "Hans"));
}

@Config(sdk = 16)
@Config(sdk = Build.VERSION_CODES.KITKAT)
@Test
public void localeFromString_additionalVariantsAreIgnored() {
Locale locale = LocalizationPlugin.localeFromString("de-DE-u-co-phonebk");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
public class PlatformPluginTest {
private final Context ctx = ApplicationProvider.getApplicationContext();

@Config(sdk = 16)
@Config(sdk = Build.VERSION_CODES.KITKAT)
@Test
public void itIgnoresNewHapticEventsOnOldAndroidPlatforms() {
View fakeDecorView = mock(View.class);
Expand All @@ -70,7 +70,7 @@ public void itIgnoresNewHapticEventsOnOldAndroidPlatforms() {
platformPlugin.vibrateHapticFeedback(PlatformChannel.HapticFeedbackType.SELECTION_CLICK);
}

@Config(sdk = 29)
@Config(sdk = Build.VERSION_CODES.Q)
@Test
public void platformPlugin_getClipboardData() throws IOException {
ClipboardManager clipboardManager = ctx.getSystemService(ClipboardManager.class);
Expand Down Expand Up @@ -100,7 +100,7 @@ public void platformPlugin_getClipboardData() throws IOException {

@SuppressWarnings("deprecation")
// ClipboardManager.getText
@Config(sdk = 28)
@Config(sdk = Build.VERSION_CODES.P)
@Test
public void platformPlugin_hasStrings() {
ClipboardManager clipboardManager = spy(ctx.getSystemService(ClipboardManager.class));
Expand Down Expand Up @@ -154,7 +154,7 @@ public void platformPlugin_hasStrings() {
verify(clipboardManager, never()).getText();
}

@Config(sdk = 29)
@Config(sdk = Build.VERSION_CODES.Q)
@Test
public void setNavigationBarDividerColor() {
View fakeDecorView = mock(View.class);
Expand Down Expand Up @@ -229,7 +229,7 @@ public void setNavigationBarDividerColor() {
}
}

@Config(sdk = 30)
@Config(sdk = Build.VERSION_CODES.R)
@Test
public void setNavigationBarIconBrightness() {
if (Build.VERSION.SDK_INT >= 30) {
Expand Down Expand Up @@ -276,7 +276,7 @@ public void setNavigationBarIconBrightness() {
}
}

@Config(sdk = 30)
@Config(sdk = Build.VERSION_CODES.R)
@Test
public void setStatusBarIconBrightness() {
if (Build.VERSION.SDK_INT >= 30) {
Expand Down Expand Up @@ -323,7 +323,7 @@ public void setStatusBarIconBrightness() {

@SuppressWarnings("deprecation")
// SYSTEM_UI_FLAG_*, setSystemUiVisibility
@Config(sdk = 29)
@Config(sdk = Build.VERSION_CODES.Q)
@Test
public void setSystemUiMode() {
View fakeDecorView = mock(View.class);
Expand Down Expand Up @@ -440,7 +440,7 @@ public void setSystemUiModeListener_overlaysAreVisible() {

@SuppressWarnings("deprecation")
// SYSTEM_UI_FLAG_*, setSystemUiVisibility
@Config(sdk = 28)
@Config(sdk = Build.VERSION_CODES.P)
@Test
public void doNotEnableEdgeToEdgeOnOlderSdk() {
View fakeDecorView = mock(View.class);
Expand All @@ -462,7 +462,7 @@ public void doNotEnableEdgeToEdgeOnOlderSdk() {

@SuppressWarnings("deprecation")
// FLAG_TRANSLUCENT_STATUS, FLAG_TRANSLUCENT_NAVIGATION
@Config(sdk = 29)
@Config(sdk = Build.VERSION_CODES.Q)
@Test
public void verifyWindowFlagsSetToStyleOverlays() {
View fakeDecorView = mock(View.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

package io.flutter.plugin.platform;

import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
import static android.os.Build.VERSION_CODES.KITKAT;
import static android.os.Build.VERSION_CODES.P;
import static android.os.Build.VERSION_CODES.R;
import static org.junit.Assert.assertEquals;
Expand All @@ -28,7 +28,7 @@
@TargetApi(P)
public class SingleViewPresentationTest {
@Test
@Config(minSdk = JELLY_BEAN_MR1, maxSdk = R)
@Config(minSdk = KITKAT, maxSdk = R)
public void returnsOuterContextInputMethodManager() {
// There's a bug in Android Q caused by the IMM being instanced per display.
// https://github.com/flutter/flutter/issues/38375. We need the context returned by
Expand Down Expand Up @@ -59,7 +59,7 @@ public void returnsOuterContextInputMethodManager() {
}

@Test
@Config(minSdk = JELLY_BEAN_MR1, maxSdk = R)
@Config(minSdk = KITKAT, maxSdk = R)
public void returnsOuterContextInputMethodManager_createDisplayContext() {
// The IMM should also persist across display contexts created from the base context.

Expand Down
4 changes: 2 additions & 2 deletions shell/platform/android/test_runner/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ println "AVAILABLE PROCESSORS: $availableProcessors"
println "=========================================="

android {
compileSdkVersion 33
compileSdkVersion 34

defaultConfig {
minSdkVersion 16
minSdkVersion 19
}

compileOptions {
Expand Down
8 changes: 4 additions & 4 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 = '33.0.0'
compileSdkVersion 33
buildToolsVersion = '34.0.0'
compileSdkVersion 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
defaultConfig {
applicationId 'dev.flutter.android_background_image'
minSdkVersion 16
targetSdkVersion 33
minSdkVersion 19
targetSdkVersion 34
versionCode 1
versionName '1.0'
}
Expand Down
8 changes: 4 additions & 4 deletions testing/scenario_app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ android {
// The others are irrelevant for a test application.
disable 'UnpackedNativeCode','MissingApplicationIcon','GoogleAppIndexingApiWarning','GoogleAppIndexingWarning','GradleDependency','NewerVersionAvailable','Registered'
}
buildToolsVersion = '33.0.0'
compileSdkVersion 33
buildToolsVersion = '34.0.0'
compileSdkVersion 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
defaultConfig {
applicationId 'dev.flutter.scenarios'
minSdkVersion 18
targetSdkVersion 33
minSdkVersion 19
targetSdkVersion 34
versionCode 1
versionName '1.0'
testInstrumentationRunner 'dev.flutter.TestRunner'
Expand Down
Loading

0 comments on commit f2c6b50

Please sign in to comment.