Upstream Chromium cr147 (https://chromium-review.googlesource.com/c/chromium/src/+/7559078)
made FOREGROUND_SERVICE_CAMERA unconditional for all Android builds by
removing the is_desktop_android guard. However, the feature that
actually uses it (kAndroidEnableBackgroundMediaCapturing) is disabled
by default and not enabled by Brave, so the permission is declared but
never used.
This blocks Play Store publishing because Google requires a declaration
with a demo video for any app using FOREGROUND_SERVICE_CAMERA.
This PR:
- Re-gates FOREGROUND_SERVICE_CAMERA behind is_desktop_android so it's
excluded from Brave builds
- Removes AndroidManifest_user_permissions.xml since upstream now
declares FOREGROUND_SERVICE_MICROPHONE unconditionally, making
Brave's duplicate unnecessary
Resolves: https://github.com/brave/brave-browser/issues/54143
* [Android] Move tab switcher controls to bottom when address bar is at bottom
When the address bar is configured to show at the bottom, reposition the
entire hub toolbar (new tab, menu, pane switcher, search, shred) from
the top to the bottom of the tab switcher for one-handed accessibility.
- BraveHubManagerImpl: Add maybeRepositionToolbarToBottom() that changes
the toolbar wrapper's FrameLayout gravity to BOTTOM and swaps the pane
host container's top margin to bottom margin. Uses EdgeToEdge pad
adjuster (same pattern as upstream HubBottomToolbarCoordinator) to
handle navigation bar insets. Properly cleans up the adjuster on hub
hide since the coordinator and views are destroyed between show/hide
cycles.
- BraveHubManagerImplClassAdapter: Expose parent's mEdgeToEdgeSupplier
field via deleteField/makeProtectedField bytecode pattern.
- BraveToolbarManager: Remove setLayoutStateProvider() and its
LayoutStateObserver that toggled menu popup direction on tab switcher
transitions. No longer needed since the hub toolbar is now at the
bottom when address bar is at bottom.
- BraveHubToolbarView: Change INVISIBLE to GONE for hidden action/menu
buttons when bottom navigation controls are enabled (address bar on
top). INVISIBLE left the buttons clickable despite being hidden.
Resolves: https://github.com/brave/brave-browser/issues/53326
* [Android] Fix autofill toggle greyed out when Google is the system autofill service
When Google's Autofill with Google (AWG) is set as the preferred autofill
service in Android OS settings, Chromium disables the third-party autofill
toggle in Settings because Chrome has its own built-in Google-synced
autofill. Since Brave does not have built-in Google autofill, AWG should
be treated like any other third-party provider (e.g. 1Password, Bitwarden).
This fix has two parts:
Java side: Override AutofillClientProviderUtils.getAndroidAutofillFramework-
Availability() via bytecode changeMethodOwner to remap the
ANDROID_AUTOFILL_SERVICE_IS_GOOGLE status to AVAILABLE or SETTING_TURNED_OFF
based on the user's existing pref. This makes the toggle interactive in the
Settings UI.
Native side: The C++ code calls the Java method via JNI, bypassing the
bytecode redirect. To handle this, BraveAutofillClientProviderUtils is
annotated with @CalledByNative to generate its own JNI header. A chromium_src
override of autofill_client_provider.cc uses #define to redirect the original
JNI function to the Brave version, ensuring the native code also uses the
remapped availability status and doesn't reset the pref on browser startup.
Resolves: https://github.com/brave/brave-browser/issues/52960
Convert nala from copy-only targets to a proper android_resources
target so modules with their own resources_package can reference
nala icons via R.drawable at compile time. Use the nala
social-brave-release-favicon-fullheight-color icon for Brave Search
in both the Quick Search Engines view and settings adapters.
Resolves: https://github.com/brave/brave-browser/issues/51364
* [Android][cr146] Put url into url bar after QR scan
This commit brings back pre-cr146 behaviour
on scanning QR codes with url - url text now
is at the url bar and selected again.
Resolves https://github.com/brave/brave-browser/issues/53318
Updated `brave_bytecode_jars`, otherwise bytecode patching wasn't applied
as expected, app crashed with
```
java.lang.IllegalAccessError: Field 'org.chromium.chrome.browser.toolbar.top.TopToolbarCoordinator.mOptionalButtonController' is inaccessible to class 'org.chromium.chrome.browser.toolbar.top.BraveTopToolbarCoordinator'
```
and the test checkSuperName("ToolbarPhone", "BraveToolbarLayoutImpl") were failing
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/ff44f6aed85bd03834121421e2ec8c6add7b7bba
toolbar: Make extensions toolbar UI an independent build target
This work is a follow-up to https://crrev.com/c/7534296.
This CL decouples the Android extensions toolbar UI from the core
toolbar architecture by extracting it into a standalone GN target and
enforcing strict DEPS boundaries.
Historically, extension-specific UI components and their heavyweight
dependencies (e.g., components/thin_webview) were intertwined within the
monolithic //chrome/browser/ui/android/toolbar module. As the extensions
feature set evolves—particularly in the context of Desktop Android—this
coupling risks architectural bloat, blurs domain boundaries, and
increases the potential for circular dependencies.
To establish a scalable, maintainable, and decoupled foundation, this
change implements the following structural improvements:
1. Enforces Strict Dependency Isolation Migrates extension UI sources,
tests, and dependencies into a distinct BUILD.gn under
toolbar/extensions/. Extension-specific includes are purged from the
global toolbar DEPS and localized to the new module's DEPS file,
preventing dependency leakage into the broader UI layer.
2. Optimizes the Build Graph Refactors the primary toolbar target into
core_java. A new facade target, java_group("java"), aggregates core_java
and conditionally includes the extensions module only when
enable_extensions_core is active. This ensures the core toolbar compiles
cleanly on its own, shields non-extension builds from unnecessary
compilation, and preserves existing contracts for upstream targets.
3. Improves Test Encapsulation Segregates the JUnit and instrumentation
tests for extensions into their own respective targets, ensuring test
dependencies and execution are accurately mapped to the isolated module.
By enforcing these strict modular boundaries, we guarantee that
extension dependencies do not pollute the core toolbar's architectural
footprint, significantly clean up the dependency tree, and lay a robust
architectural runway for future Desktop Android extension features.
Bug: None
Test: CQ
Change-Id: I90dc5993c15e0295f08db2b7f1b096de8ce73195
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7532769
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/23c8fddd48102899160ce4d71b1ab1949c88a248
[Theme] Add NtpCustomizationPolicyManager.
In this CL, we add NtpCustomizationPolicyManager which listens to
Pref.NTP_CUSTOM_BACKGROUND_DICT changes.
1) Pref.NTP_CUSTOM_BACKGROUND_DICT being managed means the
policy::key::NTPCustomBackgroundEnabled is disabled.
2) When the policy NTPCustomBackgroundEnabled changes,
NtpCustomizationPolicyManager saves the latest policy value to the
shared preference. It will apply after relaunch chrome. This allows
the UI correct when CTA isn't recreated.
Demo: http://shortn/_nBBqRNFS3N
Bug: 467029432
Change-Id: I04a50d0d814802fbd3ef8be29414a17181adae98
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7500251
BraveNewTabPageLayout.setSearchProviderTopMargin and
BraveNewTabPageLayout.setSearchProviderBottomMargin methods were removed at
https://github.com/brave/brave-core/commit/798973641caa39762bae9dff9d2866c7185ce6c8
but class adapter/bytecode
Chromium commit below is the commit which caused our bytecode test
to fail, because was renamed
setSearchProviderBottomMargin => setLogoViewBottomMargin .
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/9b284825edfb4cea09d686dac7456517c1e8b96e
[Composeplate] Fix composeplate view visibility issue.
There are 3 issues of the existing NTP:
1) When DSE is changed between Google and 3P, the return value of
ComposeplateUtils.isComposeplateEnabled(mIsTablet, profile)
changes, but we didn't recalculate it. It causes the bug that
composeplate view button doesn't show again for Google -> 3p ->
Google.
2) If Chrome starts with 3p DSE, ComposeplateCoornidator won't be
initialized at all. Switching to Google won't make it visible.
3) When switching from Google -> 3p, search box's height doesn't reduce
from 72dp to 64dp.
In this CL, we resolve the above 3 issues:
1) When DSE is changed, initialize ComposeplateCoornidator if hasn't
yet; updates the buttons' visibility.
2) Changes the search box height inside NTP, not in
SaerchBoxContainerView. The height is determined by whether
composeplate is enabled, as well as whether a shadow is added.
3) Polish the initialization process of NTP layout to prevent calling
same function multiple times.
Demo: http://shortn/_vdN9koVnsu
Bug: 474426974
Change-Id: I3a16e56e655465d36184204657626f2bb7c92f24
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7487954
Override DownloadLocationDialogCoordinator to force the download
location dialog even on single-directory devices (no SD card).
Upstream skips the dialog when only one storage directory is
available; the Brave override intercepts that skip and re-triggers
the dialog display. Also transitions SHOW_INITIAL to SHOW_PREFERENCE
so the "Don't show again" checkbox starts unchecked, preventing the
feature from silently disabling itself after the first use.
Resolves: https://github.com/brave/brave-browser/issues/52737
Pass a temporary no-op HomeSurfaceTracker when mHomeSurfaceTracker is
null during warm startup to prevent the NPE in upstream's
setInitialOverviewStateOnResumeWithNtp. This can happen on activity
recreate (rotation, process death, foldable transitions) where
onResumeWithNative fires before the tracker is initialized.
Resolves: https://github.com/brave/brave-browser/issues/53071
Updates the Day Zero onboarding experience on smartphones and small screen devices to a multi‑step, horizontally advancing flow driven by CTA buttons.
It introduces distinct layouts per step, a pager animation helper, and updates onboarding logic to support a scalable, multi‑step sequence with minimal duplication.
Tablet support is intentionally out of scope and will be handled in a separate PR.
[Android] Fixes a crash in FaviconUtils.getIconDrawableWithFilter
when an icon is not available for a particular URL by falling back
to the default globe icon.
Resolves: https://github.com/brave/brave-browser/issues/52458
android.support.annotation.NonNull is not used at code anymore.
The only exception is SafetyNetClient, so moved lib here from upstream cr142:
src/third_party/android_deps/cipd/libs/com_android_support_support_annotations/support-annotations.jar
src/third_party/android_deps/libs/com_android_support_support_annotations/README.chromium
src/third_party/android_deps/libs/com_android_support_support_annotations/LICENSE
Otherwise there are build errors
```
Missing class android.support.annotation.NonNull
(referenced from: com.google.android.gms.safetynet.SafetyNetClient
com.google.android.gms.safetynet.SafetyNet.getClient(android.content.Context)
and 2 other contexts)
```
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/b3748a2d55040afbbccd651513dedbac2d12799b
Remove legacy android.support.annotations 3p library
Bug: 455582944
Change-Id: I9ce7495883574e7f0bdc09dcc2960abce71a54a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7081697
Added an ability to start shred manually from two places:
- tab's context menu (includes support of the menu customization)
- tab switch mode
Added confirmation dialog before the site data shred operation
Resolves: https://github.com/brave/brave-browser/issues/51326
---------
Signed-off-by: Vadym Struts <vstruts@brave.com>
* Add enable_brave_wallet GN variable and build flag
This adds a new GN build flag 'enable_brave_wallet' that can be set to
false to exclude Brave Wallet from the build. The flag is true by default
to maintain current behavior.
Changes include:
- Add enable_brave_wallet declare_args in build/config/BUILDCONFIG.gn
- Create brave_wallet/common/buildflags with ENABLE_BRAVE_WALLET flag
- Update all BUILD.gn and sources.gni files to use the new flag
- Add wallet buildflags dependencies via minimal one-line imports
* Add patches for wallet buildflags in Chromium BUILD files
Adds minimal one-line patches to import wallet buildflags dependencies
in Chromium source files. This allows Chromium code to conditionally
depend on wallet headers.
Patches:
- chrome/browser/ui/hid/BUILD.gn
- net/BUILD.gn
- third_party/blink/common/BUILD.gn
- third_party/blink/public/common/BUILD.gn
- third_party/blink/renderer/modules/permissions/BUILD.gn
* Guard wallet code in Chromium source overrides
Updates chromium_src overrides to conditionally compile wallet-related
code based on enable_brave_wallet flag. This includes:
- Adding DEPS files to allow buildflags dependencies
- Guarding wallet permission handling with #if BUILDFLAG(ENABLE_BRAVE_WALLET)
- Keeping wallet permission enum values unconditionally to maintain profile
interchangeability between wallet-enabled and wallet-disabled builds
- Updating component registration and preference handling
Key changes:
- Permission enums remain stable across build configs for UMA and persistence
- Wallet permission handling code only compiled when wallet enabled
- DEPS files updated to allow buildflags includes
* Guard wallet UI code in front-end TypeScript and Mojom
Conditionally compiles wallet-related UI code in TypeScript and Mojom
interfaces based on enable_brave_wallet preprocessor flag.
Changes:
- Settings menu: Use lastInserted pattern for menu item ordering
- Page visibility: Guard wallet page visibility checks
- Browser commands: Guard wallet command handling
- Routes: Conditionally include wallet routes
- Add non-null assertions for DOM insertions in TypeScript
- Update Mojom interfaces to conditionally include wallet enums
Front-end code uses <if expr="enable_brave_wallet"> preprocessor
directives to exclude wallet UI when the feature is disabled.
* Guard wallet usage in non-wallet Brave code
Conditionally compiles wallet-related code in non-wallet Brave files
based on enable_brave_wallet build flag.
Changes include:
- browser/: Guard wallet service factories, preferences, and helpers
- components/: Guard wallet dependencies in rewards, sidebar, and DNS
- renderer/: Conditionally register wallet content settings
- utility/: Guard wallet component registration
- ios/: Add optional chaining for wallet feature flags
- test/: Guard wallet-related test code
Key files:
- brave_stats_updater.cc: Guard wallet pref registration with #if
- brave_profile_prefs.cc: Conditionally register wallet preferences
- sidebar_service.cc: Guard wallet panel items
- iOS WalletConstants.swift: Use optional chaining for feature checks
This allows building Brave without wallet while maintaining profile
compatibility between wallet-enabled and wallet-disabled builds.
* Add static_assert for ENABLE_BRAVE_WALLET in wallet headers
Adds compile-time assertions to wallet headers to ensure they are only
included when wallet is enabled. This prevents accidental usage of wallet
APIs when enable_brave_wallet=false.
Added static_assert(BUILDFLAG(ENABLE_BRAVE_WALLET)) to:
browser/brave_wallet/ (11 files):
- asset_ratio_service_factory.h
- brave_wallet_context_utils.h
- brave_wallet_ipfs_service_factory.h
- brave_wallet_provider_delegate_impl.h
- brave_wallet_service_factory.h
- brave_wallet_tab_helper.h
- meld_integration_service_factory.h
- wallet_notification_service_factory.h
- simulation_service_factory.h
- swap_service_factory.h
- wallet_data_files_installer_delegate_impl.h
components/brave_wallet/browser/ (15 files):
- brave_wallet_p3a_private.h
- brave_wallet_prefs.h
- brave_wallet_service.h
- brave_wallet_utils.h
- ens_resolver_task.h
- json_rpc_service_test_utils.h
- json_rpc_service.h
- keyring_service_observer_base.h
- keyring_service.h
- network_manager.h
- permission_utils.h
- pref_names.h
- test_utils.h
- tx_service.h
- wallet_data_files_installer.h
components/brave_wallet/common/ (6 files):
- brave_wallet_types.h
- common_utils.h
- eth_abi_utils.h
- features.h
- hex_utils.h
- pref_names.h
Also includes minor wallet code updates to use buildflags and
guard zcash-specific test code.
* Follow up fixes after Parts 1-7
To avoid copy/pasting of the same code in `BraveLocationBarQRDialogFragment` and `BraveSyncScreensPreference`, the common code related to qr code reading was moved to `QRCodeCameraManager` class.
Resets the overflow main menu to the top every time is shown. Modifications are applied using bytecode manipulations as we needed to modify upstream class `AppMenuHandlerImpl`.
[Android] Adds kBraveFreshNtpAfterIdleExpirement experiment flag.
That commit adds the flag with parameters and a functionality
to use cached flags on Android.
Resolves: https://github.com/brave/brave-browser/issues/50567