Commit Graph
321 Commits
Author SHA1 Message Date
AlexeyBarabash 2304174ac8 [cr146][Android] isInNarrowWindowOnTablet was moved from NewTabPageLayout to NtpCustomizationUtils`
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
2026-02-26 13:47:51 +00:00
AlexeyBarabash a41bfd8044 [cr146][Android] SearchEngineAdapter.ctor change
New arg siteSearchClickHandler

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/ce9bd0417d1e559e2d3ae5f8b19ee1530b62c369

	Site Search: Add site search setting entry

	This CL adds a "Manage search engine and site search entry" in existing
	Search Engine Settings page. This advanced setting option will be
	displayed based on omnibox site search feature flag.

	Bug: 459588730
	Change-Id: I5c1c806f8d0fcec40b87cb94b31573317696d28c
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7494099
2026-02-26 13:47:50 +00:00
AlexeyBarabash 9a0f6e0556 [cr146][Android] Cleanup of unused BraveNewTabPageLayout overrides
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
2026-02-26 13:47:45 +00:00
Serg c405b65020 [Android] Always show download location dialog when user opts in (#34186)
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
2026-02-25 20:05:42 +00:00
Serg 4939f3c098 [Android] Fix NPE in HomeSurfaceTracker on activity resume (#34114)
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
2026-02-23 22:05:42 +00:00
Serg 461d66e02c [Android] Shows Brave Wallet UI based on policy. (#33630)
* [Android] Shows Brave Wallet UI based on policy.

Resolves: https://github.com/brave/brave-browser/issues/52496
2026-02-04 10:08:30 -05:00
Serg bd7950d53a [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. (#33569)
[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
2026-02-02 23:49:25 +00:00
Artem Samoilenko a217dc1088 [cr145][Android] Convert ToolbarManager.ConstraintsSupplier to a TransitiveObservableSupplier
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/86102b4bc68e75d3d392be417f8208697701184e

commit 86102b4bc68e75d3d392be417f8208697701184e
Author: Andrew Grieve <agrieve@chromium.org>
Date:   Wed Dec 10 14:29:26 2025 -0800

    Convert ToolbarManager.ConstraintsSupplier to a TransitiveObservableSupplier

    Bug: 467389696
    Change-Id: Iccda1bc4dd1f13c7d5444364f44f8ce5de417d5f
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7242146
    Commit-Queue: Andrew Grieve <agrieve@chromium.org>
    Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1556976}
2026-01-29 13:40:31 -05:00
Serg 4ab77b35ea [Android] Shows Brave VPN UI based on policy. (#33467)
Resolves: https://github.com/brave/brave-browser/issues/52355
2026-01-28 18:56:10 +00:00
Serg 49c34d0a46 [Android] Fixes a crash inside ReturnToChromeUtil.showHomeSurfaceUiOnNtp when HomeSurfaceTracker object is null. (#33408)
[Android] Fixes a crash inside ReturnToChromeUtil.showHomeSurfaceUiOnNtp
when HomeSurfaceTracker object is null.

Resolves: https://github.com/brave/brave-browser/issues/52283
2026-01-26 19:13:05 +00:00
samartnik bd2d4b53df [cr144][Android] Additional fixes for adaptive toolbar buttons (#33066)
* [cr144][Android] Additional fixes for adaptive toolbar buttons

This is additional fixes for the following change https://github.com/brave/brave-core/commit/de0e4fcc2f620c6c725093ab5626adb9b120e061

* Presubmit fixes

* Additional presubmit fixes
2026-01-07 15:41:18 -05:00
AlexeyBarabash 28361e4dcc [cr144][Android] New arg disableVerticalScrollbar at AppMenu.ctor
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/8e315f852b47633601696f1fab3ec20cac370730

	[Zoom Indicator] Disable scrollbars for the app menu list.

	Adds android:scrollbars="none" to the ListView in app_menu_layout.xml to
	prevent scrollbars from being shown. This is done programmatically to
	flag guard it. will move it to xml once launched.

	Bug: 463395239
	Change-Id: I75758df978423481d4a44ca995c8030279719749
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7204847
2025-12-21 17:13:28 -05:00
AlexeyBarabash af75c9064c [cr144][Android] New arg clientPackageName at BaseCustomTabRootUiCoordinator.ctor
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/02817219ab601f30168893303c8851195e89f200

	Window Controls Overlay on Android: Toggle button

	Similar to the UI for Window Controls Overlay on other platforms,
	provide a toggle button to enable/disabled the Window Controls
	Overlay.

	Other platforms use single chevron for the toggle button. However,
	this looks very similar to a chevron that is present in Android's
	desktop windowing system UI. Use unfold icons instead for
	differentiation.

	Screenshots:
	When disabled, to enable: https://drive.google.com/file/d/1jxs5koZg0kffQEBFaHWy-P8y8PAdN2HU
	When enabled, to disable:
	https://drive.google.com/file/d/1tsL3jmk93XUVO464LwlRweYO7ebzvpbk/view?usp=drive_link

	Fixed: 447455087
	Change-Id: I11f50cf9e7bf5e93967cec2aac18e7860a97eac1
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7069865
2025-12-20 23:56:15 +00:00
AlexeyBarabash 855a518957 [Android] Fix for misaligned MVT area (#32806)
* [Android] Fix for misaligned MVT area

Regression was introduced between
`Nightly v1.85.63 (Chromium 141.0.7390.108)` and
`Nightly v1.85.70 (Chromium 142.0.7444.23)`.

Resolves https://github.com/brave/brave-browser/issues/51406

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/90a9724173475c0c3913a7cb9ca619d2458b1d08

	[SurfacePolish][CleanUp] Clean up surface polish code for MVT (Part 3)

	This CL represents part 3 of the cleanup for the surface polish code in
	the MVT, focusing on refining the code associated New tab page.

	Low-Coverage-Reason: TRIVIAL_CHANGE This CL cleans up the NewTabPageLayout code by deleting unused code and updating variable names.
	Bug: 331667743
	Change-Id: Idaaab489aa72714d4cd294ac86cc86b1dbe20065
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5591789
2025-12-12 21:56:46 +00:00
samartnik 7d939c6c4f [CodeHealth][Android] Remove obsolete adjustment for menu footer (#32617) 2025-12-01 15:51:22 -05:00
Szilard Szaloki 7a8a6f166b Disables pull-to-refresh in the Brave Account dialog on Android (#32595) 2025-12-01 18:53:03 +01:00
samartnik b5d1940f4f [cr143][Android] Deprecate TabGroupModelFilterImpl (#32554)
* [cr143][Android] Deprecate TabGroupModelFilterImpl

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/74591e3cce051612058a135c4b7fd55aab1d6320

commit 74591e3cce051612058a135c4b7fd55aab1d6320
Author: Calder Kitagawa <ckitagawa@chromium.org>
Date:   Thu Oct 23 07:08:09 2025 -0700

    [Tab Collection] Publicize deprecation more loudly

    Bug: 454344854
    Change-Id: I7fd5f9af32a76f0c1b8a7e131879d75cbb87dd3e
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7079335
    Auto-Submit: Calder Kitagawa <ckitagawa@chromium.org>
    Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org>
    Reviewed-by: Dan Polanco <polardz@google.com>
    Commit-Queue: Dan Polanco <polardz@google.com>
    Cr-Commit-Position: refs/heads/main@{#1534290}

* Presubmit fixes
2025-11-26 11:04:38 -05:00
Serg 86a4887089 Android new tab page ab test (#32464)
* [Android] Fresh NTP after idle experiment.

Introduces 4 different variants whether to show NTP or not when Brave
is foregrounded.
Resolves: https://github.com/brave/brave-browser/issues/50989
2025-11-21 17:32:50 -05:00
Artem Samoilenko 3f56de865e [cr143][Android] shouldShowDeleteButton is package available now
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/565cfd616cb5b812fa1f4a2c8eee4465dd5542b1

commit 565cfd616cb5b812fa1f4a2c8eee4465dd5542b1
Author: Charles Hager <clhager@google.com>
Date:   Thu Oct 2 12:03:29 2025 -0700

    Add width consumer for the location bar buttons

    This adds a new ToolbarWidthConsumer for the location bar's buttons
    (install, mic, lens, bookmark). The exact order is arbitrary, as
    the buttons are all roughly the same priority other than the bookmark
    button being the highest priority to keep visible.

    https://screencast.googleplex.com/cast/NDkzNjUwODY4MjI3Mjc2OHwyZjNlYjhlMC00ZA

    Bug: 427260734
    Change-Id: Icf0ed2bcf86886ee7806d8c7bd4d9c081268debe
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6945458
    Reviewed-by: Patrick Noland <pnoland@chromium.org>
    Commit-Queue: Charles Hager <clhager@google.com>
    Reviewed-by: Sirisha Kavuluru <skavuluru@google.com>
    Cr-Commit-Position: refs/heads/main@{#1524367}
2025-11-18 11:18:40 -05:00
Simone Arpe 315796e80c Reset scroll position for Brave overflow main menu when it's shown (#32323)
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`.
2025-11-17 16:12:05 +01:00
Serg d1c604c508 Android fresh ntp after idle (#32132)
[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
2025-10-31 09:35:04 -04:00
Artem Samoilenko e6a41c731b [cr143][Android] Changes for MVT container sizing and centering on Tablets
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/a11ac5d97f40076f5d1502084c6ef8972cff2a22

commit a11ac5d97f40076f5d1502084c6ef8972cff2a22
Author: Samuel Huang <huangs@chromium.org>
Date:   Thu Oct 2 12:00:50 2025 -0700

    [MVT] Fix MVT container sizing and centering on Tablets.

    By "blocks" we include MVT tiles and the "Add now" button.

    On Tablets, blocks and its container have special behavior:
    1. Depending on **initial** block count, these render in modes:
      * Centered: With "few" blocks present: The container is WRAP_CONTENT,
        and "edge margins" (outer margin of outer blocks) expanded so blocks
        are centered and immobile.
      * Overflowed: With "many" blocks present: The container is
        MATCH_PARENT, and "edge margins" are assigned a fixed value. The
        blocks become scrollable.
    2. When changing from "many" blocks to "few" blocks, the Overflowed
       state remains. In this case, blocks no longer scroll, and are start-
       aligned instead of centered.

    (2) was intentional, presumably to reduce tiles "jumping" on repeated
    tile removal. NewTabPageLayout (for container) and TilesLinearLayout
    (for "edge margins") implemented this by doing the following:
    * Store initial tile count and block count.
    * Use these counts and width constants to compute "content width".
    * If "content width" <= "container" size then Centered (AKA "full
      filled", "all filled"); else Overflowed.

    Now, MVT on tablets has some longstanding oddities
    O1. When Centered, the container might not reach full width.
    O2. Container may shrink on repeated tile removal (and centered) --
        this is a cross between Centered (re. WRAP_CONTENT) and Overflowed
        (re. fixed "edge margin") modes.
    O3. When changing from "few" blocks to "many" blocks (by adding Custom
        Tiles), Overflow mode does kick in sometimes, leading to blocks
        appearing off-screen but cannot be scrolled to.

    This CL fixes the oddities and removes behavior (2); now Centered and
    Overflowed behavior depends on **current** (instead of the initial)
    block count -- this fixes (O3). High level changes:
    * Stop storing initial tile and block counts.
    * Centralize Centered / Overflowed decision, including "content width"
      computation, to MostVisitedTilesLayout.
    * Change MVT child addition semantics from {Tile, non-Tile} to
      {Tile, Divider, UI View (for the "Add new" button)}.

    Bugs that were found and fixed:
    * The duplicated Centered / Overflowed decision logic were inconsistent;
      the NewTabPageLayout version (for WRAP_CONTENT / MATCH_PARENT) didn't
      account for Custom Tile changes, i.e., divider & "Add new" button.
      This led to (O2), and is fixed when we dedup the logic.
    * When "divider gap" was changed to same as "tile gap" in
      crrev.com/c/6780677 , we didn't update "content width" calculation.
      This also led to (O2), and is fixed by having dividers not contribute
      to "content width".
    * Resources.getDimension() returns (float) PX value, and NOT DP. The
      misunderstanding led to explicit conversions that made the width of
      the "Add new" too large (TileRenderer.renderTileSection()). This led
      to (O1). Fixing this also simplified code.

    Bug: 447086773, 388782412
    Change-Id: Id1400e672f1f0be11b4cc218cd20521988c3455f
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7004884
    Commit-Queue: Samuel Huang <huangs@chromium.org>
    Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
    Reviewed-by: Xi Han <hanxi@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1524365}
2025-10-15 20:31:33 -04:00
AlexeyBarabash 6803b08075 [cr142][Android] Changed RadioButtonGroupHomepagePreference inheritance
Now it inherits from ContainedRadioButtonGroupPreference

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/ad3115b167680b6c3a587069941f83a63c6256c7

	[Settings containment] Apply containment to all radio buttons

	Refactor several radio button group preferences to use the new
	`ContainedRadioButtonGroupPreference` base class. This standardizes the
	implementation of radio button group preferences, reducing code
	duplication.

	The new base class removes the outer container's background, allowing
	the individual radio buttons to be styled directly.

	Address bar: https://screenshot.googleplex.com/6SNakREKsjgMvFj.png
	Preload page: https://screenshot.googleplex.com/6yVGFQ3ccWBUu3j.png Safe
	Browsing: https://screenshot.googleplex.com/7GadBndKtw8Dbr7.png Toolbar
	shortcut: https://screenshot.googleplex.com/9Z42rqKxV4pnasx.png

	Bug: 433576895, 439725777
	Change-Id: Ibb8d0c3961055e7dfe0c567369129cedc612f59c
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6968649
2025-10-15 20:31:12 -04:00
AlexeyBarabash cc73f0c490 [cr142][Android] AutocompleteMediator.ctor is now of package visibility level
Requres to adjust proguard flags for bytecode tests

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/2747c27c571886bc1a646c4ab9eb1fa46c4b29fd

	Use event-driven supplier for fulfillment type

	Replace the polling-based `isUsingAiMode()` method with an event-driven
	`ObservableSupplier` that reports the `NavigationFulfillmentType`.

	This refactoring allows consumers like the LocationBar and Autocomplete
	systems to react dynamically to changes in the fulfillment mode (e.g.,
	switching between DEFAULT and AI_MODE) without needing to continuously
	poll for the current state.

	As a direct benefit, the LocationBar now observes this supplier to
	hide the Lens button when the fulfillment type is AI_MODE, ensuring
	the UI accurately reflects the available actions.

	Bug: 436888404
	Change-Id: Iae4df3f4fc6f5d2e298765a823b3ad61aa9f1512
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6943716
2025-10-15 20:30:59 -04:00
samartnik 913ac8df16 [Android] Disable quick shortcut toggle by default (#31567)
* [Android] Disable quick shortcut toggle by default

* Fixes for JUnit tests
2025-10-02 06:39:03 -04:00
samartnik bd57c6c37b [Android] Update header image for quick shortcuts and optimization (#31528)
* [Android] Update header image for quick shortcuts and optimization

Optimizations done:
- Initialize leo and wallet controllers regardless if feature enabled or not. This is because at this point native is not guaranteed to be initialized to check the feature. Check for option visibility is done in `BraveRadioButtonGroupAdaptiveToolbarPreference` instead.
- Override `buildUiStateForStats` to avoid asserts on Brave specific options.

* Fix for tests

* Fix for JUnit tests
2025-10-01 09:35:18 -04:00
Artem Samoilenko 55e9c08085 [cr141][Android] Updates for OmniboxMobileParityUpdate feature
Now search engine icons are shown in the url bar on NTP as a status icon just like on desktop.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/0fd2771ccfaf4bf698471dd69661239eaa7730e4

commit 0fd2771ccfaf4bf698471dd69661239eaa7730e4
Author: Tomasz Wiszkowski <ender@google.com>
Date:   Wed Aug 6 09:49:59 2025 -0700

    Clean up OmniboxMobileParityUpdate experiment

    The change is not thorough to reduce review strain (it's large as it
    is).

    Change-Id: I118b31a8e1c37bc1fb6badf3a270fadc225e62a7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6821564
    Reviewed-by: Patrick Noland <pnoland@chromium.org>
    Commit-Queue: Tomasz Wiszkowski <ender@google.com>
    Cr-Commit-Position: refs/heads/main@{#1497666}
2025-09-22 14:59:51 -04:00
Artem Samoilenko 022a13c022 [cr141][Android] Consolidate single-tab reparenting into multi-tab methods
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/09316976243447de4c0b3979b3c00c747792fa98

commit 09316976243447de4c0b3979b3c00c747792fa98
Author: Hitarth Kothari <hitarthkothari@google.com>
Date:   Tue Aug 12 13:48:48 2025 -0700

    Consolidate single-tab reparenting into multi-tab methods.

    This change renames `ReparentingMultiTabTask` to `ReparentingTabsTask`
    and updates its `begin` method to accept additional parameters. All
    instances of moving a single tab are now handled by the
    `moveTabsToWindow` and `moveTabsToNewWindow` methods by passing a
    `Collections.singletonList` containing the single tab. This removes
    redundant single-tab reparenting methods from `MultiInstanceManager` and
    its implementations.

    Bug: 432819744
    Change-Id: I03394cbd3ae0f9afb49065d40a4271c2adcbc78e
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6841517
    Auto-Submit: Hitarth Kothari <hitarthkothari@google.com>
    Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org>
    Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1500399}
2025-09-22 14:59:36 -04:00
Artem Samoilenko 837759aa3f [cr141][Android] New param for DropdownItemViewInfoListBuilder
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/e7b3061a6b33a2fe6ce4cffe0e78d5aee76933b0

commit e7b3061a6b33a2fe6ce4cffe0e78d5aee76933b0
Author: Tomasz Wiszkowski <ender@google.com>
Date:   Fri Aug 8 10:09:06 2025 -0700

    Reflect Omnibox placement in refine arrow direction.

    The change propagates the Toolbar position down the Autocomplete UI
    stack allowing the suggestions to reorient their UI in response to the
    toolbar position change.

    Change-Id: Ia28e8d7d4dbf0da5133ca3768e3356ba98c63a48
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6829043
    Commit-Queue: Tomasz Wiszkowski <ender@google.com>
    Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1498883}
2025-09-22 14:59:29 -04:00
Artem Samoilenko 6231ae60f0 [cr141][Android] Remove duplicated code in SystemAccountManagerDelegate
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/4ba632db1601435a435daa1578887efc26061e39

commit 4ba632db1601435a435daa1578887efc26061e39
Author: Liza Bipin <mlbipin@google.com>
Date:   Wed Aug 6 08:53:51 2025 -0700

    [Signin][Android]Remove duplicated code in SystemAccountManagerDelegate

    Rename the class to be more reflective of current implementation. See
    crbug.com/429143376#comment3 for more context.

    Bug: 429143376
    Change-Id: I7883533dd7edc61516f24064bb457eb23752e10e
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6818502
    Commit-Queue: Liza Bipin <mlbipin@google.com>
    Reviewed-by: Boris Sazonov <bsazonov@chromium.org>
    Reviewed-by: Liza Bipin <mlbipin@google.com>
    Cr-Commit-Position: refs/heads/main@{#1497626}
2025-09-22 14:59:26 -04:00
samartnik a15ed443a5 [Android] Initial integration of Brave adaptive buttons (#31303)
* [Android] Initial integration of Brave adaptive buttons

The Bookmarks button is the first in the list; the rest of the buttons will be added in separate PRs.

Important notes:
- override via `chromium_src` doesn't work for `patches/chrome-browser-ui-android-toolbar-adaptive_toolbar_enums.h.patch` since this file is parsed by `java_cpp_enum.py` to convert it to java enum
- patch to `java_cpp_enum.py` was added to be able to do 1 line patch, since upsteam parses each value as a separate line
- in `patches/chrome-browser-ui-android-toolbar-adaptive_toolbar_enums.h.patch` were added values for all planned Brave buttons to avoid additional patching for each consecutive PR

* Python patch optimisations

* Presubmit fixes

* Remove python patch in favour of multiline header patch
2025-09-22 10:33:12 -04:00
samartnik d8cd91653c [Android] Fix for the bottom padding of the main menu (#31315) 2025-09-22 07:56:03 -04:00
AlexeyBarabash 1bdfeecdb5 [cr140][Android] Fixed color of search your downloads textbox (#30856)
* [cr140][Android] Fixed color of search your downloads textbox

The color `@color/toolbar_text_box_bg_color` was used which does not
depend on Brave's color accent.

Resolves https://github.com/brave/brave-browser/issues/48702

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/e2ecd7051160bea613211a3943155a09b1ad62cc

	Implement new Download page UI for LFF devices

	Implements the new UI for the Download Manager page on large-screen
	devices based on the approved UX spec, http://shortn/_9stIgUxL1u.

	UI behavior after changed: http://shortn/_FOLyyoTdOG

	Bug: 422042079
	Test: chrome://downloads should match UI team's design on LFF device
	Change-Id: Ieb77fcd38d86fd023a149c8186fc1de84819bb60
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6733725
2025-09-01 18:33:20 +03:00
AlexeyBarabash d7256b1461 [cr140][Android] Backport built-in Password Manager (#30433)
Starting from cr140 Password manager was removed from Android.

This commit switches Android to use the same PasswordManagerSettingsService
as Desktop does.
Also backports upstream's Password Manager classes and resources used at cr139.

Chromium changes:

https://source.chromium.org/chromium/chromium/src/+/7511b67d9208bd10463c1e5752976346ab6bd207
	[LoginDbDeprecationAndroid] Remove last usages and delete the flag

https://source.chromium.org/chromium/chromium/src/+/5794e9a0461497b7b810e9366c1c53eab711b6f2
	[passwords/android] Limit kPasswordsUseUPMLocalAndSeparateStores access

https://source.chromium.org/chromium/chromium/src/+/6875d2ce472e7f2097617525feec45313602e225
	[passwords/android] Remove unused password checkup UI

https://source.chromium.org/chromium/chromium/src/+/3662471ee9fabd6d1777b1d5316f0b9eede0f115
	[passwords/android] Remove unused PasswordSettings.java

Or see the log for `chrome/browser/password_manager/android/` directory
https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/password_manager/android/;bpv=1
2025-08-20 01:06:59 +03:00
AlexeyBarabash 7a669d2941 [cr140][Android] Renamed MultiInstanceManagerApi31.moveTabAction to moveTabToWindow
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/d93b06c6a2b4deae42d1271c498817a2def6810c

	Implement "move to another window" submenu on tab context menu

	Also includes refactoring for MultiInstanceManager.getInstanceInfo and click listeners on TabOverflowMenu

	Demo: https://screencast.googleplex.com/cast/NDc1NjkyMDM2MjU5ODQwMHw0NjQyNzk5OC05Nw

	Bug: 402164499
	Change-Id: I3e0f9e03ddefc63aec535f603b78e1747a5060e8
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6795706
2025-08-19 19:54:33 +01:00
AlexeyBarabash 3a31b31511 [cr140][Android] Changes at NewTabPageLayout
- updated new_tab_page_layout.xml;
- renamed insertSiteSectionView to initializeSiteSectionView

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/e6fb5317f5439ed23952329bd901cca10ad70dbd

	Remove Unnecessary MVT FrameLayout

	This CL is a follow-up to
	https://chromium-review.googlesource.com/c/chromium/src/+/6771167, which
	removed the unused placeholder for the Most Visited Tiles (MVT) section.

	With the placeholder gone, we no longer need to switch visibility
	between it and the mv_tiles_layout at the MVT section's position.
	Therefore, this CL removes the FrameLayout that previously wrapped both
	the mv_tiles_layout and the placeholder.

	Bug: 421436204
	Change-Id: I8937fcca9dcee78be2a3e3a994ed5aca251c5cd6
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6777058
2025-08-19 19:54:28 +01:00
AlexeyBarabash 065fd1602c [cr140][Android] Delete Most Visited Tiles placeholder from NTP
Removed noMvPlaceholderStub arg from MostVisitedTilesMediator.ctor
Removed MostVisitedTilesMediator.updateTilePlaceholderVisibility

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/d67f572a5aa967e71a3fa5cbe8fd434be9933eb5

	Delete Most Visited Tiles placeholder from NTP

	This CL removes the "mv_tiles_placeholder_stub" view as it never
	actually appears in the New Tab Page (NTP) UI.

	The placeholder's visibility is set to View.VISIBLE when no tiles are
	present. However, its parent, mv_tiles_container, is only visible if and
	only if there are tiles to display. Consequently, if no tiles are
	present, "mv_tiles_container"'s visibility is View.GONE, preventing its
	child, "mv_tiles_placeholder_stub", from ever being rendered on the NTP.

	This CL deletes all related placeholder logic from the view binder, view
	properties, mediator, XML, PNG files, and tests.

	Bug: 421436204
	Change-Id: Iab3a2288a97dcfa2e7c137d5b1d6e7521a07176e
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6771167
2025-08-19 19:54:27 +01:00
AlexeyBarabash 9da25f057c [cr140][Android] Fixed java.lang.VerifyError at RedirectTabCreator class
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/7211ad73ee02dd19c83cb64c27fca687a7ed8344

	Add RedirectTabCreator

	- Add int enum SupportedProfileType to ChromeTabbedActivity to determine
	the type of tab/profile the activity supports.
	- Add RedirectTabCreator to create new tabs in another window.
	- Add method in MultiWindowUtils to get foreground CTA with matching
	profile.

	This change affects the "Open in incognito tab" option, which is
	accessible from the web content context menu, the New Tab Page (NTP)
	most visited tiles, and the NTP news feed.
	When selected, content will open in an incognito tab as follows:
	1. New Window: If there is no adjacent window, or if the adjacent
	window is a regular (non-incognito) window.
	2. Adjacent Window: If the adjacent window is already incognito.

	Bug: 429518553
	Change-Id: Ic3f1744dcfaf34cc87dc74c0ba5d72de7d2e5ced
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6720784
2025-08-19 19:54:26 +01:00
AlexeyBarabash 63d7f64469 [cr140][Android] CustomTabFeatureOverridesManager was removed
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/ec3cf2613084e5182c782597546deca62ac15598

	Clean up CCT feature overrides

	Bug: 427494350
	Change-Id: If7fda6786b3b092262a10f37221520c45cea3dff
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6769954
2025-08-19 19:54:25 +01:00
AlexeyBarabash 3a554ef2cb [cr140][Android] NewTabPage.updateSearchProviderHasLogo is updateSearchProvider
Method was renamed and its functionality was extended

Chromium change:
https://source.chromium.org/chromium/chromium/src/+/d8028afc93a2dc4074fedeae232ba5e7cac40273

	[ParityV2] Show fake search box for 3p DSE.

	In this CL, we show fake search box for 3p DSE without logo in both
	phones and tablets. A temporary top margin is added to the fake search box. We also adjust NtpFakeSearchBoxTransitionStartOffset to
	prevent the search box's alpha is set 0 (transparent) on tablets.
	Screenshots: http://shortn/_qHQjTnhSYU

	Bug: 426594110
	Change-Id: If81df470078dfd24d28fcaf6107bcc401691e985
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6676222
2025-08-19 19:54:18 +01:00
samartnik f536ed9c59 [Android] Initial integration of quick shortcut button (#30242)
* [Android] Initial integration of quick shortcut button

- Adds flag for quick shortcut (disabled until all Brave items are available)
- Makes parity with options available with the upstream
- Visual and UI fixes

* Moves flag under Android guards
2025-07-25 06:57:22 -04:00
AlexeyBarabash ee4763b704 Add version param to the android crash dump uploader (#30112)
* Add version param to the android crash dump uploader

Resolves https://github.com/brave/brave-browser/issues/47614
2025-07-20 10:55:10 +03:00
samartnik 57c2fb6bb5 [Android] Remove Copy link menu item from long press menu (#29954) 2025-07-18 08:14:58 -04:00
Artem Samoilenko b47e3d64c8 [cr139][Android] Repurpose TabUiThemeUtils to TabCardThemeUtil
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/2fdcb256b8087a48869e62d9b3186bcd0837e3db

commit 2fdcb256b8087a48869e62d9b3186bcd0837e3db
Author: Hitarth Kothari <hitarthkothari@google.com>
Date:   Wed Jun 11 12:57:07 2025 -0700

    Repurpose TabUiThemeUtils to TabCardThemeUtil

    Bug: 415289222
    Change-Id: I37f020435d44e5b17f776df12a56ecd773cf5f1a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6635533
    Auto-Submit: Hitarth Kothari <hitarthkothari@google.com>
    Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org>
    Reviewed-by: Calder Kitagawa <ckitagawa@chromium.org>
    Commit-Queue: Hitarth Kothari <hitarthkothari@google.com>
    Reviewed-by: Sky Malice <skym@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1472629}
2025-07-16 13:38:37 -04:00
Artem Samoilenko 84016f4011 [cr139][Android] Remove XML inflation of the main menu
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/77f042119bba825077be9212045a8f9fe2a7bb29

commit 77f042119bba825077be9212045a8f9fe2a7bb29
Author: Ted Choc <tedchoc@chromium.org>
Date:   Fri May 30 08:04:37 2025 -0700

    Remove XML inflation of the menu for tabbed mode.

    Removes all the legacy code dealing with Android Menu
    inflation as well.

    Bug: 40145539
    Change-Id: I905530ca4727d0ab885e5c8b67010dd2f650cc91
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6605931
    Reviewed-by: Theresa Sullivan <twellington@chromium.org>
    Commit-Queue: Ted Choc <tedchoc@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1467479}
2025-07-16 13:38:22 -04:00
Serg 4981161b3e Android infobars are rendered incorrectly with gesture navigation (#29671)
Ads info bar cut at the bottom when gesture navigation is enabled on
device. Adds extra padding in such cases.
Resolves: https://github.com/brave/brave-browser/issues/46513
2025-06-20 20:16:23 -04:00
AlexeyBarabash 3e238531f7 [cr138][Android] Fixed app menu and pull to refresh
With Brave asm patching classes inheritence is

```
ChromeTabbedActivity extends BraveActivity
BraveActivity extends ChromeActivity
```

With a new argument at `ChromeTabbedActivity.onMenuOrKeyboardAction` line
`return super.onMenuOrKeyboardAction(id, fromMenu, triggeringMotion);` invoked
not BraveActivity's method but ChromeActivity's one.
This broke app menu and pull to refresh gesture.
Compiler didn't give any warnings, so I added a testcase.

Chromium changes:
https://source.chromium.org/chromium/chromium/src/+/34d6b8ab128e787fdbf4c8bcf93e23ece93c0aa0
	Pass triggeringMotionEvent from AppMenu to onMenuOrKeyboardAction()

	This CL is a no-op. It only changes method signatures.

	Context:

	* Tab closure will have different behavior depending on whether a click
	  came from a peripheral. For example, when using a peripheral to close
	  all tabs via the app menu, we don't want to show the "undo" snackbar.

	* With http://crrev.com/c/6555582, we are able to obtain the
	  MotionEvent that triggered a click on an AppMenu item, so we can use
	  it to differentiate between peripheral clicks and other clicks.

	* This CL passes the click-triggering MotionEvent from
	  AppMenuItemViewBinder to
	  MenuOrKeyboardActionController.onMenuOrKeyboardAction() where the
	  actual click-handling logic lives.

	  Similar work was done for the grid tab switcher:
	  http://crrev.com/c/6521282.

	* The change involves a few interfaces. The code path is:
	  AppMenuItemViewBinder ->
	    [interface] AppMenuClickHandler.onItemClick() ->
	       [impl] AppMenu.onItemClick()
	    AppMenuHandlerImpl.onOptionsItemSelected() ->
	    [interface] AppMenuDelegate.onOptionsItemSelected ->
	      [impl] ChromeActivity.onOptionsItemSelected()
	      [impl] CustomTabActivity.onOptionsItemSelected()
	    [interface] MenuOrKeyboardActionController.onMenuOrKeyboardAction()
	      [impl] ChromeTabbedActivity.onMenuOrKeyboardAction()
	      [impl] ChromeActivity.onMenuOrKeyboardAction()
	      [impl] BaseCustomTabActivity.onMenuOrKeyboardAction()
	      [impl] CustomTabActivity.onMenuOrKeyboardAction()
	      [impl] WebappActivity.onMenuOrKeyboardAction()
	  This CL adds the click-triggering motion event as a parameter of the
	  methods above.

	* To limit the scope of the CL, current interface methods are kept as
	  default implementation. For example:

	  ```
	  public interface AppMenuClickHandler {

	    // Generally there's no need to override this method.
	    default void onItemClick(/* current params */) {
	      onItemClick(
		/* current params */, /* triggeringMotionEvent= */ null);
	    }

	    // Implementations should always implement this method.
	    void onItemClick(
	      /* currentParams */, MotionEvent triggeringMotionEvent);
	  }
	  ```

	Bug: 375468032
	Change-Id: I90019b2c02f54af6123280e4099c1b1dbcede585
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6557444

and

https://source.chromium.org/chromium/chromium/src/+/01b2bf1ec0c43a1924269c22c07ff7a2cbccb6d7
	Consolidate how MotionEvent info is passed for tab closure

	TL;DR:
	* This CL is a no-op; it only changes method signatures.
	* Reviewers: please follow the "Changes" section below to get a clearer
	  view of the changes.

	Context:

	We needed info from the MotionEvent that triggered a click to
	differentiate between a peripheral click and other clicks so that tab
	closure behavior can be customized. For example, we don't want to show
	the undo snackbar when a tab is closed by a peripheral.

	Multiple UI surfaces have been updated so far, and we used two ways to
	pass MotionEvent info.
	(1) For a View that has OnClickListener:
	    We attach an OnPeripheralClickListener to intercept MotionEvents
	    from peripherals, then pass the raw MotionEvent to the
	    click-handling logic.
	(2) For a ListView that relies on OnItemClickListener instead of adding
	    OnClickListener to its individual child Views:
	    We use TouchTrackingListView to watch (but not intercept) touch
	    events and store the last relevant event as a state. Then, when
	    OnItemClickListener is triggered, a child View can query that state
	    to get motion info.
	    Since MotionEvent will be recycled by Android framework, the state
	    is in the form of a plain old data class containing motion info
	    (ListViewTouchInfo).

	So far the UI surfaces are either (1) or (2) at compile time. However,
	there is at least one place that are both (1) and (2) at compile time.
	They become either (1) or (2) at runtime depending on the
	usage/configuration. TabListEditorMenu is one example.

	To better support such places, we need to consolidate how motion info is
	passed for (1) and (2) so that the click-handling methods can have a
	single signature:
	* Instead of:
	  * handleClick(MotionEvent) // for (1)
	  * handleClick(ListViewTouchInfo) // for (2)
	* It would be better to have:
	  * handleClick(MotionEventInfo) // for both (1) and (2)

	Changes:

	* Move ListViewTouchInfo out of ListViewTouchTracker, to
	  //browser_ui/util/motion/MotionEventInfo.
	  We will use this class to pass motion info around for both (1) and
	  (2).

	* Update OnPeripheralClickListener to pass the new MotionEventInfo
	  object instead of a raw MotionEvent.

	* The rest of the CL is to fix method signatures for the two changes
	  above.

	Note:
	Generally it's also safer to pass motion info as a data object instead
	of using a raw MotionEvent since the correctness of the latter requires
	the MotionEvent not to be recycled by the Android framework before it's
	read.

	Bug: 375468032
	Change-Id: I19c0a468761403a7fa29d072e9b51ff73013dc5c
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6565526
2025-06-11 17:07:44 -04:00
AlexeyBarabash c0e9f072f9 [cr138][Android] New arg webAppThemeColorProvider at BaseCustomTabRootUiCoordinator.ctor
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/55bc1473c10ac7470c2c2133d26d69c936bdc502

	[Minimal UI] Add ThemeColorProvider for browser services

	Adding a new ThemeColorProvider that targets browser services
	primary color calculations based on the web app manifest and
	Chrome default theme. It doesn't add anything new in color calculations
	themselves, but rather extracts existing logic from
	CustomTabColorController to share with other UI controls like web app
	header.

	Focused/unfocused primary color will be implemented in scope of
	another task.

	Bug: 396101424
	Change-Id: I2ee3712725e9e1069a1e30c9dccbd33a4af8ce1b
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6487756
2025-06-11 18:56:28 +01:00
Serg 9dd413a1e0 Use correct profile for Android url sanitizer service (#29206)
* Uses a correct profile for UrlSanitizerService on Android
2025-05-29 18:25:11 +02:00
AlexeyBarabash 3d7da33b8e [Android] Prevent cleaning of tab groups without sync id (#29201)
* [Android] Prevent cleaning of tab groups without sync id 
fixes brave/brave-browser#45549
2025-05-23 23:56:25 +03:00