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 93 to Chromium 94 (1.30.x). #10086

Merged
merged 6 commits into from
Sep 17, 2021
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
  •  
  •  
  •  
24 changes: 23 additions & 1 deletion android/browsertests_apk/AndroidManifest.xml.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
android:theme="@style/Theme.Chromium.TabbedMode"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize"
android:hardwareAccelerated="true"
android:process=":test_process">
android:process=":test_process"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down Expand Up @@ -109,6 +110,27 @@
</intent-filter>
</receiver>

<receiver android:name="org.chromium.chrome.browser.quickactionsearchwidget.QuickActionSearchWidgetProvider$QuickActionSearchWidgetProviderSmall"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
</receiver>

<receiver android:name="org.chromium.chrome.browser.quickactionsearchwidget.QuickActionSearchWidgetProvider$QuickActionSearchWidgetProviderMedium"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
</receiver>

<receiver android:name="org.chromium.chrome.browser.quickactionsearchwidget.QuickActionSearchWidgetProvider$QuickActionSearchWidgetProviderDino"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
</receiver>

<service android:name="org.chromium.components.background_task_scheduler.BackgroundTaskJobService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ScrollView;

Expand Down Expand Up @@ -51,13 +52,14 @@ public BraveFeedSurfaceCoordinator(Activity activity, SnackbarManager snackbarMa
PrivacyPreferencesManagerImpl privacyPreferencesManager,
@NonNull Supplier<Toolbar> toolbarSupplier,
FeedLaunchReliabilityLoggingState launchReliabilityLoggingState,
@Nullable FeedSwipeRefreshLayout swipeRefreshLayout, boolean overScrollDisabled) {
@Nullable FeedSwipeRefreshLayout swipeRefreshLayout, boolean overScrollDisabled,
@Nullable ViewGroup viewportView) {
super(activity, snackbarManager, windowAndroid, snapScrollHelper, ntpHeader,
sectionHeaderView, showDarkBackground, delegate, pageNavigationDelegate, profile,
isPlaceholderShownInitially, bottomSheetController, shareDelegateSupplier,
externalScrollableContainerDelegate, launchOrigin, privacyPreferencesManager,
toolbarSupplier, launchReliabilityLoggingState, swipeRefreshLayout,
overScrollDisabled);
overScrollDisabled, viewportView);
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion android/java/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@

<activity
android:name="org.chromium.chrome.browser.widget.crypto.binance.BinanceActivity"
android:theme="@style/Theme.Chromium.Activity.Fullscreen">
android:theme="@style/Theme.Chromium.Activity.Fullscreen"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
Expand Down
4 changes: 4 additions & 0 deletions android/java/apk_for_test.flags
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,7 @@
-keep class org.chromium.chrome.browser.toolbar.menu_button.BraveMenuButtonCoordinator {
public <init>(...);
}

-keep class org.chromium.chrome.browser.theme.ThemeUtils {
*** getTextBoxColorForToolbarBackgroundInNonNativePage(...);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@

package org.chromium.chrome.browser.local_database;

import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.util.Pair;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Pair;

import java.util.ArrayList;
import java.util.List;

import org.chromium.base.Log;
import org.chromium.base.ContextUtils;
import org.chromium.base.Log;
import org.chromium.chrome.browser.ntp_background_images.model.TopSite;
import org.chromium.chrome.browser.ntp_background_images.util.NTPUtil;

import java.util.ArrayList;
import java.util.List;

public class DatabaseHelper extends SQLiteOpenHelper {

private static volatile DatabaseHelper mInstance;
Expand Down Expand Up @@ -88,6 +89,7 @@ public void insertTopSite(TopSite topSite) {
}
}

@SuppressLint("Range")
public List<TopSiteTable> getAllTopSites() {
List<TopSiteTable> topSites = new ArrayList<>();

Expand Down Expand Up @@ -168,6 +170,7 @@ private boolean isAdsTrackerAlreadyAdded(BraveStatsTable braveStat) {
return count > 0;
}

@SuppressLint("Range")
public List<BraveStatsTable> getAllStats() {
List<BraveStatsTable> braveStats = new ArrayList<>();

Expand Down Expand Up @@ -198,6 +201,7 @@ public List<BraveStatsTable> getAllStats() {
return braveStats;
}

@SuppressLint("Range")
public List<BraveStatsTable> getAllStatsWithDate(String thresholdTime, String currentTime) {
List<BraveStatsTable> braveStats = new ArrayList<>();
// Select All Query
Expand Down Expand Up @@ -229,6 +233,7 @@ public List<BraveStatsTable> getAllStatsWithDate(String thresholdTime, String cu
return braveStats;
}

@SuppressLint("Range")
public List<Pair<String, Integer>> getStatsWithDate(String thresholdTime, String currentTime) {
List<Pair<String, Integer>> braveStats = new ArrayList<>();

Expand All @@ -254,6 +259,7 @@ public List<Pair<String, Integer>> getStatsWithDate(String thresholdTime, String
return braveStats;
}

@SuppressLint("Range")
public List<Pair<String, Integer>> getSitesWithDate(String thresholdTime, String currentTime) {
List<Pair<String, Integer>> braveStats = new ArrayList<>();
// Select All Query
Expand Down Expand Up @@ -298,6 +304,7 @@ public long insertSavedBandwidth(SavedBandwidthTable savedBandwidthTable) {
return db.insert(SavedBandwidthTable.TABLE_NAME, null, values);
}

@SuppressLint("Range")
public long getTotalSavedBandwidthWithDate(String thresholdTime, String currentTime) {
long sum = 0;
String selectQuery = "SELECT SUM(" + SavedBandwidthTable.COLUMN_SAVED_BANDWIDTH + ") as total FROM "
Expand All @@ -315,6 +322,7 @@ public long getTotalSavedBandwidthWithDate(String thresholdTime, String currentT
return sum;
}

@SuppressLint("Range")
public long getTotalSavedBandwidth() {
long sum = 0;
String selectQuery = "SELECT SUM(" + SavedBandwidthTable.COLUMN_SAVED_BANDWIDTH + ") as total FROM "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ windowAndroid, new SnapScrollHelper(mNewTabPageManager, mNewTabPageLayout),
NewTabPageUtils.decodeOriginFromNtpUrl(url),
PrivacyPreferencesManagerImpl.getInstance(), mToolbarSupplier,
/* FeedLaunchReliabilityLoggingState */ null,
FeedSwipeRefreshLayout.create(activity), /* overScrollDisabled= */ false);
FeedSwipeRefreshLayout.create(activity), /* overScrollDisabled= */ false,
/* viewportView= */ null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ void setIncognitoCookieControlsToggleEnforcement(@CookieControlsEnforcement int
*/
void setIncognitoCookieControlsIconOnclickListener(OnClickListener listener) {}

void setIncognitoNewTabHeader(String newTabPageHeader) {}

@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ public void signinAndEnableSync(@SigninAccessPoint int accessPoint, Account acco
@Override
public void signin(CoreAccountInfo accountInfo, @Nullable SignInCallback callback) {}

@Override
public void removeSignInAllowedObserver(SignInAllowedObserver observer) {}

@Override
public void addSignInAllowedObserver(SignInAllowedObserver observer) {}

@Override
public void removeSignInStateObserver(SignInStateObserver observer) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.app.BraveActivity;
import org.chromium.chrome.browser.site_settings.ChromeSiteSettingsDelegate;
import org.chromium.components.embedder_support.browser_context.BrowserContextHandle;
import org.chromium.content_public.browser.BrowserContextHandle;
import org.chromium.url.GURL;

public class BraveSiteSettingsDelegate extends ChromeSiteSettingsDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class BottomToolbarNewTabButton extends ChromeImageButton
/** The gray pill background behind the plus icon. */
private Drawable mBackground;

/** The {@link Resources} used to compute the background color. */
private final Resources mResources;
/** The {@link Context} used to compute the background color. */
private final Context mContext;

/** A provider that notifies when incognito mode is entered or exited. */
private IncognitoStateProvider mIncognitoStateProvider;
Expand All @@ -45,7 +45,7 @@ class BottomToolbarNewTabButton extends ChromeImageButton
public BottomToolbarNewTabButton(Context context, AttributeSet attrs) {
super(context, attrs);

mResources = context.getResources();
mContext = context;
}

@Override
Expand Down Expand Up @@ -105,7 +105,7 @@ private void updateBackground() {
return;
}
mBackground.setColorFilter(
ThemeUtils.getTextBoxColorForToolbarBackgroundInNonNativePage(mResources,
ThemeUtils.getTextBoxColorForToolbarBackgroundInNonNativePage(mContext,
mThemeColorProvider.getThemeColor(),
mThemeColorProvider.useLight()
&& mIncognitoStateProvider.isIncognitoSelected()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class SearchAccelerator extends ChromeImageButton
/** The gray pill background behind the search icon. */
private final Drawable mBackground;

/** The {@link Resources} used to compute the background color. */
private final Resources mResources;
/** The {@link Context} used to compute the background color. */
private final Context mContext;

/** A provider that notifies components when the theme color changes.*/
private ThemeColorProvider mThemeColorProvider;
Expand All @@ -44,9 +44,10 @@ class SearchAccelerator extends ChromeImageButton
public SearchAccelerator(Context context, AttributeSet attrs) {
super(context, attrs);

mResources = context.getResources();
mContext = context;

mBackground = ApiCompatibilityUtils.getDrawable(mResources, R.drawable.ntp_search_box);
mBackground = ApiCompatibilityUtils.getDrawable(
mContext.getResources(), R.drawable.ntp_search_box);
mBackground.mutate();
setBackground(mBackground);

Expand Down Expand Up @@ -97,7 +98,7 @@ private void updateBackground() {
if (mThemeColorProvider == null || mIncognitoStateProvider == null) return;

mBackground.setColorFilter(ThemeUtils.getTextBoxColorForToolbarBackgroundInNonNativePage(
mResources, mThemeColorProvider.getThemeColor(),
mContext, mThemeColorProvider.getThemeColor(),
mIncognitoStateProvider.isIncognitoSelected()
&& mThemeColorProvider.useLight()),
PorterDuff.Mode.SRC_IN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ void onBottomToolbarVisibilityChanged(boolean isVisible) {
public int getToolbarColorForCurrentState() {
// Return primary background color regardless of GridTabSwitcher state. Otherwise toolbar of
// browsing mode is still visible in tab switching mode with stack layout.
return ChromeColors.getPrimaryBackgroundColor(getResources(), mIsIncognito);
return ChromeColors.getPrimaryBackgroundColor(getContext(), mIsIncognito);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ public void populateUrlAnimatorSetImpl(boolean showExpandedState,
public void updateModernLocationBarColorImpl(int color) {
if (mShieldsLayout != null && mShieldsLayoutIsColorBackground) {
mShieldsLayout.setBackgroundColor(
ChromeColors.getDefaultThemeColor(getContext().getResources(), isIncognito()));
ChromeColors.getDefaultThemeColor(getContext(), isIncognito()));
}
mCurrentToolbarColor = color;
if (mShieldsLayout != null) {
Expand Down Expand Up @@ -1191,7 +1191,7 @@ private void updateNotificationBadgeForNewInstall() {
@Override
public void onThemeColorChanged(int color, boolean shouldAnimate) {
final int textBoxColor = ThemeUtils.getTextBoxColorForToolbarBackgroundInNonNativePage(
getContext().getResources(), color, isIncognito());
getContext(), color, isIncognito());
updateModernLocationBarColorImpl(textBoxColor);
}

Expand Down Expand Up @@ -1250,7 +1250,7 @@ private void updateShieldsLayoutBackground(boolean rounded) {
mShieldsLayoutIsColorBackground = false;
} else {
mShieldsLayout.setBackgroundColor(
ChromeColors.getDefaultThemeColor(getContext().getResources(), isIncognito()));
ChromeColors.getDefaultThemeColor(getContext(), isIncognito()));
mShieldsLayoutIsColorBackground = true;
}
updateModernLocationBarColorImpl(mCurrentToolbarColor);
Expand Down
4 changes: 2 additions & 2 deletions android/java/res/xml/legal_information_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
android:title="@string/google_terms_of_service_title"
app:url="@string/brave_terms_of_service_url" />
<org.chromium.chrome.browser.about_settings.HyperlinkPreference
android:key="privacy_notice"
android:title="@string/privacy_notice_title"
android:key="privacy_policy"
android:title="@string/privacy_policy_title"
app:url="@string/brave_privacy_notice_url" />
<Preference
android:fragment="org.chromium.chrome.browser.settings.BraveLicensePreferences"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.support.test.filters.SmallTest;
import android.view.View;
import android.view.ViewGroup;

import androidx.appcompat.app.AppCompatActivity;
import androidx.test.filters.SmallTest;

import org.junit.Assert;
import org.junit.Test;
Expand Down Expand Up @@ -71,8 +71,8 @@
import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.components.browser_ui.bottomsheet.BottomSheetController;
import org.chromium.components.browser_ui.widget.scrim.ScrimCoordinator;
import org.chromium.components.embedder_support.browser_context.BrowserContextHandle;
import org.chromium.components.permissions.PermissionDialogController;
import org.chromium.content_public.browser.BrowserContextHandle;
import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.modaldialog.ModalDialogManager;
import org.chromium.ui.modelutil.PropertyModel;
Expand Down Expand Up @@ -195,6 +195,7 @@ public void testClassesExist() throws Exception {
"org/chromium/chrome/browser/toolbar/menu_button/MenuButtonCoordinator"));
Assert.assertTrue(classExists(
"org/chromium/chrome/browser/toolbar/menu_button/BraveMenuButtonCoordinator"));
Assert.assertTrue(classExists("org/chromium/chrome/browser/theme/ThemeUtils"));
}

@Test
Expand Down Expand Up @@ -293,6 +294,8 @@ public void testMethodsExist() throws Exception {
Assert.assertTrue(
methodExists("org/chromium/chrome/browser/feed/BraveFeedSurfaceCoordinator",
"isReliabilityLoggingEnabled", false, null));
Assert.assertTrue(methodExists("org/chromium/chrome/browser/theme/ThemeUtils",
"getTextBoxColorForToolbarBackgroundInNonNativePage", false, null));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import static org.junit.Assert.assertEquals;

import android.os.Bundle;
import android.support.test.filters.SmallTest;

import androidx.test.filters.SmallTest;

import org.junit.Before;
import org.junit.Rule;
Expand Down
Loading