Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade from Chromium 118 to Chromium 119 (1.60.x) #20654

Merged
merged 9 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions android/brave_java_sources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import("//brave/android/features/tab_ui/brave_tab_management_java_sources.gni")
import("//brave/android/feed/brave_feed_java_sources.gni")
import(
"//brave/android/java/org/chromium/chrome/browser/vpn/billing/sources.gni")
import("//brave/base/brave_base_shared_preferences_java.gni")
import("//brave/browser/brave_ads/android/java_sources.gni")
import("//brave/browser/flags/brave_flags_java_sources.gni")
import("//brave/browser/incognito/android/java_sources.gni")
import("//brave/browser/preferences/brave_preferences_java_sources.gni")
import("//brave/browser/share/android/java_sources.gni")
import("//brave/components/embedder_support/android/java_sources.gni")
import("//brave/components/permissions/android/java_sources.gni")
Expand Down Expand Up @@ -300,7 +300,6 @@ brave_java_sources = [
"../../brave/android/java/org/chromium/chrome/browser/onboarding/v2/HighlightView.java",
"../../brave/android/java/org/chromium/chrome/browser/onboarding/v2/OnboardingV2Fragment.java",
"../../brave/android/java/org/chromium/chrome/browser/onboarding/v2/OnboardingV2PagerAdapter.java",
"../../brave/android/java/org/chromium/chrome/browser/paint_preview/BraveStartupPaintPreviewHelper.java",
"../../brave/android/java/org/chromium/chrome/browser/partnercustomizations/CloseBraveManager.java",
"../../brave/android/java/org/chromium/chrome/browser/password_manager/settings/BravePasswordSettingsBase.java",
"../../brave/android/java/org/chromium/chrome/browser/playlist/PlaylistHostActivity.java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import androidx.annotation.Px;

import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.jank_tracker.JankTracker;
import org.chromium.base.supplier.Supplier;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncher;
Expand All @@ -38,26 +39,58 @@ public class BraveFeedSurfaceCoordinator extends FeedSurfaceCoordinator {
// Own members.
private @Nullable FrameLayout mFrameLayoutForPolicy;

public BraveFeedSurfaceCoordinator(Activity activity, SnackbarManager snackbarManager,
WindowAndroid windowAndroid, @Nullable SnapScrollHelper snapScrollHelper,
@Nullable View ntpHeader, @Px int toolbarHeight, boolean showDarkBackground,
FeedSurfaceDelegate delegate, Profile profile, boolean isPlaceholderShownInitially,
public BraveFeedSurfaceCoordinator(
Activity activity,
SnackbarManager snackbarManager,
WindowAndroid windowAndroid,
@Nullable JankTracker jankTracker,
@Nullable SnapScrollHelper snapScrollHelper,
@Nullable View ntpHeader,
@Px int toolbarHeight,
boolean showDarkBackground,
FeedSurfaceDelegate delegate,
Profile profile,
boolean isPlaceholderShownInitially,
BottomSheetController bottomSheetController,
Supplier<ShareDelegate> shareDelegateSupplier,
@Nullable ScrollableContainerDelegate externalScrollableContainerDelegate,
@NewTabPageLaunchOrigin int launchOrigin,
PrivacyPreferencesManagerImpl privacyPreferencesManager,
@NonNull Supplier<Toolbar> toolbarSupplier, @SurfaceType int surfaceType,
long embeddingSurfaceCreatedTimeNs, @Nullable FeedSwipeRefreshLayout swipeRefreshLayout,
boolean overScrollDisabled, @Nullable ViewGroup viewportView,
FeedActionDelegate actionDelegate, HelpAndFeedbackLauncher helpAndFeedbackLauncher,
@NonNull Supplier<Toolbar> toolbarSupplier,
@SurfaceType int surfaceType,
long embeddingSurfaceCreatedTimeNs,
@Nullable FeedSwipeRefreshLayout swipeRefreshLayout,
boolean overScrollDisabled,
@Nullable ViewGroup viewportView,
FeedActionDelegate actionDelegate,
HelpAndFeedbackLauncher helpAndFeedbackLauncher,
TabModelSelector tabModelSelector) {
super(activity, snackbarManager, windowAndroid, snapScrollHelper, ntpHeader, toolbarHeight,
showDarkBackground, delegate, profile, isPlaceholderShownInitially,
bottomSheetController, shareDelegateSupplier, externalScrollableContainerDelegate,
launchOrigin, privacyPreferencesManager, toolbarSupplier, surfaceType,
embeddingSurfaceCreatedTimeNs, swipeRefreshLayout, overScrollDisabled, viewportView,
actionDelegate, helpAndFeedbackLauncher, tabModelSelector);
super(
activity,
snackbarManager,
windowAndroid,
jankTracker,
snapScrollHelper,
ntpHeader,
toolbarHeight,
showDarkBackground,
delegate,
profile,
isPlaceholderShownInitially,
bottomSheetController,
shareDelegateSupplier,
externalScrollableContainerDelegate,
launchOrigin,
privacyPreferencesManager,
toolbarSupplier,
surfaceType,
embeddingSurfaceCreatedTimeNs,
swipeRefreshLayout,
overScrollDisabled,
viewportView,
actionDelegate,
helpAndFeedbackLauncher,
tabModelSelector);
}

public void createFrameLayoutForPolicy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,32 @@
import androidx.annotation.Nullable;

import org.chromium.chrome.browser.feed.sort_ui.FeedOptionsCoordinator;
import org.chromium.components.browser_ui.widget.displaystyle.UiConfig;
import org.chromium.ui.modelutil.PropertyModel;

public class BraveFeedSurfaceMediator extends FeedSurfaceMediator {
// To delete in bytecode, members from parent class will be used instead.
private FeedSurfaceCoordinator mCoordinator;
private SnapScrollHelper mSnapScrollHelper;

BraveFeedSurfaceMediator(FeedSurfaceCoordinator coordinator, Context context,
@Nullable SnapScrollHelper snapScrollHelper, PropertyModel headerModel,
@FeedSurfaceCoordinator.StreamTabId int openingTabId, FeedActionDelegate actionDelegate,
FeedOptionsCoordinator optionsCoordinator) {
super(coordinator, context, snapScrollHelper, headerModel, openingTabId, actionDelegate,
optionsCoordinator);
BraveFeedSurfaceMediator(
FeedSurfaceCoordinator coordinator,
Context context,
@Nullable SnapScrollHelper snapScrollHelper,
PropertyModel headerModel,
@FeedSurfaceCoordinator.StreamTabId int openingTabId,
FeedActionDelegate actionDelegate,
FeedOptionsCoordinator optionsCoordinator,
@Nullable UiConfig uiConfig) {
super(
coordinator,
context,
snapScrollHelper,
headerModel,
openingTabId,
actionDelegate,
optionsCoordinator,
uiConfig);
}

@Override
Expand Down Expand Up @@ -51,7 +64,12 @@ void updateContent() {
}
}

public void destroyPropertiesForStream() {
assert false : "destroyPropertiesForStream should be redirected to parent in bytecode!";
@Override
public void onTemplateURLServiceChanged() {
if (!FeedFeatures.isFeedEnabled()) {
// We don't need any special handling since feed is disabled.
return;
}
super.onTemplateURLServiceChanged();
}
}
16 changes: 8 additions & 8 deletions android/java/apk_for_test.flags
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,13 @@
public <init>(...);
}

-keep class org.chromium.chrome.browser.preferences.ChromePreferenceKeyChecker {
*** getInstance(...);
-keep class org.chromium.base.shared_preferences.StrictPreferenceKeyChecker {
<init>(...);
*** isKeyInUse(...);
}

-keep class org.chromium.base.shared_preferences.BraveStrictPreferenceKeyChecker {
<init>(...);
}

-keep class org.chromium.chrome.browser.toolbar.BraveToolbarManager {
Expand Down Expand Up @@ -409,7 +414,6 @@
<init>(...);
*** mCoordinator;
*** mSnapScrollHelper;
*** destroyPropertiesForStream(...);
}

-keep class org.chromium.chrome.browser.feed.BraveFeedSurfaceMediator {
Expand Down Expand Up @@ -525,6 +529,7 @@
-keep class org.chromium.chrome.browser.omnibox.suggestions.AutocompleteMediator {
*** mNativeInitialized;
*** mDropdownViewInfoListManager;
*** mDropdownViewInfoListBuilder;
public <init>(...);
}

Expand Down Expand Up @@ -719,11 +724,6 @@
*** updateVisibility(...);
}


-keep class org.chromium.chrome.browser.paint_preview.StartupPaintPreviewHelper {
*** isEnabled(...);
}

-keep class org.chromium.chrome.browser.document.ChromeLauncherActivity {
public <init>(...);
}
Expand Down
69 changes: 69 additions & 0 deletions android/java/org/chromium/base/BravePreferenceKeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

package org.chromium.base;

import java.util.Arrays;
import java.util.List;

public final class BravePreferenceKeys {
public static final String BRAVE_BOTTOM_TOOLBAR_ENABLED_KEY =
"brave_bottom_toolbar_enabled_key";
Expand Down Expand Up @@ -56,4 +59,70 @@ public final class BravePreferenceKeys {
public static final String BRAVE_DEFERRED_DEEPLINK_PLAYLIST =
"brave_deferred_deeplink_playlist";
public static final String BRAVE_DEFERRED_DEEPLINK_VPN = "brave_deferred_deeplink_vpn";
public static final String BRAVE_CLOSE_TABS_ON_EXIT = "close_tabs_on_exit";
public static final String BRAVE_CLEAR_ON_EXIT = "clear_on_exit";
public static final String BRAVE_QUICK_ACTION_SEARCH_AND_BOOKMARK_WIDGET_TILES =
"org.chromium.chrome.browser.widget.quickactionsearchandbookmark.QuickActionSearchAndBookmarkWidgetProvider.TILES";

// These are dynamic keys
public static final String BRAVE_RECYCLERVIEW_POSITION = "recyclerview_visible_position_";
public static final String BRAVE_RECYCLERVIEW_OFFSET_POSITION = "recyclerview_offset_position_";

/*
* Returns the list of Brave's preference keys.
*/
private static List<String> getKeysInUse() {
return Arrays.asList(
BRAVE_BOTTOM_TOOLBAR_ENABLED_KEY,
BRAVE_BOTTOM_TOOLBAR_SET_KEY,
BRAVE_USE_CUSTOM_TABS,
BRAVE_APP_OPEN_COUNT,
BRAVE_ROLE_MANAGER_DIALOG_COUNT,
BRAVE_IS_DEFAULT,
BRAVE_WAS_DEFAULT_ASK_COUNT,
BRAVE_SET_DEFAULT_BOTTOM_SHEET_COUNT,
BRAVE_DEFAULT_DONT_ASK,
BRAVE_UPDATE_EXTRA_PARAM,
BRAVE_NOTIFICATION_PREF_NAME,
BRAVE_MILLISECONDS_NAME,
BRAVE_DOWNLOADS_AUTOMATICALLY_OPEN_WHEN_POSSIBLE,
BRAVE_DOWNLOADS_DOWNLOAD_PROGRESS_NOTIFICATION_BUBBLE,
BRAVE_DOUBLE_RESTART,
BRAVE_TAB_GROUPS_ENABLED,
BRAVE_DISABLE_SHARING_HUB,
BRAVE_NEWS_CARDS_VISITED,
BRAVE_NEWS_CHANGE_SOURCE,
BRAVE_NEWS_FEED_HASH,
BRAVE_NEWS_PREF_SHOW_NEWS,
BRAVE_NEWS_PREF_TURN_ON_NEWS,
BRAVE_USE_BIOMETRICS_FOR_WALLET,
BRAVE_BIOMETRICS_FOR_WALLET_IV,
BRAVE_BIOMETRICS_FOR_WALLET_ENCRYPTED,
BRAVE_AD_FREE_CALLOUT_DIALOG,
BRAVE_OPENED_YOUTUBE,
SHOULD_SHOW_COOKIE_CONSENT_NOTICE,
LOADED_SITE_COUNT,
BRAVE_BACKGROUND_VIDEO_PLAYBACK_CONVERTED_TO_FEATURE,
BRAVE_APP_OPEN_COUNT_FOR_WIDGET_PROMO,
BRAVE_DEFERRED_DEEPLINK_PLAYLIST,
BRAVE_DEFERRED_DEEPLINK_VPN,
BRAVE_CLOSE_TABS_ON_EXIT,
BRAVE_CLEAR_ON_EXIT,
BRAVE_QUICK_ACTION_SEARCH_AND_BOOKMARK_WIDGET_TILES);
}

/*
* Checks if preference key is among Brave's dynamic keys.
*/
private static boolean isBraveDynamicKeyInUse(String key) {
return key.startsWith(BRAVE_RECYCLERVIEW_POSITION)
|| key.startsWith(BRAVE_RECYCLERVIEW_OFFSET_POSITION);
}

/*
* Checks if preference key is used in Brave.
*/
public static boolean isBraveKeyInUse(String key) {
return getKeysInUse().contains(key) || isBraveDynamicKeyInUse(key);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,28 @@

package org.chromium.chrome.browser;

import android.app.Activity;
import android.app.SearchManager;
import android.content.Intent;
import android.net.Uri;
import android.text.TextUtils;

import org.chromium.base.IntentUtils;
import org.chromium.base.Log;
import org.chromium.base.ThreadUtils;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.browser.util.BraveConstants;
import org.chromium.content_public.browser.BrowserStartupController;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;

public class BraveIntentHandler extends IntentHandler {
public class BraveIntentHandler {
private static final String TAG = "BraveIntentHandler";

private static final String CONNECTION_INFO_HELP_URL =
public static final String CONNECTION_INFO_HELP_URL =
"https://support.google.com/chrome?p=android_connection_info";
private static final String BRAVE_CONNECTION_INFO_HELP_URL =
public static final String BRAVE_CONNECTION_INFO_HELP_URL =
"https://support.brave.com/hc/en-us/articles/360018185871-How-do-I-check-if-a-site-s-connection-is-secure-";

public BraveIntentHandler(Activity activity, IntentHandlerDelegate delegate) {
super(activity, delegate);
}

@Override
public boolean onNewIntent(Intent intent) {
// Redirect requests if necessary
String url = getUrlFromIntent(intent);
if (url != null && url.equals(CONNECTION_INFO_HELP_URL)) {
intent.setData(Uri.parse(BRAVE_CONNECTION_INFO_HELP_URL));
}
String appLinkAction = intent.getAction();
Uri appLinkData = intent.getData();

if (Intent.ACTION_VIEW.equals(appLinkAction) && appLinkData != null) {
String lastPathSegment = appLinkData.getLastPathSegment();
if (lastPathSegment != null
&& (lastPathSegment.equalsIgnoreCase(BraveConstants.DEEPLINK_ANDROID_PLAYLIST)
|| lastPathSegment.equalsIgnoreCase(
BraveConstants.DEEPLINK_ANDROID_VPN))) {
return false;
}
}
return super.onNewIntent(intent);
}

/**
* Helper method to extract the raw URL from the intent, without further processing.
* The URL may be in multiple locations.
Expand All @@ -64,7 +35,7 @@ public boolean onNewIntent(Intent intent) {
*/
protected static String extractUrlFromIntent(Intent intent) {
if (intent == null) return null;
String url = getUrlFromVoiceSearchResult(intent);
String url = IntentHandler.getUrlFromVoiceSearchResult(intent);
if (url == null) url = getUrlForCustomTab(intent);
if (url == null) url = getUrlForWebapp(intent);
if (url == null) url = intent.getDataString();
Expand Down
Loading