diff --git a/CHANGELOG.md b/CHANGELOG.md index b202852d..b6c52bb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ -# 87.0.4280.67 +# 87.0.4280.68 +* user agent customization (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/798) +* fix for Qualcomm AImageReader crashes on A9 (fixes https://github.com/bromite/bromite/issues/814) * fix disable-scroll-to-text-fragment patch (fixes https://github.com/bromite/bromite/issues/803) +* fix for intent handling for local apps on Android 11 (https://github.com/bromite/bromite/pull/816) + +# 87.0.4280.67 # 86.0.4240.194 * fix native pages displaying incorrectly with the sticky desktop mode (thanks to @uazo) diff --git a/README.md b/README.md index 60b501e6..a3f1ea5e 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ ETH donations address: `0xf47ff39223d828f99fec5ab53bd068c5c0522042` * timezone customization * sticky desktop mode setting * disable video autoplay by default +* mobile/desktop user agent customization You can inspect all functionality/privacy changes by reading the [patches](https://github.com/bromite/bromite/tree/master/build/patches) and/or the [CHANGELOG](./CHANGELOG.md). diff --git a/build/RELEASE b/build/RELEASE index 6e346bab..35cf04a7 100644 --- a/build/RELEASE +++ b/build/RELEASE @@ -1 +1 @@ -87.0.4280.67 +87.0.4280.68 diff --git a/build/bromite_patches_list.txt b/build/bromite_patches_list.txt index 912c2bf2..25b64386 100644 --- a/build/bromite_patches_list.txt +++ b/build/bromite_patches_list.txt @@ -126,10 +126,7 @@ Disable-DRM-media-origin-IDs-preprovisioning.patch Disable-smart-selection-by-default.patch Enable-user-agent-freeze-by-default.patch disable-browser-autologin-by-default.patch -Revert-gpu-android-Remove-setup-for-disabling-AImageReader.patch -Revert-Remove-flags-to-enable-disable-AImageReader.patch -Disable-AImageReader-for-ARM64-P-and-ARM64-Q.patch -Restore-GPU-bug-blacklist-for-AImageReader-on-ARM-CPUs.patch +AImageReader-CFI-crash-mitigations.patch Update-i18n-zh_CN-support.patch Add-a-flag-to-allow-screenshots-in-Incognito-mode.patch Add-menu-item-to-view-source.patch @@ -148,8 +145,8 @@ Hardening-against-incognito-mode-detection.patch Remove-weblayer-dependency-on-Play-Services.patch Timezone-customization.patch Move-some-account-settings-back-to-privacy-settings.patch -Flag-for-always-desktop-mode.patch +User-agent-customization.patch Restore-Simplified-NTP-launch.patch Revert-the-removal-of-an-option-to-block-autoplay.patch +android-upstream-missed-manifest-changes-for-Q-R.patch Automated-domain-substitution.patch -Add-query-all-packages-permission-for-R.patch diff --git a/build/patches/AImageReader-CFI-crash-mitigations.patch b/build/patches/AImageReader-CFI-crash-mitigations.patch new file mode 100644 index 00000000..c703689e --- /dev/null +++ b/build/patches/AImageReader-CFI-crash-mitigations.patch @@ -0,0 +1,276 @@ +From: csagan5 <32685696+csagan5@users.noreply.github.com> +Date: Tue, 5 May 2020 07:22:20 +0200 +Subject: AImageReader CFI crash mitigations + +Revert "gpu/android: Remove setup for disabling AImageReader." +This reverts commit dcd5a39518246eb999f1cc63bf1ec95d93fd5b2f. + +Revert "Remove flags to enable/disable AImageReader." +This reverts commit 463fa0f2e3b9e418bc26e2c8954463f0b0f76634. + +Disable AImageReader for ARM64/P and ARM64/Q + +Restore GPU bug blacklist for AImageReader on ARM and Qualcomm CPUs + +Restore the AImageReader blacklist for ARM/ARM64/Qualcomm chipsets which causes +crashes on Android 9 and 10 (at different code locations). + +See discussions at: +* https://github.com/bromite/bromite/issues/445 +* https://github.com/bromite/bromite/issues/814 +--- + base/android/android_image_reader_compat.cc | 8 +++++- + base/android/android_image_reader_compat.h | 4 +++ + gpu/config/gpu_driver_bug_list.json | 32 +++++++++++++++++++++ + gpu/config/gpu_finch_features.cc | 8 ++++++ + gpu/config/gpu_finch_features.h | 1 + + gpu/config/gpu_util.cc | 8 ++++++ + gpu/config/gpu_workaround_list.txt | 1 + + gpu/ipc/service/gpu_init.cc | 11 +++++++ + gpu/ipc/service/stream_texture_android.cc | 11 ++++++- + media/base/media_switches.cc | 8 ++++++ + media/base/media_switches.h | 1 + + 11 files changed, 91 insertions(+), 2 deletions(-) + +diff --git a/base/android/android_image_reader_compat.cc b/base/android/android_image_reader_compat.cc +--- a/base/android/android_image_reader_compat.cc ++++ b/base/android/android_image_reader_compat.cc +@@ -23,6 +23,8 @@ + namespace base { + namespace android { + ++bool AndroidImageReader::disable_support_ = false; ++ + AndroidImageReader& AndroidImageReader::GetInstance() { + // C++11 static local variable initialization is + // thread-safe. +@@ -30,8 +32,12 @@ AndroidImageReader& AndroidImageReader::GetInstance() { + return *instance; + } + ++void AndroidImageReader::DisableSupport() { ++ disable_support_ = true; ++} ++ + bool AndroidImageReader::IsSupported() { +- return is_supported_; ++ return !disable_support_ && is_supported_; + } + + // static +diff --git a/base/android/android_image_reader_compat.h b/base/android/android_image_reader_compat.h +--- a/base/android/android_image_reader_compat.h ++++ b/base/android/android_image_reader_compat.h +@@ -22,6 +22,9 @@ class BASE_EXPORT AndroidImageReader { + // Thread safe GetInstance. + static AndroidImageReader& GetInstance(); + ++ // Disable image reader support. ++ static void DisableSupport(); ++ + // Check if the image reader usage is supported. This function returns TRUE + // if android version is >=OREO, image reader support is not disabled and all + // the required functions are loaded. +@@ -64,6 +67,7 @@ class BASE_EXPORT AndroidImageReader { + jobject ANativeWindow_toSurface(JNIEnv* env, ANativeWindow* window); + + private: ++ static bool disable_support_; + friend class base::NoDestructor; + + AndroidImageReader(); +diff --git a/gpu/config/gpu_driver_bug_list.json b/gpu/config/gpu_driver_bug_list.json +--- a/gpu/config/gpu_driver_bug_list.json ++++ b/gpu/config/gpu_driver_bug_list.json +@@ -3287,6 +3287,38 @@ + "dont_delete_source_texture_for_egl_image" + ] + }, ++ { ++ "id":335, ++ "cr_bugs": [1051705], ++ "description": "Disable AImageReader on ARM GPUs", ++ "os": { ++ "type": "android", ++ "version": { ++ "op": "<", ++ "value": "10" ++ } ++ }, ++ "gl_vendor": "ARM.*", ++ "features": [ ++ "disable_aimagereader" ++ ] ++ }, ++ { ++ "id":330, ++ "cr_bugs": [1051705], ++ "description": "Disable AImageReader on Qualcomm GPUs", ++ "os": { ++ "type": "android", ++ "version": { ++ "op": "<", ++ "value": "10" ++ } ++ }, ++ "gl_vendor": "Qualcomm.*", ++ "features": [ ++ "disable_aimagereader" ++ ] ++ }, + { + "id": 336, + "cr_bugs": [625785], +diff --git a/gpu/config/gpu_finch_features.cc b/gpu/config/gpu_finch_features.cc +--- a/gpu/config/gpu_finch_features.cc ++++ b/gpu/config/gpu_finch_features.cc +@@ -13,6 +13,14 @@ + + namespace features { + ++// Use android AImageReader when playing videos with MediaPlayer. ++const base::Feature kAImageReaderMediaPlayer{"AImageReaderMediaPlayer", ++#ifdef ARCH_CPU_ARM64 ++ base::FEATURE_DISABLED_BY_DEFAULT}; ++#else ++ base::FEATURE_ENABLED_BY_DEFAULT}; ++#endif ++ + #if defined(OS_ANDROID) + // Used to limit GL version to 2.0 for skia raster on Android. + const base::Feature kUseGles2ForOopR{"UseGles2ForOopR", +diff --git a/gpu/config/gpu_finch_features.h b/gpu/config/gpu_finch_features.h +--- a/gpu/config/gpu_finch_features.h ++++ b/gpu/config/gpu_finch_features.h +@@ -17,6 +17,7 @@ namespace features { + // All features in alphabetical order. The features should be documented + // alongside the definition of their values in the .cc file. + #if defined(OS_ANDROID) ++GPU_EXPORT extern const base::Feature kAImageReaderMediaPlayer; + GPU_EXPORT extern const base::Feature kUseGles2ForOopR; + GPU_EXPORT extern const base::Feature kAndroidSurfaceControl; + GPU_EXPORT extern const base::Feature kAImageReader; +diff --git a/gpu/config/gpu_util.cc b/gpu/config/gpu_util.cc +--- a/gpu/config/gpu_util.cc ++++ b/gpu/config/gpu_util.cc +@@ -111,6 +111,9 @@ GpuFeatureStatus GetAndroidSurfaceControlFeatureStatus( + #if !defined(OS_ANDROID) + return kGpuFeatureStatusDisabled; + #else ++ if (blocklisted_features.count(GPU_FEATURE_TYPE_ANDROID_SURFACE_CONTROL)) ++ return kGpuFeatureStatusBlocklisted; ++ + if (!gpu_preferences.enable_android_surface_control) + return kGpuFeatureStatusDisabled; + +@@ -374,6 +377,11 @@ void AdjustGpuFeatureStatusToWorkarounds(GpuFeatureInfo* gpu_feature_info) { + gpu_feature_info->status_values[GPU_FEATURE_TYPE_ACCELERATED_WEBGL2] = + kGpuFeatureStatusBlocklisted; + } ++ ++ if (gpu_feature_info->IsWorkaroundEnabled(DISABLE_AIMAGEREADER)) { ++ gpu_feature_info->status_values[GPU_FEATURE_TYPE_ANDROID_SURFACE_CONTROL] = ++ kGpuFeatureStatusBlocklisted; ++ } + } + + // Estimates roughly user total disk space by counting in the drives where +diff --git a/gpu/config/gpu_workaround_list.txt b/gpu/config/gpu_workaround_list.txt +--- a/gpu/config/gpu_workaround_list.txt ++++ b/gpu/config/gpu_workaround_list.txt +@@ -13,6 +13,7 @@ decode_encode_srgb_for_generatemipmap + depth_stencil_renderbuffer_resize_emulation + disable_2d_canvas_auto_flush + disable_accelerated_av1_decode ++disable_aimagereader + disable_accelerated_vp8_decode + disable_accelerated_vp8_encode + disable_accelerated_vp9_decode +diff --git a/gpu/ipc/service/gpu_init.cc b/gpu/ipc/service/gpu_init.cc +--- a/gpu/ipc/service/gpu_init.cc ++++ b/gpu/ipc/service/gpu_init.cc +@@ -727,6 +727,12 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, + AdjustInfoToSwiftShader(); + } + ++#if defined(OS_ANDROID) ++ // Disable AImageReader if the workaround is enabled. ++ if (gpu_feature_info_.IsWorkaroundEnabled(DISABLE_AIMAGEREADER)) { ++ base::android::AndroidImageReader::DisableSupport(); ++ } ++#endif + #if defined(USE_OZONE) + if (features::IsUsingOzonePlatform()) { + const std::vector +@@ -746,6 +752,11 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, + gl::DirectCompositionSurfaceWin::DisableDecodeSwapChain(); + #endif + ++ // Disable AImageReader if the workaround is enabled. ++ if (gpu_feature_info_.IsWorkaroundEnabled(DISABLE_AIMAGEREADER)) { ++ base::android::AndroidImageReader::DisableSupport(); ++ } ++ + UMA_HISTOGRAM_ENUMERATION("GPU.GLImplementation", gl::GetGLImplementation()); + } + #endif // OS_ANDROID +diff --git a/gpu/ipc/service/stream_texture_android.cc b/gpu/ipc/service/stream_texture_android.cc +--- a/gpu/ipc/service/stream_texture_android.cc ++++ b/gpu/ipc/service/stream_texture_android.cc +@@ -6,6 +6,7 @@ + + #include + ++#include "base/android/android_image_reader_compat.h" + #include "base/android/scoped_hardware_buffer_fence_sync.h" + #include "base/bind.h" + #include "base/feature_list.h" +@@ -47,7 +48,15 @@ std::unique_ptr MakeCurrent( + } + + TextureOwner::Mode GetTextureOwnerMode() { +- return features::IsAImageReaderEnabled() ++ const bool a_image_reader_supported = ++ base::android::AndroidImageReader::GetInstance().IsSupported(); ++ ++ // TODO(vikassoni) : Currently we have 2 different flags to enable/disable ++ // AImageReader - one for MCVD and other for MediaPlayer here. Merge those 2 ++ // flags into a single flag. Keeping the 2 flags separate for now since finch ++ // experiment using this flag is in progress. ++ return a_image_reader_supported && features::IsAImageReaderEnabled() && ++ base::FeatureList::IsEnabled(features::kAImageReaderMediaPlayer) + ? TextureOwner::Mode::kAImageReaderInsecure + : TextureOwner::Mode::kSurfaceTextureInsecure; + } +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -566,6 +566,14 @@ const base::Feature kMediaDrmPreprovisioning{"MediaDrmPreprovisioning", + const base::Feature kMediaDrmPreprovisioningAtStartup{ + "MediaDrmPreprovisioningAtStartup", base::FEATURE_ENABLED_BY_DEFAULT}; + ++// Enables the Android Image Reader path for Video decoding(for AVDA and MCVD) ++const base::Feature kAImageReaderVideoOutput{"AImageReaderVideoOutput", ++#ifdef ARCH_CPU_ARM64 ++ base::FEATURE_DISABLED_BY_DEFAULT}; ++#else ++ base::FEATURE_ENABLED_BY_DEFAULT}; ++#endif ++ + // Prevents using SurfaceLayer for videos. This is meant to be used by embedders + // that cannot support SurfaceLayer at the moment. + const base::Feature kDisableSurfaceLayerForVideo{ +diff --git a/media/base/media_switches.h b/media/base/media_switches.h +--- a/media/base/media_switches.h ++++ b/media/base/media_switches.h +@@ -198,6 +198,7 @@ MEDIA_EXPORT extern const base::Feature kMediaControlsExpandGesture; + MEDIA_EXPORT extern const base::Feature kMediaDrmPersistentLicense; + MEDIA_EXPORT extern const base::Feature kMediaDrmPreprovisioning; + MEDIA_EXPORT extern const base::Feature kMediaDrmPreprovisioningAtStartup; ++MEDIA_EXPORT extern const base::Feature kAImageReaderVideoOutput; + MEDIA_EXPORT extern const base::Feature kDisableSurfaceLayerForVideo; + MEDIA_EXPORT extern const base::Feature kCanPlayHls; + MEDIA_EXPORT extern const base::Feature kPictureInPictureAPI; +-- +2.17.1 + diff --git a/build/patches/Add-query-all-packages-permission-for-R.patch b/build/patches/Add-query-all-packages-permission-for-R.patch deleted file mode 100644 index 1e9ad78c..00000000 --- a/build/patches/Add-query-all-packages-permission-for-R.patch +++ /dev/null @@ -1,16 +0,0 @@ -From: nikolowry -Date: Fri, 20 Nov 2020 19:47:14 -0500 -Subject: Intent handling fix for local apps on Android 11 - ---- - chrome/android/java/AndroidManifest.xml | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml ---- a/chrome/android/java/AndroidManifest.xml -+++ b/chrome/android/java/AndroidManifest.xml -@@ -54,3 +54,4 @@ by a child template that "extends" this file. - - -+ - diff --git a/build/patches/Disable-AImageReader-for-ARM64-P-and-ARM64-Q.patch b/build/patches/Disable-AImageReader-for-ARM64-P-and-ARM64-Q.patch deleted file mode 100644 index 6b9da6da..00000000 --- a/build/patches/Disable-AImageReader-for-ARM64-P-and-ARM64-Q.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: csagan5 <32685696+csagan5@users.noreply.github.com> -Date: Thu, 20 Feb 2020 22:44:06 +0100 -Subject: Disable AImageReader for ARM64/P and ARM64/Q - ---- - gpu/config/gpu_finch_features.cc | 4 ++++ - media/base/media_switches.cc | 4 ++++ - 2 files changed, 8 insertions(+) - -diff --git a/gpu/config/gpu_finch_features.cc b/gpu/config/gpu_finch_features.cc ---- a/gpu/config/gpu_finch_features.cc -+++ b/gpu/config/gpu_finch_features.cc -@@ -15,7 +15,11 @@ namespace features { - - // Use android AImageReader when playing videos with MediaPlayer. - const base::Feature kAImageReaderMediaPlayer{"AImageReaderMediaPlayer", -+#ifdef ARCH_CPU_ARM64 -+ base::FEATURE_DISABLED_BY_DEFAULT}; -+#else - base::FEATURE_ENABLED_BY_DEFAULT}; -+#endif - - #if defined(OS_ANDROID) - // Used to limit GL version to 2.0 for skia raster on Android. -diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc ---- a/media/base/media_switches.cc -+++ b/media/base/media_switches.cc -@@ -568,7 +568,11 @@ const base::Feature kMediaDrmPreprovisioningAtStartup{ - - // Enables the Android Image Reader path for Video decoding(for AVDA and MCVD) - const base::Feature kAImageReaderVideoOutput{"AImageReaderVideoOutput", -+#ifdef ARCH_CPU_ARM64 -+ base::FEATURE_DISABLED_BY_DEFAULT}; -+#else - base::FEATURE_ENABLED_BY_DEFAULT}; -+#endif - - // Prevents using SurfaceLayer for videos. This is meant to be used by embedders - // that cannot support SurfaceLayer at the moment. --- -2.17.1 - diff --git a/build/patches/Disable-scroll-to-text-fragment.patch b/build/patches/Disable-scroll-to-text-fragment.patch index 956736b0..821111c9 100644 --- a/build/patches/Disable-scroll-to-text-fragment.patch +++ b/build/patches/Disable-scroll-to-text-fragment.patch @@ -9,7 +9,8 @@ Subject: Disable scroll-to-text-fragment content/child/runtime_features.cc | 4 ++-- content/public/common/content_switches.cc | 4 ++-- content/public/common/content_switches.h | 2 +- - 6 files changed, 9 insertions(+), 9 deletions(-) + third_party/blink/common/features.cc | 2 +- + 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc --- a/chrome/browser/chrome_content_browser_client.cc @@ -89,6 +90,18 @@ diff --git a/content/public/common/content_switches.h b/content/public/common/co CONTENT_EXPORT extern const char kWebXrForceRuntime[]; CONTENT_EXPORT extern const char kWebXrRuntimeNone[]; +diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc +--- a/third_party/blink/common/features.cc ++++ b/third_party/blink/common/features.cc +@@ -286,7 +286,7 @@ const base::Feature kStorageAccessAPI{"StorageAccessAPI", + + // Enable text snippets in URL fragments. https://crbug.com/919204. + const base::Feature kTextFragmentAnchor{"TextFragmentAnchor", +- base::FEATURE_ENABLED_BY_DEFAULT}; ++ base::FEATURE_DISABLED_BY_DEFAULT}; + + // File handling integration. https://crbug.com/829689 + const base::Feature kFileHandlingAPI{"FileHandlingAPI", -- 2.17.1 diff --git a/build/patches/Restore-GPU-bug-blacklist-for-AImageReader-on-ARM-CPUs.patch b/build/patches/Restore-GPU-bug-blacklist-for-AImageReader-on-ARM-CPUs.patch deleted file mode 100644 index 9ee3e414..00000000 --- a/build/patches/Restore-GPU-bug-blacklist-for-AImageReader-on-ARM-CPUs.patch +++ /dev/null @@ -1,41 +0,0 @@ -From: csagan5 <32685696+csagan5@users.noreply.github.com> -Date: Sat, 15 Feb 2020 08:20:40 +0100 -Subject: Restore GPU bug blacklist for AImageReader on ARM CPUs - -Restore the AImageReader blacklist for ARM/ARM64 devices which causes -crashes on Android 9 and 10 (at different code locations). - -See discussion at https://github.com/bromite/bromite/issues/445 ---- - gpu/config/gpu_driver_bug_list.json | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) - -diff --git a/gpu/config/gpu_driver_bug_list.json b/gpu/config/gpu_driver_bug_list.json ---- a/gpu/config/gpu_driver_bug_list.json -+++ b/gpu/config/gpu_driver_bug_list.json -@@ -3287,6 +3287,22 @@ - "dont_delete_source_texture_for_egl_image" - ] - }, -+ { -+ "id":335, -+ "cr_bugs": [1051705], -+ "description": "Disable AImageReader on ARM GPUs", -+ "os": { -+ "type": "android", -+ "version": { -+ "op": "<", -+ "value": "10" -+ } -+ }, -+ "gl_vendor": "ARM.*", -+ "features": [ -+ "disable_aimagereader" -+ ] -+ }, - { - "id": 336, - "cr_bugs": [625785], --- -2.17.1 - diff --git a/build/patches/Revert-Remove-flags-to-enable-disable-AImageReader.patch b/build/patches/Revert-Remove-flags-to-enable-disable-AImageReader.patch deleted file mode 100644 index 2016d7ef..00000000 --- a/build/patches/Revert-Remove-flags-to-enable-disable-AImageReader.patch +++ /dev/null @@ -1,94 +0,0 @@ -From: csagan5 <32685696+csagan5@users.noreply.github.com> -Date: Tue, 5 May 2020 07:26:55 +0200 -Subject: Revert "Remove flags to enable/disable AImageReader." - -This reverts commit 463fa0f2e3b9e418bc26e2c8954463f0b0f76634. ---- - gpu/config/gpu_finch_features.cc | 4 ++++ - gpu/config/gpu_finch_features.h | 1 + - gpu/ipc/service/stream_texture_android.cc | 11 ++++++++++- - media/base/media_switches.cc | 4 ++++ - media/base/media_switches.h | 1 + - 5 files changed, 20 insertions(+), 1 deletion(-) - -diff --git a/gpu/config/gpu_finch_features.cc b/gpu/config/gpu_finch_features.cc ---- a/gpu/config/gpu_finch_features.cc -+++ b/gpu/config/gpu_finch_features.cc -@@ -13,6 +13,10 @@ - - namespace features { - -+// Use android AImageReader when playing videos with MediaPlayer. -+const base::Feature kAImageReaderMediaPlayer{"AImageReaderMediaPlayer", -+ base::FEATURE_ENABLED_BY_DEFAULT}; -+ - #if defined(OS_ANDROID) - // Used to limit GL version to 2.0 for skia raster on Android. - const base::Feature kUseGles2ForOopR{"UseGles2ForOopR", -diff --git a/gpu/config/gpu_finch_features.h b/gpu/config/gpu_finch_features.h ---- a/gpu/config/gpu_finch_features.h -+++ b/gpu/config/gpu_finch_features.h -@@ -17,6 +17,7 @@ namespace features { - // All features in alphabetical order. The features should be documented - // alongside the definition of their values in the .cc file. - #if defined(OS_ANDROID) -+GPU_EXPORT extern const base::Feature kAImageReaderMediaPlayer; - GPU_EXPORT extern const base::Feature kUseGles2ForOopR; - GPU_EXPORT extern const base::Feature kAndroidSurfaceControl; - GPU_EXPORT extern const base::Feature kAImageReader; -diff --git a/gpu/ipc/service/stream_texture_android.cc b/gpu/ipc/service/stream_texture_android.cc ---- a/gpu/ipc/service/stream_texture_android.cc -+++ b/gpu/ipc/service/stream_texture_android.cc -@@ -6,6 +6,7 @@ - - #include - -+#include "base/android/android_image_reader_compat.h" - #include "base/android/scoped_hardware_buffer_fence_sync.h" - #include "base/bind.h" - #include "base/feature_list.h" -@@ -47,7 +48,15 @@ std::unique_ptr MakeCurrent( - } - - TextureOwner::Mode GetTextureOwnerMode() { -- return features::IsAImageReaderEnabled() -+ const bool a_image_reader_supported = -+ base::android::AndroidImageReader::GetInstance().IsSupported(); -+ -+ // TODO(vikassoni) : Currently we have 2 different flags to enable/disable -+ // AImageReader - one for MCVD and other for MediaPlayer here. Merge those 2 -+ // flags into a single flag. Keeping the 2 flags separate for now since finch -+ // experiment using this flag is in progress. -+ return a_image_reader_supported && features::IsAImageReaderEnabled() && -+ base::FeatureList::IsEnabled(features::kAImageReaderMediaPlayer) - ? TextureOwner::Mode::kAImageReaderInsecure - : TextureOwner::Mode::kSurfaceTextureInsecure; - } -diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc ---- a/media/base/media_switches.cc -+++ b/media/base/media_switches.cc -@@ -566,6 +566,10 @@ const base::Feature kMediaDrmPreprovisioning{"MediaDrmPreprovisioning", - const base::Feature kMediaDrmPreprovisioningAtStartup{ - "MediaDrmPreprovisioningAtStartup", base::FEATURE_ENABLED_BY_DEFAULT}; - -+// Enables the Android Image Reader path for Video decoding(for AVDA and MCVD) -+const base::Feature kAImageReaderVideoOutput{"AImageReaderVideoOutput", -+ base::FEATURE_ENABLED_BY_DEFAULT}; -+ - // Prevents using SurfaceLayer for videos. This is meant to be used by embedders - // that cannot support SurfaceLayer at the moment. - const base::Feature kDisableSurfaceLayerForVideo{ -diff --git a/media/base/media_switches.h b/media/base/media_switches.h ---- a/media/base/media_switches.h -+++ b/media/base/media_switches.h -@@ -198,6 +198,7 @@ MEDIA_EXPORT extern const base::Feature kMediaControlsExpandGesture; - MEDIA_EXPORT extern const base::Feature kMediaDrmPersistentLicense; - MEDIA_EXPORT extern const base::Feature kMediaDrmPreprovisioning; - MEDIA_EXPORT extern const base::Feature kMediaDrmPreprovisioningAtStartup; -+MEDIA_EXPORT extern const base::Feature kAImageReaderVideoOutput; - MEDIA_EXPORT extern const base::Feature kDisableSurfaceLayerForVideo; - MEDIA_EXPORT extern const base::Feature kCanPlayHls; - MEDIA_EXPORT extern const base::Feature kPictureInPictureAPI; --- -2.17.1 - diff --git a/build/patches/Revert-gpu-android-Remove-setup-for-disabling-AImageReader.patch b/build/patches/Revert-gpu-android-Remove-setup-for-disabling-AImageReader.patch deleted file mode 100644 index 9905a832..00000000 --- a/build/patches/Revert-gpu-android-Remove-setup-for-disabling-AImageReader.patch +++ /dev/null @@ -1,127 +0,0 @@ -From: csagan5 <32685696+csagan5@users.noreply.github.com> -Date: Tue, 5 May 2020 07:22:20 +0200 -Subject: Revert "gpu/android: Remove setup for disabling AImageReader." - -This reverts commit dcd5a39518246eb999f1cc63bf1ec95d93fd5b2f. ---- - base/android/android_image_reader_compat.cc | 8 +++++++- - base/android/android_image_reader_compat.h | 4 ++++ - gpu/config/gpu_util.cc | 8 ++++++++ - gpu/config/gpu_workaround_list.txt | 1 + - gpu/ipc/service/gpu_init.cc | 11 +++++++++++ - 5 files changed, 31 insertions(+), 1 deletion(-) - -diff --git a/base/android/android_image_reader_compat.cc b/base/android/android_image_reader_compat.cc ---- a/base/android/android_image_reader_compat.cc -+++ b/base/android/android_image_reader_compat.cc -@@ -23,6 +23,8 @@ - namespace base { - namespace android { - -+bool AndroidImageReader::disable_support_ = false; -+ - AndroidImageReader& AndroidImageReader::GetInstance() { - // C++11 static local variable initialization is - // thread-safe. -@@ -30,8 +32,12 @@ AndroidImageReader& AndroidImageReader::GetInstance() { - return *instance; - } - -+void AndroidImageReader::DisableSupport() { -+ disable_support_ = true; -+} -+ - bool AndroidImageReader::IsSupported() { -- return is_supported_; -+ return !disable_support_ && is_supported_; - } - - // static -diff --git a/base/android/android_image_reader_compat.h b/base/android/android_image_reader_compat.h ---- a/base/android/android_image_reader_compat.h -+++ b/base/android/android_image_reader_compat.h -@@ -22,6 +22,9 @@ class BASE_EXPORT AndroidImageReader { - // Thread safe GetInstance. - static AndroidImageReader& GetInstance(); - -+ // Disable image reader support. -+ static void DisableSupport(); -+ - // Check if the image reader usage is supported. This function returns TRUE - // if android version is >=OREO, image reader support is not disabled and all - // the required functions are loaded. -@@ -64,6 +67,7 @@ class BASE_EXPORT AndroidImageReader { - jobject ANativeWindow_toSurface(JNIEnv* env, ANativeWindow* window); - - private: -+ static bool disable_support_; - friend class base::NoDestructor; - - AndroidImageReader(); -diff --git a/gpu/config/gpu_util.cc b/gpu/config/gpu_util.cc ---- a/gpu/config/gpu_util.cc -+++ b/gpu/config/gpu_util.cc -@@ -111,6 +111,9 @@ GpuFeatureStatus GetAndroidSurfaceControlFeatureStatus( - #if !defined(OS_ANDROID) - return kGpuFeatureStatusDisabled; - #else -+ if (blocklisted_features.count(GPU_FEATURE_TYPE_ANDROID_SURFACE_CONTROL)) -+ return kGpuFeatureStatusBlocklisted; -+ - if (!gpu_preferences.enable_android_surface_control) - return kGpuFeatureStatusDisabled; - -@@ -374,6 +377,11 @@ void AdjustGpuFeatureStatusToWorkarounds(GpuFeatureInfo* gpu_feature_info) { - gpu_feature_info->status_values[GPU_FEATURE_TYPE_ACCELERATED_WEBGL2] = - kGpuFeatureStatusBlocklisted; - } -+ -+ if (gpu_feature_info->IsWorkaroundEnabled(DISABLE_AIMAGEREADER)) { -+ gpu_feature_info->status_values[GPU_FEATURE_TYPE_ANDROID_SURFACE_CONTROL] = -+ kGpuFeatureStatusBlocklisted; -+ } - } - - // Estimates roughly user total disk space by counting in the drives where -diff --git a/gpu/config/gpu_workaround_list.txt b/gpu/config/gpu_workaround_list.txt ---- a/gpu/config/gpu_workaround_list.txt -+++ b/gpu/config/gpu_workaround_list.txt -@@ -13,6 +13,7 @@ decode_encode_srgb_for_generatemipmap - depth_stencil_renderbuffer_resize_emulation - disable_2d_canvas_auto_flush - disable_accelerated_av1_decode -+disable_aimagereader - disable_accelerated_vp8_decode - disable_accelerated_vp8_encode - disable_accelerated_vp9_decode -diff --git a/gpu/ipc/service/gpu_init.cc b/gpu/ipc/service/gpu_init.cc ---- a/gpu/ipc/service/gpu_init.cc -+++ b/gpu/ipc/service/gpu_init.cc -@@ -727,6 +727,12 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, - AdjustInfoToSwiftShader(); - } - -+#if defined(OS_ANDROID) -+ // Disable AImageReader if the workaround is enabled. -+ if (gpu_feature_info_.IsWorkaroundEnabled(DISABLE_AIMAGEREADER)) { -+ base::android::AndroidImageReader::DisableSupport(); -+ } -+#endif - #if defined(USE_OZONE) - if (features::IsUsingOzonePlatform()) { - const std::vector -@@ -746,6 +752,11 @@ void GpuInit::InitializeInProcess(base::CommandLine* command_line, - gl::DirectCompositionSurfaceWin::DisableDecodeSwapChain(); - #endif - -+ // Disable AImageReader if the workaround is enabled. -+ if (gpu_feature_info_.IsWorkaroundEnabled(DISABLE_AIMAGEREADER)) { -+ base::android::AndroidImageReader::DisableSupport(); -+ } -+ - UMA_HISTOGRAM_ENUMERATION("GPU.GLImplementation", gl::GetGLImplementation()); - } - #endif // OS_ANDROID --- -2.17.1 - diff --git a/build/patches/Flag-for-always-desktop-mode.patch b/build/patches/User-agent-customization.patch similarity index 97% rename from build/patches/Flag-for-always-desktop-mode.patch rename to build/patches/User-agent-customization.patch index fbbb1fcc..9a69f717 100644 --- a/build/patches/Flag-for-always-desktop-mode.patch +++ b/build/patches/User-agent-customization.patch @@ -1,7 +1,11 @@ From: uazo Date: Mon, 26 Oct 2020 16:50:15 +0000 -Subject: Add flag to always view the desktop site for all websites +Subject: User agent customization +Add flag to always view the desktop site for all websites +Add possibility to define a custom User agent for mobile and desktop mode. +Add possibility to reactivate the metatag view for desktop mode, allowing users to choose +to use the flag in the hamburger menu to navigate with a custom useragent leaving the standard navigation unchanged. --- base/base_switches.cc | 2 + base/base_switches.h | 2 + @@ -10,10 +14,10 @@ Subject: Add flag to always view the desktop site for all websites .../layout/custom_useragent_preferences.xml | 108 +++++++++++ .../android/java/res/xml/main_preferences.xml | 5 + .../java/res/xml/useragent_preferences.xml | 31 +++ - .../chrome/browser/app/ChromeActivity.java | 21 ++- + .../chrome/browser/app/ChromeActivity.java | 20 +- .../settings/PrivacyPreferencesManager.java | 30 +++ - .../settings/UserAgentPreferences.java | 178 ++++++++++++++++++ - .../chromium/chrome/browser/tab/TabImpl.java | 83 +++++++- + .../settings/UserAgentPreferences.java | 176 ++++++++++++++++++ + .../chromium/chrome/browser/tab/TabImpl.java | 83 ++++++++- .../browser/tabmodel/TabWindowManager.java | 23 +++ .../browser/android/content/content_utils.cc | 64 +++++-- .../preferences/browser_prefs_android.cc | 7 + @@ -25,13 +29,13 @@ Subject: Add flag to always view the desktop site for all websites .../strings/android_chrome_strings.grd | 35 ++++ chrome/common/pref_names.cc | 13 ++ chrome/common/pref_names.h | 8 + - .../android/browser_startup_controller.cc | 35 ++++ + .../android/browser_startup_controller.cc | 34 ++++ .../navigation_controller_android.cc | 6 +- .../navigation_controller_android.h | 3 +- .../renderer_host/render_process_host_impl.cc | 1 + .../browser/web_contents/web_contents_impl.cc | 4 +- .../framehost/NavigationControllerImpl.java | 6 +- - 28 files changed, 748 insertions(+), 30 deletions(-) + 28 files changed, 744 insertions(+), 30 deletions(-) create mode 100644 chrome/android/java/res/layout/custom_useragent_preferences.xml create mode 100644 chrome/android/java/res/xml/useragent_preferences.xml create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/settings/UserAgentPreferences.java @@ -71,14 +75,14 @@ diff --git a/chrome/android/chrome_java_resources.gni b/chrome/android/chrome_ja diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni -@@ -1308,6 +1308,7 @@ chrome_java_sources = [ - "java/src/org/chromium/chrome/browser/photo_picker/DecoderService.java", - "java/src/org/chromium/chrome/browser/settings/AdBlockEditor.java", - "java/src/org/chromium/chrome/browser/settings/AdBlockPreferences.java", +@@ -1295,6 +1295,7 @@ chrome_java_sources = [ + "java/src/org/chromium/chrome/browser/payments/ui/DimmingDialog.java", + "java/src/org/chromium/chrome/browser/payments/ui/LineItem.java", + "java/src/org/chromium/chrome/browser/payments/ui/PaymentAppComparator.java", + "java/src/org/chromium/chrome/browser/settings/UserAgentPreferences.java", - "java/src/org/chromium/chrome/browser/policy/EnterpriseInfo.java", - "java/src/org/chromium/chrome/browser/policy/PolicyAuditor.java", - "java/src/org/chromium/chrome/browser/prerender/ChromePrerenderService.java", + "java/src/org/chromium/chrome/browser/payments/ui/PaymentInformation.java", + "java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestBottomBar.java", + "java/src/org/chromium/chrome/browser/payments/ui/PaymentRequestHeader.java", diff --git a/chrome/android/java/res/layout/custom_useragent_preferences.xml b/chrome/android/java/res/layout/custom_useragent_preferences.xml new file mode 100644 --- /dev/null @@ -260,7 +264,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActiv import org.chromium.url.GURL; -@@ -2038,11 +2045,19 @@ public abstract class ChromeActivity +@@ -2038,11 +2045,18 @@ public abstract class ChromeActivity } else if (id == R.id.view_source_id) { currentTab.getWebContents().getNavigationController().loadUrl(new LoadUrlParams("view-source:"+currentTab.getUrlString())); } else if (id == R.id.request_desktop_site_id || id == R.id.request_desktop_site_check_id) { @@ -276,8 +280,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActiv + ChromePreferenceKeys.USERAGENT_STICKY_DESKTOP_MODE, false); + if (stickyDesktopModeEnabled) { + TabWindowManager.getInstance().SetOverrideUserAgentForAllTabs(!usingDesktopUserAgent); -+ } -+ else { ++ } else { + currentTab.SetOverrideUserAgent(!usingDesktopUserAgent); + } RecordUserAction.record("MobileMenuRequestDesktopSite"); @@ -333,7 +336,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/settings/UserAg new file mode 100644 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/settings/UserAgentPreferences.java -@@ -0,0 +1,178 @@ +@@ -0,0 +1,176 @@ +/* + This file is part of Bromite. + @@ -386,7 +389,7 @@ new file mode 100644 +/** + * Fragment that allows the user to configure User Agent related preferences. + */ -+public class UserAgentPreferences ++public class UserAgentPreferences + extends PreferenceFragmentCompat implements RadioGroup.OnCheckedChangeListener { + + private static final String PREF_STICK_DESKTOP_MODE_SWITCH = "desktop_mode_switch"; @@ -480,7 +483,7 @@ new file mode 100644 + + return viewGroup; + } -+ ++ + private void UpdateAllTabs() { + final boolean alwaysDesktopModeEnabled = SharedPreferencesManager.getInstance().readBoolean( + ChromePreferenceKeys.USERAGENT_ALWAYS_DESKTOP_MODE, false); @@ -491,18 +494,16 @@ new file mode 100644 + public void onCheckedChanged(RadioGroup group, int checkedId) { + if (useDefaultAgentSwitch.isChecked()) { + PrivacyPreferencesManager.getInstance().setOverrideUserAgentEnabled(false, false); -+ } -+ else if (useCustomAgentSwitch.isChecked()) { ++ } else if (useCustomAgentSwitch.isChecked()) { + PrivacyPreferencesManager.getInstance().setOverrideUserAgentEnabled(true, false); + } -+ ++ + if (useDefaultAgentSwitchDesktopMode.isChecked()) { + PrivacyPreferencesManager.getInstance().setOverrideUserAgentEnabled(false, true); -+ } -+ else if (useCustomAgentSwitchDesktopMode.isChecked()) { ++ } else if (useCustomAgentSwitchDesktopMode.isChecked()) { + PrivacyPreferencesManager.getInstance().setOverrideUserAgentEnabled(true, true); + } -+ ++ + UpdateAllTabs(); + } + @@ -1044,7 +1045,7 @@ diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h diff --git a/content/browser/android/browser_startup_controller.cc b/content/browser/android/browser_startup_controller.cc --- a/content/browser/android/browser_startup_controller.cc +++ b/content/browser/android/browser_startup_controller.cc -@@ -10,11 +10,46 @@ +@@ -10,11 +10,45 @@ #include "content/browser/browser_main_loop.h" #include "content/public/android/content_jni_headers/BrowserStartupControllerImpl_jni.h" @@ -1063,7 +1064,7 @@ diff --git a/content/browser/android/browser_startup_controller.cc b/content/bro void BrowserStartupComplete(int result) { + -+ LOG(INFO) << "---Checking user agent override status"; ++ LOG(INFO) << "BrowserStartup: checking user agent override status"; + + base::CommandLine* parsed_command_line = + base::CommandLine::ForCurrentProcess(); @@ -1078,9 +1079,8 @@ diff --git a/content/browser/android/browser_startup_controller.cc b/content/bro + if (net::HttpUtil::IsValidHeaderValue(ua)) { + parsed_command_line->AppendSwitchASCII(switches::kUserAgent, + ua); -+ } -+ else { -+ LOG(INFO) << "Ignored invalid value for ua --" << ua; ++ } else { ++ LOG(INFO) << "BrowserStartup: ignoring invalid value for custom user agent"; + } + + parsed_command_line->RemoveSwitch(switches::kDesktopModeViewportMetaEnabled); diff --git a/build/patches/android-upstream-missed-manifest-changes-for-Q-R.patch b/build/patches/android-upstream-missed-manifest-changes-for-Q-R.patch new file mode 100644 index 00000000..0311ed34 --- /dev/null +++ b/build/patches/android-upstream-missed-manifest-changes-for-Q-R.patch @@ -0,0 +1,84 @@ +From: "Torne (Richard Coles)" +Date: Tue, 3 Nov 2020 19:02:16 +0000 +Subject: android: upstream missed manifest changes for Q/R. + +On Q+ we disabled audio capture as we have no way to selectively disable +it for incognito tabs, but this was missed when upstreaming Q. + +Chrome needs QUERY_ALL_PACKAGES permission on R+ to check for any +possible intent handler for URLs. This was added downstream but missed +while upstreaming R support; add it now. + +Bug: 948282, 1042023 +Change-Id: I4136beddcba0227ef6cfc2073f90d645151ce6bb +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2507575 +Reviewed-by: David Trainor +Reviewed-by: Theresa +Commit-Queue: Richard Coles +Cr-Commit-Position: refs/heads/master@{#823642} +--- + .../monochrome_public_bundle.AndroidManifest.expected | 2 ++ + .../trichrome_chrome_bundle.AndroidManifest.expected | 2 ++ + chrome/android/java/AndroidManifest.xml | 2 ++ + 3 files changed, 6 insertions(+) + +diff --git a/chrome/android/expectations/monochrome_public_bundle.AndroidManifest.expected b/chrome/android/expectations/monochrome_public_bundle.AndroidManifest.expected +--- a/chrome/android/expectations/monochrome_public_bundle.AndroidManifest.expected ++++ b/chrome/android/expectations/monochrome_public_bundle.AndroidManifest.expected +@@ -37,6 +37,7 @@ + + + ++ + + + +@@ -63,6 +64,7 @@ + + + + + ++ + + + +@@ -63,6 +64,7 @@ + + + + + ++ + + + +@@ -160,6 +161,7 @@ by a child template that "extends" this file. + android:allowBackup="false" + {% endif %} + android:networkSecurityConfig="@xml/network_security_config" ++ android:allowAudioPlaybackCapture="false" + {% block extra_application_attributes %}{% endblock %}> + + {% macro application_definitions() %} +-- +2.17.1 +