diff --git a/DEPS b/DEPS index 66f28f0690dfb..7be2540dbe42c 100644 --- a/DEPS +++ b/DEPS @@ -3356,11 +3356,11 @@ deps = { 'dep_type': 'cipd', }, - 'src/third_party/android_deps/libs/com_google_protobuf_protobuf_lite': { + 'src/third_party/android_deps/libs/com_google_protobuf_protobuf_javalite': { 'packages': [ { - 'package': 'chromium/third_party/android_deps/libs/com_google_protobuf_protobuf_lite', - 'version': 'version:3.0.1-cr0', + 'package': 'chromium/third_party/android_deps/libs/com_google_protobuf_protobuf_javalite', + 'version': 'version:3.12.2-cr0', }, ], 'condition': 'checkout_android', diff --git a/base/android/proguard/chromium_apk.flags b/base/android/proguard/chromium_apk.flags index 472a6c297eb9c..5d3c67617880f 100644 --- a/base/android/proguard/chromium_apk.flags +++ b/base/android/proguard/chromium_apk.flags @@ -98,3 +98,8 @@ public int getMinApkVersion(); public boolean requiresSignIn(); } + +# Protobuf java lite runtime uses reflection +-keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite { + ; +} diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni index 7056703c377fc..cbd77fe0c4300 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni @@ -4053,7 +4053,6 @@ if (enable_java_templates) { # Use the regular proto library to generate lite protos. _protoc_bin = "//third_party/android_protoc/protoc" _proto_runtime = "//third_party/android_deps:com_google_protobuf_protobuf_javalite_java" - _protoc_javalite_plugin_dir = "//third_party/protoc_javalite/" } _proto_path = invoker.proto_path _template_name = target_name @@ -4097,11 +4096,6 @@ if (enable_java_templates) { if (_generate_nano) { args += [ "--nano" ] - } else { - args += [ - "--protoc-javalite-plugin-dir", - rebase_path(_protoc_javalite_plugin_dir, root_build_dir), - ] } } diff --git a/build/protoc_java.py b/build/protoc_java.py index 62b012e2861c2..25ea118af21ec 100755 --- a/build/protoc_java.py +++ b/build/protoc_java.py @@ -37,8 +37,6 @@ def main(argv): parser.add_option("--stamp", help="File to touch on success.") parser.add_option("--nano", help="Use to generate nano protos.", action='store_true') - parser.add_option("--protoc-javalite-plugin-dir", - help="Path to protoc java lite plugin directory.") parser.add_option("--import-dir", action="append", default=[], help="Extra import directory for protos, can be repeated.") options, args = parser.parse_args(argv) @@ -59,21 +57,11 @@ def main(argv): 'store_unknown_fields=true'] out_arg = '--javanano_out=' + ','.join(generator_args) + ':' + temp_dir else: - out_arg = '--javalite_out=' + temp_dir - - custom_env = os.environ.copy() - if options.protoc_javalite_plugin_dir: - # If we are generating lite protos, then the lite plugin needs to be in - # the path when protoc is called. See - # https://github.com/protocolbuffers/protobuf/blob/master/java/lite.md - custom_env['PATH'] = '{}:{}'.format( - os.path.abspath(options.protoc_javalite_plugin_dir), - custom_env['PATH']) + out_arg = '--java_out=lite:' + temp_dir # Generate Java files using protoc. build_utils.CheckOutput( [options.protoc] + proto_path_args + [out_arg] + args, - env=custom_env, # protoc generates superfluous warnings about LITE_RUNTIME deprecation # even though we are using the new non-deprecated method. stderr_filter=lambda output: build_utils.FilterLines( diff --git a/chrome/android/expectations/monochrome_public_bundle.proguard_flags.expected b/chrome/android/expectations/monochrome_public_bundle.proguard_flags.expected index fa1ce3a01fe2a..57274b41bd42b 100644 --- a/chrome/android/expectations/monochrome_public_bundle.proguard_flags.expected +++ b/chrome/android/expectations/monochrome_public_bundle.proguard_flags.expected @@ -177,6 +177,11 @@ public boolean requiresSignIn(); } +# Protobuf java lite runtime uses reflection +-keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite { + ; +} + ################################################################################ # ../../base/android/proguard/chromium_code.flags ################################################################################ diff --git a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedStreamSurface.java b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedStreamSurface.java index 0377844070b05..cacfc4f60c04d 100644 --- a/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedStreamSurface.java +++ b/chrome/android/feed/core/java/src/org/chromium/chrome/browser/feed/v2/FeedStreamSurface.java @@ -40,10 +40,8 @@ import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.feed.proto.FeedUiProto.SharedState; import org.chromium.components.feed.proto.FeedUiProto.Slice; -import org.chromium.components.feed.proto.FeedUiProto.Slice.SliceDataCase; import org.chromium.components.feed.proto.FeedUiProto.StreamUpdate; import org.chromium.components.feed.proto.FeedUiProto.StreamUpdate.SliceUpdate; -import org.chromium.components.feed.proto.FeedUiProto.StreamUpdate.SliceUpdate.UpdateCase; import org.chromium.components.signin.base.CoreAccountInfo; import org.chromium.components.signin.identitymanager.ConsentLevel; import org.chromium.content_public.browser.LoadUrlParams; @@ -314,7 +312,7 @@ void onStreamUpdated(byte[] data) { newContentList.add(mContentManager.getContent(i)); } for (SliceUpdate sliceUpdate : streamUpdate.getUpdatedSlicesList()) { - if (sliceUpdate.getUpdateCase() == UpdateCase.SLICE) { + if (sliceUpdate.hasSlice()) { newContentList.add(createContentFromSlice(sliceUpdate.getSlice())); } else { String existingSliceId = sliceUpdate.getSliceId(); @@ -379,10 +377,10 @@ private void updateContentsInPlace( private FeedListContentManager.FeedContent createContentFromSlice(Slice slice) { String sliceId = slice.getSliceId(); - if (slice.getSliceDataCase() == SliceDataCase.XSURFACE_SLICE) { + if (slice.hasXsurfaceSlice()) { return new FeedListContentManager.ExternalViewContent( sliceId, slice.getXsurfaceSlice().getXsurfaceFrame().toByteArray()); - } else if (slice.getSliceDataCase() == SliceDataCase.LOADING_SPINNER_SLICE) { + } else if (slice.hasLoadingSpinnerSlice()) { return new FeedListContentManager.NativeViewContent(sliceId, R.layout.feed_spinner); } else { // TODO(jianli): Create native view for ZeroStateSlice. diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn index beb185023e112..895278aaab470 100644 --- a/third_party/android_deps/BUILD.gn +++ b/third_party/android_deps/BUILD.gn @@ -89,12 +89,6 @@ java_annotation_processor("dagger_processor") { deps = [ ":com_google_dagger_dagger_compiler_java" ] } -# Alias new java lite runtime to old javalite runtime name until -# crbug.com/1093059 is fixed and we go back to the latest runtime. -java_group("com_google_protobuf_protobuf_javalite_java") { - deps = [ ":com_google_protobuf_protobuf_lite_cr1_java" ] -} - # The section below is generated by running # `//tools/android/roll/android_deps/fetch_all.py` @@ -1404,9 +1398,10 @@ java_prebuilt("com_google_j2objc_j2objc_annotations_java") { } # This is generated, do not edit. Update BuildConfigGenerator.groovy instead. -java_prebuilt("com_google_protobuf_protobuf_lite_cr1_java") { - jar_path = "libs/com_google_protobuf_protobuf_lite/protobuf-lite-3.0.1.jar" - output_name = "com_google_protobuf_protobuf_lite" +java_prebuilt("com_google_protobuf_protobuf_javalite_java") { + jar_path = + "libs/com_google_protobuf_protobuf_javalite/protobuf-javalite-3.12.2.jar" + output_name = "com_google_protobuf_protobuf_javalite" supports_android = true } diff --git a/third_party/android_deps/additional_readme_paths.json b/third_party/android_deps/additional_readme_paths.json index 93b98cf14fae9..779878f53dc40 100644 --- a/third_party/android_deps/additional_readme_paths.json +++ b/third_party/android_deps/additional_readme_paths.json @@ -160,7 +160,7 @@ "libs/com_google_guava_listenablefuture", "libs/com_google_j2objc_j2objc_annotations", "libs/com_google_protobuf_protobuf_java", - "libs/com_google_protobuf_protobuf_lite", + "libs/com_google_protobuf_protobuf_javalite", "libs/com_googlecode_java_diff_utils_diffutils", "libs/com_squareup_javapoet", "libs/com_squareup_javawriter", diff --git a/third_party/android_deps/build.gradle b/third_party/android_deps/build.gradle index 5355c71819695..ab1a73d8b8c01 100644 --- a/third_party/android_deps/build.gradle +++ b/third_party/android_deps/build.gradle @@ -123,7 +123,7 @@ dependencies { compile "com.google.guava:failureaccess:1.0.1" compile "com.google.guava:listenablefuture:1.0" compile "com.google.j2objc:j2objc-annotations:1.1" - compile "com.google.protobuf:protobuf-lite:3.0.1" + compile "com.google.protobuf:protobuf-javalite:3.12.2" compile "javax.annotation:javax.annotation-api:1.3.2" compile "javax.annotation:jsr250-api:1.0" compile "javax.inject:javax.inject:1" diff --git a/third_party/android_deps/libs/com_google_protobuf_protobuf_lite/LICENSE b/third_party/android_deps/libs/com_google_protobuf_protobuf_lite/LICENSE deleted file mode 100644 index 19b305b00060a..0000000000000 --- a/third_party/android_deps/libs/com_google_protobuf_protobuf_lite/LICENSE +++ /dev/null @@ -1,32 +0,0 @@ -Copyright 2008 Google Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Code generated by the Protocol Buffer compiler is owned by the owner -of the input file used when generating it. This code is not -standalone and requires a support library to be linked with it. This -support library is itself covered by the above license. diff --git a/third_party/android_deps/libs/com_google_protobuf_protobuf_lite/OWNERS b/third_party/android_deps/libs/com_google_protobuf_protobuf_lite/OWNERS deleted file mode 100644 index 7b571d97ee54f..0000000000000 --- a/third_party/android_deps/libs/com_google_protobuf_protobuf_lite/OWNERS +++ /dev/null @@ -1 +0,0 @@ -file://third_party/android_deps/OWNERS \ No newline at end of file diff --git a/third_party/android_deps/libs/com_google_protobuf_protobuf_lite/README.chromium b/third_party/android_deps/libs/com_google_protobuf_protobuf_lite/README.chromium deleted file mode 100644 index 11d48fb2c8cc8..0000000000000 --- a/third_party/android_deps/libs/com_google_protobuf_protobuf_lite/README.chromium +++ /dev/null @@ -1,13 +0,0 @@ -Name: Protocol Buffers [Lite] -Short Name: protobuf-lite -URL: https://github.com/protocolbuffers/protobuf/blob/master/java/lite.md -Version: 3.0.1 -License: BSD -License File: LICENSE -Security Critical: yes - -Description: -A trimmed-down version of the Protocol Buffers library. - -Local Modifications: -No modifications. diff --git a/third_party/android_deps/libs/com_google_protobuf_protobuf_lite/cipd.yaml b/third_party/android_deps/libs/com_google_protobuf_protobuf_lite/cipd.yaml deleted file mode 100644 index 6e75f658e2509..0000000000000 --- a/third_party/android_deps/libs/com_google_protobuf_protobuf_lite/cipd.yaml +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2018 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. - -# To create CIPD package run the following command. -# cipd create --pkg-def cipd.yaml -tag version:3.0.1-cr0 -package: chromium/third_party/android_deps/libs/com_google_protobuf_protobuf_lite -description: "Protocol Buffers [Lite]" -data: -- file: protobuf-lite-3.0.1.jar