On tablet the rewards (BAT) icon lives in the brave_toolbar row, a
wrap_content LinearLayout that caches its measured width. When the icon
is hidden from onMeasure (e.g. when Brave Origin disables rewards), the
implicit requestLayout() from setVisibility() is dropped because the
toolbar is already mid-layout, so the row keeps its old width and the
weighted location bar never reclaims the freed space, leaving a gap
until a device rotation forces a fresh layout.
Route all rewards-slot visibility changes through a helper that, on an
actual change on tablet, re-requests layout on the rewards view itself
(so its row re-measures) off the measure pass, and refreshes the cached
tablet toolbar snapshot.
Resolves: https://github.com/brave/brave-browser/issues/56036
The following content consists of the original commits. Original HEAD
commit is b599de1bcf0702ca11466a3ae1afeac732839544
* shields: add unified panel UI resources and skeleton handler
Add the new unified Shields panel that replaces the legacy popup,
triggered from the existing toolbar Shields icon.
- BraveUnifiedPanelHandler.java (new): skeleton handler with
popup display, basic shields status rendering, favicon display,
and lifecycle management.
- BraveShieldsHandler.java:
- Add mBlockedUrls tracking to BlockersInfo.
- Add getTotalBlockedCount() and getBlockedUrls() accessors for
the unified panel.
- BraveShieldsContentSettings.java:
- Add resetSiteToDefaults() to reset all per-site shields
settings to global defaults via individual JNI getter/setter
pairs.
- BraveToolbarLayoutImpl.java:
- Instantiate BraveUnifiedPanelHandler and route Shields button
taps through it instead of the legacy handler.
- All XML drawables, layouts, string resources, colors, styles,
and BUILD.gn/brave_java_sources.gni wiring.
* shields: implement advanced options and toggle controls
Wire up the expandable advanced options section and all toggle
controls in the unified Shields panel.
- BraveUnifiedPanelHandler.java:
- Implement shields on/off toggle with observer notification.
- Add block scripts and fingerprinting toggles with
BraveShieldsContentSettings persistence.
- Add advanced options expand/collapse with navigation items.
- Add reset site shields to defaults.
- Stub methods for sub-panel navigation.
- BraveToolbarLayoutImpl.java:
- Extract BraveShieldsMenuObserver into a shared instance and
register it on both the legacy and unified panel handlers so
either can trigger toolbar icon updates and page reloads.
* shields: add sub-panel navigation for detailed settings
Implement the drill-down sub-panels accessible from the advanced
options section of the unified Shields panel.
- BraveUnifiedPanelHandler.java:
- Fill out stub navigation methods with full implementations.
- HTTPS upgrades panel with strict/standard/disabled radio
options.
- Trackers & ads panel with aggressive/standard/allow settings.
- Cookies panel with block-all/block-third-party/allow settings.
- Shred site data panel with auto-shred mode selection dialog
and immediate shred with confirmation.
- Each sub-panel persists its selection via
BraveShieldsContentSettings and provides return navigation
to the main panel.
* shields: display favicons for blocked trackers and ads
Add favicon display for blocked tracker domains in the unified
Shields panel, showing up to three cascaded icons with a
prohibited overlay.
- BraveUnifiedPanelHandler.java:
- Add asynchronous favicon lookup via
FaviconHelper.getLocalFaviconImageForURL with a multi-step
fallback chain: exact origin -> registrable domain (via
UrlUtilities.getDomainAndRegistry) -> alternative TLDs.
- Prioritize successfully loaded favicons before
letter-placeholder defaults.
- Render circular icon containers with theme-aware backgrounds,
negative-margin cascading, z-ordering, and a stroke-based
prohibited overlay.
- Use UrlFormatter for display-friendly domain names.
- Use ViewUtils.dpToPx for density-independent measurements.
* shields: implement broken site reporting panel
Wire up the broken site reporting panel in the unified Shields UI,
accessible when shields are toggled off.
- BraveUnifiedPanelHandler.java:
- Add showReportBrokenSitePanel() and
setupReportBrokenSitePanel().
- Display site favicon and domain via UrlFormatter.
- Populate category selection from WebcompatReporterHandler.
- Attach screenshot via BraveShieldsScreenshotUtil.
- Pre-populate contact info from existing reporter preferences.
- Add learn-more clickable span linking to community support.
- Submit report via WebcompatReporterHandler with toast
confirmation.
* shields: Add tests for suitable bits of the implementation.
Add unit tests for the new unified Shields panel logic introduced
across the preceding commits.
- BraveShieldsContentSettingsResetTest.java:
- Verify resetSiteToDefaults() reads global defaults and applies
them to a per-site URL for all eight setting types.
- Verify HTTPS upgrade setter is skipped when global default is
"default" and called when it is any other value.
- BraveUnifiedPanelHandlerStatTest.java:
- Verify addStat() increments the correct counter for each block
type (ads, trackers, scripts, fingerprinting).
- Verify blocked URL recording with 50-item cap.
- Verify clearBraveShieldsCount() resets and removeStat() deletes
tab entries.
- Verify getters return sensible defaults for unknown tab IDs.
- Verify per-tab stat isolation.
- BraveUnifiedPanelFaviconPriorityTest.java:
- Verify populateBlockedItemsContainer() prioritises successfully
loaded favicons before letter-placeholder defaults.
- Verify display is capped at MAX_BLOCKED_ICONS (3).
- Verify onFaviconResult() countdown triggers population only
after all loads complete.
- Verify cascading negative-margin layout for overlapping icons.
- BUILD.gn (brave/android/junit, brave/test):
- Register new robolectric_library targets for the shields and
preferences.website test packages.
* Cleanup & Remove old Shields UI.
This commit completes the changeset by removing the old Shields UI from
the codebase.
Since only a small amount of functionality needed to be kept from the
old UI's code, it has been relocated into BraveUnifiedPanelHandler
* Apply Shields UI tweaks.
This commit applies a number of minor tweaks that were initially missed
from the Figma designs. This should make the look and feel match with
the intended UX fully.
* Shields: Task-post & Back button cleanup.
The back button has been moved to its own XML which is then included by
other dialogs. Additionally, the Shred UI has been fixed up to be
consistent with the existing dialogs.
The favicon rendering task uses PostTask now. The check for whether or
not to post the task has been removed since the callback checks it
anyway and the saving from not posting the task would require pretty
tight timing in order to actually be of benefit so it's arguably not
worth double-checking.
* Shields: Improve accessibility for toggle switches.
Since we have custom-designed toggles, TalkBack would consider them
images. We now attach a delegate to these controls that causes them to
be treated as switches.
* Shields: Improve title sizing, HTTPS reset & fix radio buttons
The title sizing now uses a standard Material style for titles along
with a few tweaks that make it dynamically downsize itself to avoid
truncation.
The HTTPS settings reset is now called unconditionally in order to
resolve a report from the puLL-Merge bot.
Finally, Since there appears to be no easy way to group the radio
buttons whilst retaining the desired style, the code now unconditionally
unchecks them after a settings reset to ensure multiple entries don't
appear to be selected.
* Shields: Remove tryAlternativeTldFavicon code.
We originally implemented a hack for verifying if favicons would load at
all. It has served its purpose and we of course can't legitimately
attempt to pull favicons for other TLDs since they could just be
flat-out wrong. There may be desire for a mechanism in future where we
alias domains, but that is largely out-of-scope for our UI.
* Shields: Support zooming/scrolling the screenshot preview.
When a user reports a site and previews the screenshot (if they choose
to send one) they can now zoom and scroll around the image.
This commit includes the implementation of a reusable class for handling
inputs and scaling the image. I didn't find any pre-existing code for
this behaviour and whilst it could be used elsewhere, I've left it
embedded as a static class since there are no other potential users at
this juncture.
* Shields: Restore code that handles WebView usage.
The old implementation of the Shields panel would ensure
`mHardwareButtonMenuAnchor`/`mContext` were initialised when in WebView
only mode. We still require this in order for the panel to still work.
* Implement more requested minor UI tweaks.
This adds animations to the toggle buttons in the new Shields UI and
fixes the ripple animation on the advanced expander which was missing a
single XML attribute that clamped the effect to the bounds of the
rounded box.
The blocked trackers (without a favicon) have also been tweaked to use
colours from Nala and the letter has been sized up to match the Figma
design.
* Switch toggles to Material UI
This commit switches the toggles to Material UI. This doesn't appear to
have any discernible issues but I'm keeping it separated just in case.
* Support Material You colours and tweak minor UI issues.
This commit alters the XML files so that Material You themes should work
out of the box once the Brave flag for dynamic colours is enabled.
Also resolves a few minor UI issues with placing/alignment/sizing.
Fold/unfold fires onConfigurationChanged without recreating the
activity, leaving containment styling stale. Override
onConfigurationChanged in BraveMainPreferencesBase to post
notifyPreferencesUpdated after the layout pass.
Resolves: https://github.com/brave/brave-browser/issues/55992
AI-assisted commit
When an Origin purchase is first detected via credential refresh (e.g.
linked from account.brave.com), open the Origin settings screen and show
the existing restart snackbar.
The shared first-purchase trigger in BraveOriginService::OnCredentialSummary
calls the navigation delegate, whose Android branch was previously a no-op.
It now routes through a JNI helper that opens BraveOriginPreferences with an
explicit show-restart flag, where onViewCreated shows the restart snackbar.
Play Store purchases are left to the existing Java subscription flow (which
shows the "Disabling features" spinner while credentials are fetched, then
transitions to the restart prompt). The helper skips opening when a Play
Store purchase token is present so the screen isn't opened twice.
Resolves: https://github.com/brave/brave-browser/issues/55991
This change updates the Site Settings > All Sites > Delete browsing data... to open the brave's Delete browsing data dialog instead of the upstream.
Resolves: https://github.com/brave/brave-browser/issues/55970
Calls BillingClient.showInAppMessages on app foreground so the Play
Store can render its recovery dialog (declined payment, opt-in price
change) on top of Brave. Gated on the user having an active VPN or Leo
subscription, throttled to one call per real foreground session via an
ApplicationStatus listener that resets only on HAS_STOPPED_ACTIVITIES /
HAS_DESTROYED_ACTIVITIES — in-app navigation does not re-trigger.
Resolves: https://github.com/brave/brave-browser/issues/55735
* [Android] Respect `Show search suggestions` in search widget
* [Review] Use BravePref for the preference
* [Review] Change default value when profile is not ready
The PR fixes crash on Android when opening a new tab with dynamic NTT
after the Chromium 149 bump, caused by passing null as attach params.
Co-Authored-By: serg@brave.com
The Brave News inline promoted ads pipeline is already disabled via
https://github.com/brave/brave-core/pull/32359. This PR removes the remaining
promoted content ads Android code and mojom code that no longer has any effect.
* add migration for social media blocking prefs
* move pref change registrar to AdBlockService
* change new preference path to avoid conflict
Settings UI pages automatically check for matching preferences
registered under the profile first. They only check under local state if
nothing was found registered under the profile prefs.
This means we can't use the same preference path after the migration.
* only attempt to migrate settings from regular profiles
The first profile to initialize is the System Profile, which will never
have any meaningful settings to migrate.
* use local state in the tests
* update BraveProfilePrefsBrowserTest
* register legacy prefs as part of `AdBlockPrefService`
* add comment in normal migration path
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/7d3c16b9bb778a09b643288fe47bae4c1d8e53b7
commit 7d3c16b9bb778a09b643288fe47bae4c1d8e53b7
Author: Jingping Sun <jings@microsoft.com>
Date: Mon Apr 27 10:58:12 2026 -0700
[Unchecked] Enable -Xlint:unchecked for Chromium-owned code
Conditionally append -Xlint:unchecked to the base javac flags only when
options.chromium_code is true. This makes javac fail the build on any
new unchecked-conversion / heap-pollution / raw-type warnings in
Chromium-owned Java code, while leaving synced third-party Java sources
(chromium_code=false; auto-defaulted for third_party/ paths without
org.chromium namespace) compiled silently as before.
Why conditional, not global: Synced third-party Java code under
third_party/{junit,google-truth}/ src/ contains unchecked-warning sites
we cannot fix in chromium code base.
Bug: 358366667
Change-Id: I904b09cd4484098cee3b59e6d4aae94eba8d33ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7790536
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Peter Wen <wnwen@chromium.org>
Commit-Queue: Jingping Sun <jings@microsoft.com>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1621171}
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/c66e45550985e3570e1cf181df0ec749ab3d80f6
commit c66e45550985e3570e1cf181df0ec749ab3d80f6
Author: Yanting Yu <yyanting@google.com>
Date: Tue Apr 21 12:43:23 2026 -0700
[LogoRefactor] Branch to LegacyLogoView and introduce feature flag.
This CL branches the current LogoView implementation into LegacyLogoView
to ensure the existing functionality remains intact while we restructure
the new LogoView in the follow up CL.
Changes include:
- Branched LogoView, LogoViewBinder, layout XMLs, and corresponding unit tests into LegacyLogoView equivalents.
- Added the ChromeFeatureList.LOGO_VIEW_REFACTOR feature flag in LogoCoordinator to dynamically switch between inflating the LogoView and the LegacyLogoView.
- Extracted the ClickHandler interface from LogoView into LogoProperties to serve as a shared, domain-specific contract. This cleanly decouples the two views, allowing them to be fully independent while still being driven by the same PropertyModel and LogoMediator.
- Updated new_tab_page_layout.xml to replace the `logo_holder` FrameLayout with ViewStub.
Bug: 492453183
Change-Id: Id0ef80f8acab9c2d15928020eb3688bd9f2afc33
Bypass-Check-License: branched files
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7760153
Commit-Queue: Yanting Yu <yyanting@google.com>
Reviewed-by: Xi Han <hanxi@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1618376}
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/5ee2afaf87b258f0f692c32d17866114a996eb66
commit 5ee2afaf87b258f0f692c32d17866114a996eb66
Author: Zhe Li <zheliooo@google.com>
Date: Mon Apr 20 13:08:32 2026 -0700
[TabFavicon] Do not fallback to host for tab switcher and tab strip
- Guarded behind feature flag sFaviconDisableHostFallback.
- Sets `fallbackToHost = false` in LayerTitleCache.java and TabListFaviconProvider.java when feature is enabled.
- Default `fallbackToHost = true` for all the other callsites.
- Added histograms Favicons.AndroidHostFallbackFetchResult.* in favicon_helper.cc
Bug: 468979189
Change-Id: I5574adf85647c1d5205889dddc2bc42bfba35305
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7745223
Reviewed-by: Theresa Wellington <twellington@chromium.org>
Commit-Queue: Zhe Li <zheliooo@google.com>
Auto-Submit: Zhe Li <zheliooo@google.com>
Cr-Commit-Position: refs/heads/main@{#1617726}
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/5ee2afaf87b258f0f692c32d17866114a996eb66
commit 5ee2afaf87b258f0f692c32d17866114a996eb66
Author: Zhe Li <zheliooo@google.com>
Date: Mon Apr 20 13:08:32 2026 -0700
[TabFavicon] Do not fallback to host for tab switcher and tab strip
- Guarded behind feature flag sFaviconDisableHostFallback.
- Sets `fallbackToHost = false` in LayerTitleCache.java and TabListFaviconProvider.java when feature is enabled.
- Default `fallbackToHost = true` for all the other callsites.
- Added histograms Favicons.AndroidHostFallbackFetchResult.* in favicon_helper.cc
Bug: 468979189
Change-Id: I5574adf85647c1d5205889dddc2bc42bfba35305
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7745223
Reviewed-by: Theresa Wellington <twellington@chromium.org>
Commit-Queue: Zhe Li <zheliooo@google.com>
Auto-Submit: Zhe Li <zheliooo@google.com>
Cr-Commit-Position: refs/heads/main@{#1617726}