diff --git a/DEPS b/DEPS index ec654c17261917..52e0c653f36b7f 100644 --- a/DEPS +++ b/DEPS @@ -315,11 +315,11 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_build-tools_version # and whatever else without interference from each other. - 'android_sdk_build-tools_version': '8LZujEmLjSh0g3JciDA3cslSptxKs9HOa_iUPXkOeYQC', + 'android_sdk_build-tools_version': 'tRoD45SCi7UleQqSV7MrMQO1_e5P8ysphkCcj6z_cCQC', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_emulator_version # and whatever else without interference from each other. - 'android_sdk_emulator_version': 'A4EvXZUIuQho0QRDJopMUpgyp6NA3aiDQjGKPUKbowMC', + 'android_sdk_emulator_version': 'gMHhUuoQRKfxr-MBn3fNNXZtkAVXtOwMwT7kfx8jkIgC', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_extras_version # and whatever else without interference from each other. @@ -331,15 +331,15 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_platform-tools_version # and whatever else without interference from each other. - 'android_sdk_platform-tools_version': '8tF0AOj7Dwlv4j7_nfkhxWB0jzrvWWYjEIpirt8FIWYC', + 'android_sdk_platform-tools_version': 'qi_k82nm6j9nz4dQosOoqXew4_TFAy8rcGOHDLptx1sC', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_platforms_version # and whatever else without interference from each other. - 'android_sdk_platforms_version': 'YMUu9EHNZ__2Xcxl-KsaSf-dI5TMt_P62IseUVsxktMC', + 'android_sdk_platforms_version': 'lL3IGexKjYlwjO_1Ga-xwxgwbE_w-lmi2Zi1uOlWUIAC', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling android_sdk_sources_version # and whatever else without interference from each other. - 'android_sdk_sources_version': '4gxhM8E62bvZpQs7Q3d0DinQaW0RLCIefhXrQBFkNy8C', + 'android_sdk_sources_version': 'n7svc8KYah-i4s8zwkVa85SI3_H0WFOniP0mpwNdFO0C', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -788,8 +788,8 @@ deps = { 'src/third_party/android_system_sdk': { 'packages': [ { - 'package': 'chromium/third_party/android_system_sdk', - 'version': 'no8ss5nRg6uYDM08HboypuIQuix7bS1kVqRGyWmwP-YC', + 'package': 'chromium/third_party/android_system_sdk/public', + 'version': 'oSfDIvHlCa6W0gS79Q5OOfB9E4eBg3uAvi3BEDN21U0C', }, ], 'condition': 'checkout_android', @@ -837,7 +837,7 @@ deps = { 'src/third_party/android_sdk/public': { 'packages': [ { - 'package': 'chromium/third_party/android_sdk/public/build-tools/30.0.1', + 'package': 'chromium/third_party/android_sdk/public/build-tools/31.0.0', 'version': Var('android_sdk_build-tools_version'), }, { @@ -857,16 +857,16 @@ deps = { 'version': Var('android_sdk_platform-tools_version'), }, { - 'package': 'chromium/third_party/android_sdk/public/platforms/android-30', + 'package': 'chromium/third_party/android_sdk/public/platforms/android-31', 'version': Var('android_sdk_platforms_version'), }, { - 'package': 'chromium/third_party/android_sdk/public/sources/android-29', + 'package': 'chromium/third_party/android_sdk/public/sources/android-30', 'version': Var('android_sdk_sources_version'), }, { 'package': 'chromium/third_party/android_sdk/public/cmdline-tools', - 'version': 'V__2Ycej-H2-6AcXX5A3gi7sIk74SuN44PBm2uC_N1sC', + 'version': 'ZT3JmI6GMG4YVcZ1OtECRVMOLLJAWAdPbi-OclubJLMC', }, ], 'condition': 'checkout_android_native_support', diff --git a/android_webview/expectations/system_webview_bundle.AndroidManifest.expected b/android_webview/expectations/system_webview_bundle.AndroidManifest.expected index 81eb9adb5a40e7..ef8ad3493a7b54 100644 --- a/android_webview/expectations/system_webview_bundle.AndroidManifest.expected +++ b/android_webview/expectations/system_webview_bundle.AndroidManifest.expected @@ -2,8 +2,8 @@ # DIFF-ANCHOR: 0c3a615d # DIFF-ANCHOR: 28c960ba @@ -15,7 +15,7 @@ - + # DIFF-ANCHOR: 0c3a615d # DIFF-ANCHOR: 28c960ba @@ -15,7 +15,7 @@ - + = Build.VERSION_CODES.S) { CommandLine cl = CommandLine.getInstance(); cl.appendSwitch(AwSwitches.WEBVIEW_ENABLE_MODERN_COOKIE_SAME_SITE); } @@ -791,4 +791,9 @@ public static void setWebLayerRunningInSameProcess() { public PacProcessor getPacProcessor() { return GlueApiHelperForR.getPacProcessor(); } + + @Override + public PacProcessor createPacProcessor() { + return GlueApiHelperForR.createPacProcessor(); + } } diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProviderForS.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProviderForS.java new file mode 100644 index 00000000000000..cab3d4fbfeb686 --- /dev/null +++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProviderForS.java @@ -0,0 +1,15 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package com.android.webview.chromium; + +class WebViewChromiumFactoryProviderForS extends WebViewChromiumFactoryProvider { + public static WebViewChromiumFactoryProvider create(android.webkit.WebViewDelegate delegate) { + return new WebViewChromiumFactoryProviderForS(delegate); + } + + protected WebViewChromiumFactoryProviderForS(android.webkit.WebViewDelegate delegate) { + super(delegate); + } +} diff --git a/android_webview/java/src/org/chromium/android_webview/common/DeveloperModeUtils.java b/android_webview/java/src/org/chromium/android_webview/common/DeveloperModeUtils.java index 1a155821376745..eac1acd1303469 100644 --- a/android_webview/java/src/org/chromium/android_webview/common/DeveloperModeUtils.java +++ b/android_webview/java/src/org/chromium/android_webview/common/DeveloperModeUtils.java @@ -15,7 +15,6 @@ import androidx.annotation.RequiresApi; import org.chromium.android_webview.common.services.ServiceNames; -import org.chromium.base.BuildInfo; import org.chromium.base.ContextUtils; import java.util.HashMap; @@ -67,7 +66,7 @@ private static void startDeveloperUiService(String webViewPackageName) { try { context.startForegroundService(intent); } catch (IllegalStateException e) { - assert BuildInfo.isAtLeastS() + assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.S : "Unable to start DeveloperUiService, this is only expected on Android S"; } } diff --git a/android_webview/nonembedded/java/src/org/chromium/android_webview/services/DeveloperUiService.java b/android_webview/nonembedded/java/src/org/chromium/android_webview/services/DeveloperUiService.java index 4a33b84769ccd6..56a414b94576eb 100644 --- a/android_webview/nonembedded/java/src/org/chromium/android_webview/services/DeveloperUiService.java +++ b/android_webview/nonembedded/java/src/org/chromium/android_webview/services/DeveloperUiService.java @@ -28,7 +28,6 @@ import org.chromium.android_webview.common.FlagOverrideHelper; import org.chromium.android_webview.common.ProductionSupportedFlagList; import org.chromium.android_webview.common.services.IDeveloperUiService; -import org.chromium.base.BuildInfo; import org.chromium.base.CommandLine; import org.chromium.base.ContextUtils; import org.chromium.base.IntentUtils; @@ -92,7 +91,7 @@ public void setFlagOverrides(Map overriddenFlags) { try { enableDeveloperMode(); } catch (IllegalStateException e) { - assert BuildInfo.isAtLeastS() + assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.S : "Unable enable developer mode, this is only expected on Android S"; String msg = "Unable to create foreground service (client is likely in " + "background). Continuing as a background service."; diff --git a/base/android/java/src/org/chromium/base/BuildInfo.java b/base/android/java/src/org/chromium/base/BuildInfo.java index deca13f9177a7e..0fddbf249c90da 100644 --- a/base/android/java/src/org/chromium/base/BuildInfo.java +++ b/base/android/java/src/org/chromium/base/BuildInfo.java @@ -34,10 +34,6 @@ public class BuildInfo { private static PackageInfo sBrowserPackageInfo; private static boolean sInitialized; - // TODO(crbug.com/1192402): Replace this with Build.VERSION_CODES.S in the code once chromium - // import Android S SDK. - public static final int ANDROID_S_API_SDK_INT = 31; - /** Not a member variable to avoid creating the instance early (it is set early in start up). */ private static String sFirebaseAppId = ""; diff --git a/base/android/java/src/org/chromium/base/compat/ApiHelperForS.java b/base/android/java/src/org/chromium/base/compat/ApiHelperForS.java index ac77f313e692c7..13a01d62c280bf 100644 --- a/base/android/java/src/org/chromium/base/compat/ApiHelperForS.java +++ b/base/android/java/src/org/chromium/base/compat/ApiHelperForS.java @@ -9,27 +9,23 @@ import android.content.ClipData; import android.content.ClipDescription; import android.content.pm.PackageManager; +import android.os.Build; import android.os.Process; import android.view.textclassifier.TextLinks; import androidx.annotation.NonNull; import org.chromium.base.ApiCompatibilityUtils; -import org.chromium.base.BuildInfo; import org.chromium.base.ContextUtils; -import org.chromium.base.Log; import org.chromium.base.annotations.VerifiesOnS; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - /** * Utility class to use new APIs that were added in S (API level 31). These need to exist in a * separate class so that Android framework can successfully verify classes without * encountering the new APIs. */ @VerifiesOnS -@TargetApi(BuildInfo.ANDROID_S_API_SDK_INT) +@TargetApi(Build.VERSION_CODES.S) public final class ApiHelperForS { private static final String TAG = "ApiHelperForS"; @@ -39,13 +35,7 @@ private ApiHelperForS() {} * See {@link ClipDescription#isStyleText()}. */ public static boolean isStyleText(ClipDescription clipDescription) { - try { - Method isStyledTextMethod = ClipDescription.class.getDeclaredMethod("isStyledText"); - return (boolean) isStyledTextMethod.invoke(clipDescription); - } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { - Log.e(TAG, "Failed to invoke ClipDescription#isStyledText() ", e); - return false; - } + return clipDescription.isStyledText(); } /** @@ -53,28 +43,14 @@ public static boolean isStyleText(ClipDescription clipDescription) { */ public static float getConfidenceScore( ClipDescription clipDescription, @NonNull String entityType) { - try { - Method getConfidenceScoreMethod = - ClipDescription.class.getDeclaredMethod("getConfidenceScore", String.class); - return (float) getConfidenceScoreMethod.invoke(clipDescription, entityType); - } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException - | IllegalStateException e) { - Log.e(TAG, "Failed to invoke ClipDescription#getConfidenceScore() ", e); - return 0; - } + return clipDescription.getConfidenceScore(entityType); } /** * See {@link ClipData.Item#getTextLinks()}. */ public static TextLinks getTextLinks(ClipData.Item item) { - try { - Method getTextLinksMethod = ClipData.Item.class.getDeclaredMethod("getTextLinks"); - return (TextLinks) getTextLinksMethod.invoke(item); - } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { - Log.e(TAG, "Failed to invoke ClipData.Item#getTextLinks() ", e); - return null; - } + return item.getTextLinks(); } public static boolean hasBluetoothConnectPermission() { @@ -90,13 +66,6 @@ public static boolean hasBluetoothConnectPermission() { */ public static void setAutoEnterEnabled( PictureInPictureParams.Builder builder, boolean enabled) { - try { - Method setAutoEnterEnabledMethod = - PictureInPictureParams.Builder.class.getDeclaredMethod( - "setAutoEnterEnabled", boolean.class); - setAutoEnterEnabledMethod.invoke(builder, enabled); - } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { - Log.e(TAG, "Failed to invoke PictureInPictureParams.Builder#setAutoEnterEnabled() ", e); - } + builder.setAutoEnterEnabled(enabled); } } diff --git a/build/android/gyp/merge_manifest.py b/build/android/gyp/merge_manifest.py index 9d77aa5fe6bec4..d0a93a8c78f78f 100755 --- a/build/android/gyp/merge_manifest.py +++ b/build/android/gyp/merge_manifest.py @@ -26,8 +26,8 @@ 'guava-28.1-jre.jar'), os.path.join('external', 'kotlin-plugin-ij', 'Kotlin', 'kotlinc', 'lib', 'kotlin-stdlib.jar'), - os.path.join('external', 'com', 'google', 'code', 'gson', 'gson', '2.8.5', - 'gson-2.8.5.jar'), + os.path.join('external', 'com', 'google', 'code', 'gson', 'gson', '2.8.6', + 'gson-2.8.6.jar'), ] diff --git a/build/android/pylib/constants/__init__.py b/build/android/pylib/constants/__init__.py index b0c1574c0cbf8b..e87b8fe67d841b 100644 --- a/build/android/pylib/constants/__init__.py +++ b/build/android/pylib/constants/__init__.py @@ -115,7 +115,7 @@ SCREENSHOTS_DIR = os.path.join(DIR_SOURCE_ROOT, 'out_screenshots') -ANDROID_SDK_BUILD_TOOLS_VERSION = '30.0.1' +ANDROID_SDK_BUILD_TOOLS_VERSION = '31.0.0' ANDROID_SDK_ROOT = os.path.join(DIR_SOURCE_ROOT, 'third_party', 'android_sdk', 'public') ANDROID_SDK_TOOLS = os.path.join(ANDROID_SDK_ROOT, diff --git a/build/config/android/config.gni b/build/config/android/config.gni index 88fd0a32b7ae82..e7540e8be1e015 100644 --- a/build/config/android/config.gni +++ b/build/config/android/config.gni @@ -89,10 +89,10 @@ if (is_android || is_chromeos) { } public_android_sdk_root = "//third_party/android_sdk/public" - if (android_sdk_release == "r") { + if (android_sdk_release == "s") { default_android_sdk_root = public_android_sdk_root - default_android_sdk_version = "30" - default_android_sdk_build_tools_version = "30.0.1" + default_android_sdk_version = "31" + default_android_sdk_build_tools_version = "31.0.0" public_android_sdk = true } @@ -105,7 +105,7 @@ if (is_android || is_chromeos) { # Purposefully repeated so that downstream can change # default_android_sdk_root without changing lint version. default_lint_android_sdk_root = public_android_sdk_root - default_lint_android_sdk_version = 30 + default_lint_android_sdk_version = 31 } if (!defined(default_extras_android_sdk_root)) { diff --git a/build/config/android/sdk.gni b/build/config/android/sdk.gni index d2e67a7d4be22b..854717016714f3 100644 --- a/build/config/android/sdk.gni +++ b/build/config/android/sdk.gni @@ -4,7 +4,7 @@ # The default SDK release used by public builds. Value may differ in # internal builds. -default_android_sdk_release = "r" +default_android_sdk_release = "s" # SDK releases against which public builds are supported. -public_sdk_releases = [ "r" ] +public_sdk_releases = [ "s" ] diff --git a/chrome/android/expectations/lint-suppressions.xml b/chrome/android/expectations/lint-suppressions.xml index 57d9b134dbe5be..37462070671edf 100644 --- a/chrome/android/expectations/lint-suppressions.xml +++ b/chrome/android/expectations/lint-suppressions.xml @@ -65,7 +65,6 @@ https://chromium.googlesource.com/chromium/src/+/main/build/android/docs/lint.md - diff --git a/chrome/android/expectations/monochrome_public_bundle.AndroidManifest.expected b/chrome/android/expectations/monochrome_public_bundle.AndroidManifest.expected index 8eceb614263f8c..7953e2adeb1e18 100644 --- a/chrome/android/expectations/monochrome_public_bundle.AndroidManifest.expected +++ b/chrome/android/expectations/monochrome_public_bundle.AndroidManifest.expected @@ -2,8 +2,8 @@ @@ -59,14 +59,16 @@ - - + + + + - + @@ -59,14 +59,16 @@ - - + + + + - + + platformBuildVersionCode="31" + platformBuildVersionName="12"> - + - + diff --git a/ui/android/javatests/src/org/chromium/ui/base/ClipboardAndroidTest.java b/ui/android/javatests/src/org/chromium/ui/base/ClipboardAndroidTest.java index 5e2308eeec5e01..ed900f44424cd6 100644 --- a/ui/android/javatests/src/org/chromium/ui/base/ClipboardAndroidTest.java +++ b/ui/android/javatests/src/org/chromium/ui/base/ClipboardAndroidTest.java @@ -7,6 +7,7 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; +import android.os.Build; import android.text.SpannableString; import android.text.Spanned; import android.text.style.BackgroundColorSpan; @@ -18,7 +19,6 @@ import org.junit.Test; import org.junit.runner.RunWith; -import org.chromium.base.BuildInfo; import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.CallbackHelper; @@ -149,7 +149,7 @@ public void hasUrlAndGetUrlTest() { // Only first URL is returned on S+ if clipboard contains multiple URLs. @Test @SmallTest - @MinAndroidSdkLevel(BuildInfo.ANDROID_S_API_SDK_INT) + @MinAndroidSdkLevel(Build.VERSION_CODES.S) public void hasUrlAndGetUrlMixTextAndLinkTest() { TestThreadUtils.runOnUiThreadBlocking( () -> { Clipboard.getInstance().setText(MIX_TEXT_URL); }); @@ -163,7 +163,7 @@ public void hasUrlAndGetUrlMixTextAndLinkTest() { // Only first URL is returned on S+ if clipboard contains multiple URLs. @Test @SmallTest - @MinAndroidSdkLevel(BuildInfo.ANDROID_S_API_SDK_INT) + @MinAndroidSdkLevel(Build.VERSION_CODES.S) public void hasUrlAndGetUrlMixTextAndLinkWithoutProtocolTest() { TestThreadUtils.runOnUiThreadBlocking( () -> { Clipboard.getInstance().setText(MIX_TEXT_URL_NO_PROTOCOL); });