Release 78.0.3904.93
This commit is contained in:
parent
b52188adfa
commit
11ec80bed4
54 changed files with 8276 additions and 1826 deletions
14
CHANGELOG.md
14
CHANGELOG.md
|
@ -1,5 +1,17 @@
|
|||
# 78.0.3904.93
|
||||
* introduce flags to disable browser fingerprinting capabilities (fixes https://github.com/bromite/bromite/issues/402)
|
||||
* major enhancements to AMP sanitization for news/images
|
||||
* remove duplicate network predictions privacy setting
|
||||
* disable some signed exchanges features
|
||||
* ungoogled-chromium-android: patches to block all GCM/GMS/PlayServices integrations
|
||||
* ungoogled-chromium: block all connection requests to substituted domains
|
||||
* disable GVR services build flag
|
||||
* disable HEAD requests for single words typed and clicked in Omnibar
|
||||
* increase number of autocomplete matches from 5 to 10
|
||||
* replace DoH probe domain with RIPE domain
|
||||
|
||||
# 78.0.3904.72
|
||||
* updated fixed User-agent phone model
|
||||
* updated User-agent phone model and version
|
||||
* fix network predictions bug (fixes https://github.com/bromite/bromite/issues/387)
|
||||
* fix crash in settings (fixes https://github.com/bromite/bromite/issues/388)
|
||||
|
||||
|
|
|
@ -150,6 +150,7 @@ Bromite uses an unindexed filter file, which is periodically published at https:
|
|||
* [Chromium project](https://www.chromium.org/Home) and developers
|
||||
* [Iridium project](https://github.com/iridium-browser) for some patches
|
||||
* [ungoogled-chromium](https://github.com/Eloston/ungoogled-chromium) for some patches
|
||||
* [ungoogled-chromium-android](https://github.com/ungoogled-software/ungoogled-chromium-android) for some patches
|
||||
* [GrapheneOS](https://github.com/GrapheneOS) for some security patches
|
||||
* [Inox patchset](https://github.com/gcarq/inox-patchset) for some patches (via ungoogled-chromium)
|
||||
* [Brave Browser](https://github.com/brave/browser-android-tabs) for some patches
|
||||
|
|
|
@ -2,8 +2,10 @@ android_channel="stable"
|
|||
blink_symbol_level=1
|
||||
dcheck_always_on=false
|
||||
debuggable_apks=false
|
||||
disable_android_lint=true
|
||||
enable_ac3_eac3_audio_demuxing=true enable_hevc_demuxing=true enable_iterator_debugging=false
|
||||
enable_av1_decoder=true
|
||||
enable_gvr_services=false
|
||||
enable_hangout_services_extension=false
|
||||
enable_mdns=false
|
||||
enable_mse_mpeg2ts_stream_parser=true ffmpeg_branding="Chrome" proprietary_codecs=true
|
||||
|
@ -19,6 +21,7 @@ is_component_build=false
|
|||
is_debug=false
|
||||
is_official_build=true
|
||||
jumbo_file_merge_limit=60
|
||||
rtc_build_examples=false
|
||||
safe_browsing_mode=0
|
||||
strip_absolute_paths_from_debug_symbols=true
|
||||
strip_debug_info=false
|
||||
|
|
|
@ -19,7 +19,6 @@ Do-not-store-passwords-by-default.patch
|
|||
Disable-NTP-remote-suggestions-by-default.patch
|
||||
Disable-references-to-fonts.googleapis.com.patch
|
||||
Disable-WebRTC-by-default.patch
|
||||
Disable-unused-permissions.patch
|
||||
Never-send-any-crash-upload-data.patch
|
||||
Hide-send-reports-checkbox.patch
|
||||
Never-fetch-popular-sites.patch
|
||||
|
@ -38,11 +37,9 @@ safe_browsing-disable-incident-reporting.patch
|
|||
safe_browsing-disable-reporting-of-safebrowsing-override.patch
|
||||
safe_browsing-disable-cookie-transmission.patch
|
||||
Disable-safe-browsing.patch
|
||||
Disable-data-saver.patch
|
||||
Skip-the-first-run-and-metrics.patch
|
||||
Disable-signin-and-data-saver-preferences.patch
|
||||
Disable-signin-data-reduction-promos.patch
|
||||
Remove-recent-tabs-signin.patch
|
||||
Disable-all-promo-dialogs.patch
|
||||
Remove-signin-and-data-saver-integrations.patch
|
||||
Remove-background-sync-and-translate-menu-options.patch
|
||||
Hide-passwords-manager-link.patch
|
||||
Disable-Omaha-update-checks.patch
|
||||
|
@ -64,11 +61,10 @@ Open-YouTube-links-in-Bromite.patch
|
|||
Add-exit-menu-item.patch
|
||||
Remove-help-menu-item.patch
|
||||
Add-menu-option-to-toggle-global-Javascript-preference.patch
|
||||
Add-global-menu-entry-to-toggle-AdBlocker.patch
|
||||
Add-menu-option-to-toggle-ad-blocker.patch
|
||||
User-Agent-anonymize.patch
|
||||
AudioBuffer-AnalyserNode-fingerprinting-mitigations-via-IDL.patch
|
||||
getClientRects-getBoundingClientRect-measureText-add-fingerprinting-mitigation.patch
|
||||
Canvas-fingerprinting-mitigations-for-image-data-and-webGL.patch
|
||||
Multiple-fingerprinting-mitigations-for-canvas-text-and-client-rectangles.patch
|
||||
Add-flags-to-disable-device-motion-and-orientation-APIs.patch
|
||||
Punt-the-Widevine-version-string.patch
|
||||
Disable-metrics-on-all-I-O-threads.patch
|
||||
|
@ -96,7 +92,18 @@ kill-Translate.patch
|
|||
kill-Vision.patch
|
||||
kill-Location-fall-back-to-system.patch
|
||||
kill-Auth.patch
|
||||
Remove-dependency-on-com.google.android.gms.auth.patch
|
||||
kill-GCM.patch
|
||||
Remove-dependency-on-com.google.android.gcm.patch
|
||||
Remove-dependency-on-com.google.android.gms.gcm.patch
|
||||
Remove-dependency-on-com.google.android.play.patch
|
||||
Remove-dependency-on-com.google.android.gms.vision-com.google.android.gms.clearcut-com.google.android.gms.phenotype.patch
|
||||
Remove-dependency-on-com.google.android.gms.flags-com.google.android.gms.location.places-com.google.android.gms.stats.patch
|
||||
Remove-dependency-on-com.google.android.gms.fido-com.google.android.gms.iid-com.google.android.gms.instantapps-com.google.android.gms.location.patch
|
||||
Remove-dependency-on-com.google.android.gms.cast.patch
|
||||
Remove-dependency-on-com.google.android.gms.common-auth-signin-dynamic-com.google.android.gms.tasks.patch
|
||||
Remove-play-dependency-for-module-installer.patch
|
||||
Remove-SMS-integration.patch
|
||||
Allow-website-sign-in-without-account-sign-in.patch
|
||||
Offer-builtin-autocomplete-for-chrome-flags.patch
|
||||
Do-not-grant-notifications-to-default-search-engine.patch
|
||||
|
@ -127,3 +134,8 @@ Disable-search-ready-omnibox-by-default.patch
|
|||
disable-AdsBlockedInfoBar.patch
|
||||
Bromite-AdBlockUpdaterService.patch
|
||||
Revert-Merge-to-M78-Enable-AImageReader-by-default.patch
|
||||
Replace-DoH-probe-domain-with-RIPE-domain.patch
|
||||
Increase-number-of-autocomplete-matches-from-5-to-10.patch
|
||||
Disable-HEAD-requests-for-single-word-Omnibar-searches.patch
|
||||
Block-all-connection-requests-with-qjz9zk-in-the-domain-name-or-with-a-trk-scheme.patch
|
||||
Disable-some-signed-exchange-features.patch
|
||||
|
|
|
@ -10,20 +10,22 @@ Do not fallback to UDP when using DoH
|
|||
|
||||
See also: https://tools.ietf.org/id/draft-ietf-doh-dns-over-https-14.txt
|
||||
---
|
||||
chrome/browser/about_flags.cc | 11 +++++++++++
|
||||
chrome/browser/about_flags.cc | 10 +++++++++-
|
||||
chrome/browser/net/system_network_context_manager.cc | 18 +++++++++++-------
|
||||
chrome/common/chrome_features.cc | 9 ---------
|
||||
chrome/common/chrome_features.h | 2 --
|
||||
.../common/network_features.cc | 6 ++++++
|
||||
.../common/network_features.h | 6 ++++++
|
||||
.../common/network_switch_list.h | 4 ++++
|
||||
net/base/load_flags_list.h | 6 ++++++
|
||||
net/dns/dns_transaction.cc | 4 ++--
|
||||
net/url_request/url_request_http_job.cc | 16 +++++++++++-----
|
||||
8 files changed, 57 insertions(+), 14 deletions(-)
|
||||
10 files changed, 55 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||||
--- a/chrome/browser/about_flags.cc
|
||||
+++ b/chrome/browser/about_flags.cc
|
||||
@@ -417,6 +417,14 @@ const FeatureEntry::FeatureVariation kCCTModuleCacheVariations[] = {
|
||||
@@ -418,6 +418,14 @@ const FeatureEntry::FeatureVariation kCCTModuleCacheVariations[] = {
|
||||
base::size(kCCTModuleCache_ThirtyMinutes), nullptr},
|
||||
};
|
||||
|
||||
|
@ -38,16 +40,15 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
|||
#endif // OS_ANDROID
|
||||
|
||||
const FeatureEntry::FeatureParam kForceDark_SimpleHsl[] = {
|
||||
@@ -3578,6 +3586,9 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
flag_descriptions::kEnableSyncUSSBookmarksName,
|
||||
flag_descriptions::kEnableSyncUSSBookmarksDescription, kOsAll,
|
||||
FEATURE_VALUE_TYPE(switches::kSyncUSSBookmarks)},
|
||||
+ {"enable-dns-over-https", flag_descriptions::kDnsOverHttpsName,
|
||||
+ flag_descriptions::kDnsOverHttpsDescription, kOsAndroid,
|
||||
@@ -4491,7 +4499,7 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
{"dns-over-https", flag_descriptions::kDnsOverHttpsName,
|
||||
flag_descriptions::kDnsOverHttpsDescription,
|
||||
kOsMac | kOsWin | kOsCrOS | kOsAndroid,
|
||||
- FEATURE_VALUE_TYPE(features::kDnsOverHttps)},
|
||||
+ MULTI_VALUE_TYPE(kDnsOverHttpsChoices)},
|
||||
|
||||
{"enable-lookalike-url-navigation-suggestions",
|
||||
flag_descriptions::kLookalikeUrlNavigationSuggestionsName,
|
||||
#if defined(OS_ANDROID)
|
||||
{"tab-switcher-longpress-menu",
|
||||
diff --git a/chrome/browser/net/system_network_context_manager.cc b/chrome/browser/net/system_network_context_manager.cc
|
||||
--- a/chrome/browser/net/system_network_context_manager.cc
|
||||
+++ b/chrome/browser/net/system_network_context_manager.cc
|
||||
|
@ -91,6 +92,37 @@ diff --git a/chrome/browser/net/system_network_context_manager.cc b/chrome/brows
|
|||
local_state_->SetDefaultPrefValue(prefs::kDnsOverHttpsMode,
|
||||
base::Value(default_doh_mode));
|
||||
local_state_->SetDefaultPrefValue(prefs::kDnsOverHttpsTemplates,
|
||||
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
|
||||
--- a/chrome/common/chrome_features.cc
|
||||
+++ b/chrome/common/chrome_features.cc
|
||||
@@ -269,15 +269,6 @@ const base::Feature kDisallowUnsafeHttpDownloads{
|
||||
"DisallowUnsafeHttpDownloads", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
const char kDisallowUnsafeHttpDownloadsParamName[] = "MimeTypeList";
|
||||
|
||||
-// Enable DNS over HTTPS (DoH).
|
||||
-const base::Feature kDnsOverHttps{"DnsOverHttps",
|
||||
- base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
-
|
||||
-// Set whether fallback to insecure DNS is allowed by default. This setting may
|
||||
-// be overridden for individual transactions.
|
||||
-const base::FeatureParam<bool> kDnsOverHttpsFallbackParam{&kDnsOverHttps,
|
||||
- "Fallback", true};
|
||||
-
|
||||
// Supply one or more space-separated DoH server URI templates to use when this
|
||||
// feature is enabled. If no templates are specified, then a hardcoded mapping
|
||||
// will be used to construct a list of DoH templates associated with the IP
|
||||
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h
|
||||
--- a/chrome/common/chrome_features.h
|
||||
+++ b/chrome/common/chrome_features.h
|
||||
@@ -166,8 +166,6 @@ extern const char kDisallowUnsafeHttpDownloadsParamName[];
|
||||
COMPONENT_EXPORT(CHROME_FEATURES)
|
||||
extern const base::Feature kDnsOverHttps;
|
||||
COMPONENT_EXPORT(CHROME_FEATURES)
|
||||
-extern const base::FeatureParam<bool> kDnsOverHttpsFallbackParam;
|
||||
-COMPONENT_EXPORT(CHROME_FEATURES)
|
||||
extern const base::FeatureParam<std::string> kDnsOverHttpsTemplatesParam;
|
||||
|
||||
#if defined(OS_ANDROID)
|
||||
diff --git a/components/network_session_configurator/common/network_features.cc b/components/network_session_configurator/common/network_features.cc
|
||||
--- a/components/network_session_configurator/common/network_features.cc
|
||||
+++ b/components/network_session_configurator/common/network_features.cc
|
||||
|
|
|
@ -30,18 +30,18 @@ diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java
|
|||
diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
--- a/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
+++ b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
@@ -21,6 +21,11 @@
|
||||
android:title="@string/can_make_payment_title"
|
||||
android:summary="@string/settings_can_make_payment_toggle_label" />
|
||||
<org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
@@ -20,6 +20,11 @@
|
||||
android:title="@string/preload_pages_title"
|
||||
android:summary="@string/preload_pages_summary"
|
||||
android:persistent="false" />
|
||||
+ <org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
+ android:key="always_incognito"
|
||||
+ android:title="@string/always_incognito_title"
|
||||
+ android:summary="@string/always_incognito_summary"
|
||||
+ android:defaultValue="false" />
|
||||
+ <org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
android:key="preload_pages"
|
||||
android:title="@string/preload_pages_title"
|
||||
android:summary="@string/preload_pages_summary"
|
||||
<Preference
|
||||
android:fragment="org.chromium.chrome.browser.preferences.privacy.DoNotTrackPreference"
|
||||
android:key="do_not_track"
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/AlwaysIncognitoLinkInterceptor.java b/chrome/android/java/src/org/chromium/chrome/browser/AlwaysIncognitoLinkInterceptor.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
|
|
|
@ -363,7 +363,7 @@ diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
|||
"bookmarks/bookmark_model_factory.cc",
|
||||
"bookmarks/bookmark_model_factory.h",
|
||||
"bookmarks/chrome_bookmark_client.cc",
|
||||
@@ -3006,8 +3010,6 @@ jumbo_split_static_library("browser") {
|
||||
@@ -3007,8 +3011,6 @@ jumbo_split_static_library("browser") {
|
||||
"badging/badge_manager_factory.h",
|
||||
"banners/app_banner_manager_desktop.cc",
|
||||
"banners/app_banner_manager_desktop.h",
|
||||
|
@ -372,7 +372,7 @@ diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
|||
"certificate_viewer.h",
|
||||
"chrome_browser_field_trials_desktop.cc",
|
||||
"chrome_browser_field_trials_desktop.h",
|
||||
@@ -3114,8 +3116,6 @@ jumbo_split_static_library("browser") {
|
||||
@@ -3115,8 +3117,6 @@ jumbo_split_static_library("browser") {
|
||||
"importer/importer_uma.h",
|
||||
"importer/in_process_importer_bridge.cc",
|
||||
"importer/in_process_importer_bridge.h",
|
||||
|
|
|
@ -26,18 +26,18 @@ diff --git a/chrome/android/java/res/values/values.xml b/chrome/android/java/res
|
|||
diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
--- a/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
+++ b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
@@ -30,6 +30,11 @@
|
||||
android:title="@string/preload_pages_title"
|
||||
android:summary="@string/preload_pages_summary"
|
||||
android:persistent="false" />
|
||||
@@ -29,6 +29,11 @@
|
||||
android:fragment="org.chromium.chrome.browser.preferences.privacy.DoNotTrackPreference"
|
||||
android:key="do_not_track"
|
||||
android:title="@string/do_not_track_title" />
|
||||
+ <org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
+ android:key="allow_custom_tab_intents"
|
||||
+ android:title="@string/allow_custom_tab_intents_title"
|
||||
+ android:summary="@string/allow_custom_tab_intents_summary"
|
||||
+ android:defaultValue="false" />
|
||||
<Preference
|
||||
android:fragment="org.chromium.chrome.browser.preferences.privacy.DoNotTrackPreference"
|
||||
android:key="do_not_track"
|
||||
<android.support.v7.preference.Preference
|
||||
android:key="contextual_search"
|
||||
android:title="@string/contextual_search_title"
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java b/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
|
||||
|
@ -77,10 +77,10 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
+ SharedPreferences.Editor sharedPreferencesEditor = ContextUtils.getAppSharedPreferences().edit();
|
||||
+ sharedPreferencesEditor.putBoolean(PREF_ALLOW_CUSTOM_TAB_INTENTS, (boolean)newValue);
|
||||
+ sharedPreferencesEditor.apply();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -136,6 +142,11 @@ public class PrivacyPreferences
|
||||
} else if (PREF_CONTEXTUAL_SEARCH.equals(key)) {
|
||||
PrefServiceBridge.getInstance().setContextualSearchPreference(((boolean) newValue) ? "true" : "false");
|
||||
} else if (PREF_CAN_MAKE_PAYMENT.equals(key)) {
|
||||
@@ -141,6 +147,11 @@ public class PrivacyPreferences
|
||||
prefServiceBridge.getBoolean(Pref.CAN_MAKE_PAYMENT_ENABLED));
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
--- a/chrome/android/java/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
@@ -4026,6 +4026,13 @@ The site does NOT gain access to the camera. The camera images are only visible
|
||||
@@ -4020,6 +4020,13 @@ The site does NOT gain access to the camera. The camera images are only visible
|
||||
<message name="IDS_INCOGNITO_DISCLOSURE_CHECKBOX_TEXT" desc="Text for checkbox inviting to close incognito tabs in incognito disclosure dialog." translateable="false">
|
||||
Close other incognito tabs
|
||||
</message>
|
||||
|
|
|
@ -53,7 +53,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLife
|
|||
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
--- a/chrome/android/java/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
@@ -2953,6 +2953,9 @@ To change this setting, <ph name="BEGIN_LINK"><resetlink></ph>reset sync<p
|
||||
@@ -2947,6 +2947,9 @@ To change this setting, <ph name="BEGIN_LINK"><resetlink></ph>reset sync<p
|
||||
<message name="IDS_MENU_PREFERENCES" desc="Menu item for opening browser preferences. [CHAR-LIMIT=27]">
|
||||
Settings
|
||||
</message>
|
||||
|
|
|
@ -19,7 +19,7 @@ with limited CPU/memory resources and it is disabled by default.
|
|||
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||||
--- a/chrome/browser/about_flags.cc
|
||||
+++ b/chrome/browser/about_flags.cc
|
||||
@@ -676,6 +676,11 @@ const FeatureEntry::Choice kForceEffectiveConnectionTypeChoices[] = {
|
||||
@@ -677,6 +677,11 @@ const FeatureEntry::Choice kForceEffectiveConnectionTypeChoices[] = {
|
||||
net::kEffectiveConnectionType4G},
|
||||
};
|
||||
|
||||
|
@ -31,7 +31,7 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
|||
// Ensure that all effective connection types returned by Network Quality
|
||||
// Estimator (NQE) are also exposed via flags.
|
||||
static_assert(net::EFFECTIVE_CONNECTION_TYPE_LAST + 2 ==
|
||||
@@ -2533,6 +2538,9 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
@@ -2546,6 +2551,9 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
flag_descriptions::kPassiveDocumentEventListenersName,
|
||||
flag_descriptions::kPassiveDocumentEventListenersDescription, kOsAll,
|
||||
FEATURE_VALUE_TYPE(features::kPassiveDocumentEventListeners)},
|
||||
|
|
|
@ -16,7 +16,7 @@ Subject: Add flag to disable IPv6 probes
|
|||
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||||
--- a/chrome/browser/about_flags.cc
|
||||
+++ b/chrome/browser/about_flags.cc
|
||||
@@ -3193,6 +3193,11 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
@@ -3206,6 +3206,11 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
kMarkHttpAsFeatureVariations,
|
||||
"HTTPReallyBadFinal")},
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ legacy acceleration events.
|
|||
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||||
--- a/chrome/browser/about_flags.cc
|
||||
+++ b/chrome/browser/about_flags.cc
|
||||
@@ -1593,6 +1593,12 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
@@ -1606,6 +1606,12 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
{"enable-gpu-rasterization", flag_descriptions::kGpuRasterizationName,
|
||||
flag_descriptions::kGpuRasterizationDescription, kOsAll,
|
||||
MULTI_VALUE_TYPE(kEnableGpuRasterizationChoices)},
|
||||
|
@ -70,7 +70,7 @@ diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptio
|
|||
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc
|
||||
--- a/content/child/runtime_features.cc
|
||||
+++ b/content/child/runtime_features.cc
|
||||
@@ -84,6 +84,9 @@ void SetIndividualRuntimeFeatures(
|
||||
@@ -85,6 +85,9 @@ void SetIndividualRuntimeFeatures(
|
||||
base::FeatureList::IsEnabled(features::kSharedArrayBuffer) ||
|
||||
base::FeatureList::IsEnabled(features::kWebAssemblyThreads));
|
||||
|
||||
|
@ -164,7 +164,7 @@ diff --git a/third_party/blink/renderer/platform/exported/web_runtime_features.c
|
|||
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
--- a/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
+++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
@@ -1119,6 +1119,14 @@
|
||||
@@ -1128,6 +1128,14 @@
|
||||
status: "experimental",
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Sat, 14 Sep 2019 10:19:07 +0200
|
||||
Subject: Add global menu entry to toggle ad blocker
|
||||
Subject: Add menu option to toggle ad blocker
|
||||
|
||||
---
|
||||
chrome/android/java/res/menu/custom_tabs_menu.xml | 12 +++++++
|
||||
|
@ -170,7 +170,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/Cust
|
|||
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
--- a/chrome/android/java/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
@@ -2958,6 +2958,17 @@ To change this setting, <ph name="BEGIN_LINK"><resetlink></ph>reset sync<p
|
||||
@@ -2952,6 +2952,17 @@ To change this setting, <ph name="BEGIN_LINK"><resetlink></ph>reset sync<p
|
||||
<message name="IDS_MENU_REQUEST_DESKTOP_SITE_OFF" desc="Accessibility description for when Request Desktop Site is disabled.">
|
||||
Turn on Request desktop site
|
||||
</message>
|
|
@ -177,7 +177,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/Cust
|
|||
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
--- a/chrome/android/java/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
@@ -2938,6 +2938,17 @@ To change this setting, <ph name="BEGIN_LINK"><resetlink></ph>reset sync<p
|
||||
@@ -2932,6 +2932,17 @@ To change this setting, <ph name="BEGIN_LINK"><resetlink></ph>reset sync<p
|
||||
<message name="IDS_MENU_FIND_IN_PAGE" desc="Menu item allowing users to find text within the current page. [CHAR-LIMIT=27]">
|
||||
Find in page
|
||||
</message>
|
||||
|
|
|
@ -26,18 +26,18 @@ diff --git a/chrome/android/java/res/values/values.xml b/chrome/android/java/res
|
|||
diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
--- a/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
+++ b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
@@ -39,6 +39,11 @@
|
||||
android:fragment="org.chromium.chrome.browser.preferences.privacy.DoNotTrackPreference"
|
||||
android:key="do_not_track"
|
||||
android:title="@string/do_not_track_title" />
|
||||
@@ -38,6 +38,11 @@
|
||||
android:key="contextual_search"
|
||||
android:title="@string/contextual_search_title"
|
||||
android:fragment="org.chromium.chrome.browser.preferences.privacy.ContextualSearchPreferenceFragment" />
|
||||
+ <org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
+ android:key="close_tabs_on_exit"
|
||||
+ android:title="@string/close_tabs_on_exit_title"
|
||||
+ android:summary="@string/close_tabs_on_exit_summary"
|
||||
+ android:defaultValue="false" />
|
||||
<android.support.v7.preference.Preference
|
||||
android:key="contextual_search"
|
||||
android:title="@string/contextual_search_title"
|
||||
<Preference
|
||||
android:key="clear_browsing_data"
|
||||
android:title="@string/clear_browsing_data_title"
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
|
||||
|
@ -75,15 +75,15 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
@@ -38,6 +40,7 @@ public class PrivacyPreferences
|
||||
private static final String PREF_CAN_MAKE_PAYMENT = "can_make_payment";
|
||||
private static final String PREF_CONTEXTUAL_SEARCH = "contextual_search";
|
||||
private static final String PREF_NETWORK_PREDICTIONS = "network_predictions";
|
||||
private static final String PREF_NETWORK_PREDICTIONS = "preload_pages";
|
||||
+ private static final String PREF_CLOSE_TABS_ON_EXIT = "close_tabs_on_exit";
|
||||
private static final String PREF_DO_NOT_TRACK = "do_not_track";
|
||||
private static final String PREF_CLEAR_BROWSING_DATA = "clear_browsing_data";
|
||||
|
||||
@@ -107,6 +110,10 @@ public class PrivacyPreferences
|
||||
SharedPreferences.Editor sharedPreferencesEditor = ContextUtils.getAppSharedPreferences().edit();
|
||||
sharedPreferencesEditor.putBoolean(PREF_ALLOW_CUSTOM_TAB_INTENTS, (boolean)newValue);
|
||||
sharedPreferencesEditor.apply();
|
||||
@@ -112,6 +115,10 @@ public class PrivacyPreferences
|
||||
} else if (PREF_CAN_MAKE_PAYMENT.equals(key)) {
|
||||
PrefServiceBridge.getInstance().setBoolean(
|
||||
Pref.CAN_MAKE_PAYMENT_ENABLED, (boolean) newValue);
|
||||
+ } else if (PREF_CLOSE_TABS_ON_EXIT.equals(key)) {
|
||||
+ SharedPreferences.Editor sharedPreferencesEditor = ContextUtils.getAppSharedPreferences().edit();
|
||||
+ sharedPreferencesEditor.putBoolean(PREF_CLOSE_TABS_ON_EXIT, (boolean)newValue);
|
||||
|
@ -91,7 +91,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
}
|
||||
|
||||
return true;
|
||||
@@ -157,6 +164,11 @@ public class PrivacyPreferences
|
||||
@@ -162,6 +169,11 @@ public class PrivacyPreferences
|
||||
boolean isContextualSearchEnabled = !prefServiceBridge.isContextualSearchDisabled();
|
||||
contextualPref.setSummary(isContextualSearchEnabled ? textOn : textOff);
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
--- a/chrome/android/java/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
@@ -3770,6 +3770,12 @@ The site does NOT gain access to the camera. The camera images are only visible
|
||||
@@ -3764,6 +3764,12 @@ The site does NOT gain access to the camera. The camera images are only visible
|
||||
<message name="IDS_CONTEXTMENU_IMAGE_TITLE" desc="The title of a context menu tab when the item pressed contains more than one type. This indicates that all the actions are related to the image.">
|
||||
IMAGE
|
||||
</message>
|
||||
|
|
|
@ -165,7 +165,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/web
|
|||
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
--- a/chrome/android/java/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
@@ -901,6 +901,12 @@ Your Google account may have other forms of browsing history like searches and a
|
||||
@@ -895,6 +895,12 @@ Your Google account may have other forms of browsing history like searches and a
|
||||
<message name="IDS_BLOCK_THIRD_PARTY_COOKIES_SUMMARY" desc="Summary text for Block Third Party Cookies preference">
|
||||
Prevent third-party websites from saving and reading cookie data
|
||||
</message>
|
||||
|
|
|
@ -0,0 +1,319 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Wed, 30 Oct 2019 11:50:13 +0100
|
||||
Subject: Block all connection requests with 'qjz9zk' in the domain name or
|
||||
with a 'trk:' scheme.
|
||||
|
||||
An info bar is displayed unless the --disable-trkbar command-line flag or the chrome://flag option is used.
|
||||
This patch is based on Iridium's 'net: add "trk:" scheme and help identify URLs being retrieved'
|
||||
---
|
||||
.../chrome_autocomplete_scheme_classifier.cc | 1 +
|
||||
chrome/browser/history/history_utils.cc | 1 +
|
||||
chrome/browser/ui/singleton_tabs.cc | 3 +-
|
||||
chromecast/browser/url_request_context_factory.cc | 7 ++++-
|
||||
components/omnibox/browser/autocomplete_input.cc | 7 +++--
|
||||
components/url_formatter/url_fixer.cc | 4 +++
|
||||
.../browser/child_process_security_policy_impl.cc | 1 +
|
||||
net/BUILD.gn | 2 ++
|
||||
net/url_request/trk_protocol_handler.cc | 26 +++++++++++++++++
|
||||
net/url_request/trk_protocol_handler.h | 33 ++++++++++++++++++++++
|
||||
net/url_request/url_request.cc | 8 ++++++
|
||||
net/url_request/url_request_context_builder.cc | 4 +++
|
||||
url/url_constants.cc | 1 +
|
||||
url/url_constants.h | 1 +
|
||||
url/url_util.cc | 2 ++
|
||||
15 files changed, 97 insertions(+), 4 deletions(-)
|
||||
create mode 100644 net/url_request/trk_protocol_handler.cc
|
||||
create mode 100644 net/url_request/trk_protocol_handler.h
|
||||
|
||||
diff --git a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc
|
||||
--- a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc
|
||||
+++ b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc
|
||||
@@ -28,6 +28,7 @@ ChromeAutocompleteSchemeClassifier::GetInputTypeForScheme(
|
||||
if (base::IsStringASCII(scheme) &&
|
||||
(ProfileIOData::IsHandledProtocol(scheme) ||
|
||||
base::LowerCaseEqualsASCII(scheme, content::kViewSourceScheme) ||
|
||||
+ base::LowerCaseEqualsASCII(scheme, url::kTraceScheme) ||
|
||||
base::LowerCaseEqualsASCII(scheme, url::kJavaScriptScheme) ||
|
||||
base::LowerCaseEqualsASCII(scheme, url::kDataScheme))) {
|
||||
return metrics::OmniboxInputType::URL;
|
||||
diff --git a/chrome/browser/history/history_utils.cc b/chrome/browser/history/history_utils.cc
|
||||
--- a/chrome/browser/history/history_utils.cc
|
||||
+++ b/chrome/browser/history/history_utils.cc
|
||||
@@ -22,6 +22,7 @@ bool CanAddURLToHistory(const GURL& url) {
|
||||
url.SchemeIs(content::kChromeDevToolsScheme) ||
|
||||
url.SchemeIs(content::kChromeUIScheme) ||
|
||||
url.SchemeIs(content::kViewSourceScheme) ||
|
||||
+ url.SchemeIs(url::kTraceScheme) ||
|
||||
url.SchemeIs(chrome::kChromeNativeScheme) ||
|
||||
url.SchemeIs(chrome::kChromeSearchScheme) ||
|
||||
url.SchemeIs(dom_distiller::kDomDistillerScheme) ||
|
||||
diff --git a/chrome/browser/ui/singleton_tabs.cc b/chrome/browser/ui/singleton_tabs.cc
|
||||
--- a/chrome/browser/ui/singleton_tabs.cc
|
||||
+++ b/chrome/browser/ui/singleton_tabs.cc
|
||||
@@ -99,7 +99,8 @@ int GetIndexOfExistingTab(Browser* browser, const NavigateParams& params) {
|
||||
|
||||
// Skip view-source tabs. This is needed because RewriteURLIfNecessary
|
||||
// removes the "view-source:" scheme which leads to incorrect matching.
|
||||
- if (tab_url.SchemeIs(content::kViewSourceScheme))
|
||||
+ if (tab_url.SchemeIs(content::kViewSourceScheme) ||
|
||||
+ tab_url.SchemeIs(url::kTraceScheme))
|
||||
continue;
|
||||
|
||||
GURL rewritten_tab_url = tab_url;
|
||||
diff --git a/chromecast/browser/url_request_context_factory.cc b/chromecast/browser/url_request_context_factory.cc
|
||||
--- a/chromecast/browser/url_request_context_factory.cc
|
||||
+++ b/chromecast/browser/url_request_context_factory.cc
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "net/http/http_stream_factory.h"
|
||||
#include "net/proxy_resolution/proxy_resolution_service.h"
|
||||
#include "net/ssl/ssl_config_service_defaults.h"
|
||||
+#include "net/url_request/trk_protocol_handler.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
#include "net/url_request/url_request_context_builder.h"
|
||||
#include "net/url_request/url_request_context_getter.h"
|
||||
@@ -245,13 +246,17 @@ void URLRequestContextFactory::InitializeMainContextDependencies(
|
||||
new net::URLRequestJobFactoryImpl());
|
||||
// Keep ProtocolHandlers added in sync with
|
||||
// CastContentBrowserClient::IsHandledURL().
|
||||
+ bool set_protocol = false;
|
||||
for (content::ProtocolHandlerMap::iterator it = protocol_handlers->begin();
|
||||
it != protocol_handlers->end();
|
||||
++it) {
|
||||
- bool set_protocol =
|
||||
+ set_protocol =
|
||||
job_factory->SetProtocolHandler(it->first, std::move(it->second));
|
||||
DCHECK(set_protocol);
|
||||
}
|
||||
+ set_protocol = job_factory->SetProtocolHandler(
|
||||
+ url::kTraceScheme, base::WrapUnique(new net::TrkProtocolHandler));
|
||||
+ DCHECK(set_protocol);
|
||||
|
||||
// Set up interceptors in the reverse order.
|
||||
std::unique_ptr<net::URLRequestJobFactory> top_job_factory =
|
||||
diff --git a/components/omnibox/browser/autocomplete_input.cc b/components/omnibox/browser/autocomplete_input.cc
|
||||
--- a/components/omnibox/browser/autocomplete_input.cc
|
||||
+++ b/components/omnibox/browser/autocomplete_input.cc
|
||||
@@ -496,7 +496,8 @@ void AutocompleteInput::ParseForEmphasizeComponents(
|
||||
// For the view-source and blob schemes, we should emphasize the host of the
|
||||
// URL qualified by the view-source or blob prefix.
|
||||
if ((base::LowerCaseEqualsASCII(scheme_str, kViewSourceScheme) ||
|
||||
- base::LowerCaseEqualsASCII(scheme_str, url::kBlobScheme)) &&
|
||||
+ base::LowerCaseEqualsASCII(scheme_str, url::kBlobScheme) ||
|
||||
+ base::LowerCaseEqualsASCII(scheme_str, url::kTraceScheme)) &&
|
||||
(static_cast<int>(text.length()) > after_scheme_and_colon)) {
|
||||
// Obtain the URL prefixed by view-source or blob and parse it.
|
||||
base::string16 real_url(text.substr(after_scheme_and_colon));
|
||||
@@ -569,7 +570,9 @@ int AutocompleteInput::NumNonHostComponents(const url::Parsed& parts) {
|
||||
bool AutocompleteInput::HasHTTPScheme(const base::string16& input) {
|
||||
std::string utf8_input(base::UTF16ToUTF8(input));
|
||||
url::Component scheme;
|
||||
- if (url::FindAndCompareScheme(utf8_input, kViewSourceScheme, &scheme)) {
|
||||
+ if (url::FindAndCompareScheme(utf8_input, url::kTraceScheme, &scheme)) {
|
||||
+ return false;
|
||||
+ } else if (url::FindAndCompareScheme(utf8_input, kViewSourceScheme, &scheme)) {
|
||||
utf8_input.erase(0, scheme.end() + 1);
|
||||
}
|
||||
return url::FindAndCompareScheme(utf8_input, url::kHttpScheme, nullptr);
|
||||
diff --git a/components/url_formatter/url_fixer.cc b/components/url_formatter/url_fixer.cc
|
||||
--- a/components/url_formatter/url_fixer.cc
|
||||
+++ b/components/url_formatter/url_fixer.cc
|
||||
@@ -552,6 +552,10 @@ GURL FixupURL(const std::string& text, const std::string& desired_tld) {
|
||||
}
|
||||
}
|
||||
|
||||
+ if (scheme == url::kTraceScheme) {
|
||||
+ return GURL();
|
||||
+ }
|
||||
+
|
||||
// We handle the file scheme separately.
|
||||
if (scheme == url::kFileScheme)
|
||||
return GURL(parts.scheme.is_valid() ? text : FixupPath(text));
|
||||
diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc
|
||||
--- a/content/browser/child_process_security_policy_impl.cc
|
||||
+++ b/content/browser/child_process_security_policy_impl.cc
|
||||
@@ -507,6 +507,7 @@ ChildProcessSecurityPolicyImpl::ChildProcessSecurityPolicyImpl() {
|
||||
RegisterWebSafeScheme(url::kHttpsScheme);
|
||||
RegisterWebSafeScheme(url::kFtpScheme);
|
||||
RegisterWebSafeScheme(url::kDataScheme);
|
||||
+ RegisterWebSafeScheme(url::kTraceScheme);
|
||||
RegisterWebSafeScheme("feed");
|
||||
|
||||
// TODO(nick): https://crbug.com/651534 blob: and filesystem: schemes embed
|
||||
diff --git a/net/BUILD.gn b/net/BUILD.gn
|
||||
--- a/net/BUILD.gn
|
||||
+++ b/net/BUILD.gn
|
||||
@@ -1787,6 +1787,8 @@ component("net") {
|
||||
"url_request/report_sender.h",
|
||||
"url_request/static_http_user_agent_settings.cc",
|
||||
"url_request/static_http_user_agent_settings.h",
|
||||
+ "url_request/trk_protocol_handler.cc",
|
||||
+ "url_request/trk_protocol_handler.h",
|
||||
"url_request/url_fetcher.cc",
|
||||
"url_request/url_fetcher.h",
|
||||
"url_request/url_fetcher_core.cc",
|
||||
diff --git a/net/url_request/trk_protocol_handler.cc b/net/url_request/trk_protocol_handler.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/net/url_request/trk_protocol_handler.cc
|
||||
@@ -0,0 +1,26 @@
|
||||
+// Copyright (c) 2018 The ungoogled-chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#include "net/url_request/trk_protocol_handler.h"
|
||||
+
|
||||
+#include "base/logging.h"
|
||||
+#include "net/base/net_errors.h"
|
||||
+#include "net/url_request/url_request_error_job.h"
|
||||
+
|
||||
+namespace net {
|
||||
+
|
||||
+TrkProtocolHandler::TrkProtocolHandler() = default;
|
||||
+
|
||||
+URLRequestJob* TrkProtocolHandler::MaybeCreateJob(
|
||||
+ URLRequest* request, NetworkDelegate* network_delegate) const {
|
||||
+ LOG(ERROR) << "Blocked URL in TrkProtocolHandler: " << request->original_url();
|
||||
+ return new URLRequestErrorJob(
|
||||
+ request, network_delegate, ERR_BLOCKED_BY_CLIENT);
|
||||
+}
|
||||
+
|
||||
+bool TrkProtocolHandler::IsSafeRedirectTarget(const GURL& location) const {
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+} // namespace net
|
||||
diff --git a/net/url_request/trk_protocol_handler.h b/net/url_request/trk_protocol_handler.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/net/url_request/trk_protocol_handler.h
|
||||
@@ -0,0 +1,33 @@
|
||||
+// Copyright (c) 2018 The ungoogled-chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#ifndef NET_URL_REQUEST_TRK_PROTOCOL_HANDLER_H_
|
||||
+#define NET_URL_REQUEST_TRK_PROTOCOL_HANDLER_H_
|
||||
+
|
||||
+#include "base/compiler_specific.h"
|
||||
+#include "base/macros.h"
|
||||
+#include "net/base/net_export.h"
|
||||
+#include "net/url_request/url_request_job_factory.h"
|
||||
+
|
||||
+namespace net {
|
||||
+
|
||||
+class URLRequestJob;
|
||||
+
|
||||
+// Implements a ProtocolHandler for Trk jobs.
|
||||
+class NET_EXPORT TrkProtocolHandler
|
||||
+ : public URLRequestJobFactory::ProtocolHandler {
|
||||
+ public:
|
||||
+ TrkProtocolHandler();
|
||||
+ URLRequestJob* MaybeCreateJob(
|
||||
+ URLRequest* request,
|
||||
+ NetworkDelegate* network_delegate) const override;
|
||||
+ bool IsSafeRedirectTarget(const GURL& location) const override;
|
||||
+
|
||||
+ private:
|
||||
+ DISALLOW_COPY_AND_ASSIGN(TrkProtocolHandler);
|
||||
+};
|
||||
+
|
||||
+} // namespace net
|
||||
+
|
||||
+#endif // NET_URL_REQUEST_TRK_PROTOCOL_HANDLER_H_
|
||||
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
|
||||
--- a/net/url_request/url_request.cc
|
||||
+++ b/net/url_request/url_request.cc
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/rand_util.h"
|
||||
#include "base/stl_util.h"
|
||||
+#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
@@ -42,6 +43,7 @@
|
||||
#include "net/url_request/url_request_redirect_job.h"
|
||||
#include "url/gurl.h"
|
||||
#include "url/origin.h"
|
||||
+#include "url/url_constants.h"
|
||||
|
||||
using base::Time;
|
||||
using std::string;
|
||||
@@ -612,6 +614,12 @@ URLRequest::URLRequest(const GURL& url,
|
||||
// Sanity check out environment.
|
||||
DCHECK(base::ThreadTaskRunnerHandle::IsSet());
|
||||
|
||||
+ if (!url.SchemeIs(url::kTraceScheme) &&
|
||||
+ base::EndsWith(url.host(), "qjz9zk", base::CompareCase::INSENSITIVE_ASCII)) {
|
||||
+ LOG(ERROR) << "Block URL in URLRequest: " << url;
|
||||
+ url_chain_[0] = GURL(url::kTraceScheme + (":" + url.possibly_invalid_spec()));
|
||||
+ }
|
||||
+
|
||||
context->url_requests()->insert(this);
|
||||
net_log_.BeginEvent(NetLogEventType::REQUEST_ALIVE, [&] {
|
||||
return NetLogURLRequestConstructorParams(url, priority_,
|
||||
diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc
|
||||
--- a/net/url_request/url_request_context_builder.cc
|
||||
+++ b/net/url_request/url_request_context_builder.cc
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "net/ssl/ssl_config_service_defaults.h"
|
||||
#include "net/url_request/data_protocol_handler.h"
|
||||
#include "net/url_request/static_http_user_agent_settings.h"
|
||||
+#include "net/url_request/trk_protocol_handler.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
#include "net/url_request/url_request_context_storage.h"
|
||||
#include "net/url_request/url_request_intercepting_job_factory.h"
|
||||
@@ -641,6 +642,9 @@ std::unique_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
|
||||
job_factory->SetProtocolHandler(url::kDataScheme,
|
||||
std::make_unique<DataProtocolHandler>());
|
||||
|
||||
+ job_factory->SetProtocolHandler(url::kTraceScheme,
|
||||
+ std::make_unique<TrkProtocolHandler>());
|
||||
+
|
||||
#if !BUILDFLAG(DISABLE_FILE_SUPPORT)
|
||||
if (file_enabled_) {
|
||||
job_factory->SetProtocolHandler(
|
||||
diff --git a/url/url_constants.cc b/url/url_constants.cc
|
||||
--- a/url/url_constants.cc
|
||||
+++ b/url/url_constants.cc
|
||||
@@ -26,6 +26,7 @@ const char kHttpsScheme[] = "https";
|
||||
const char kJavaScriptScheme[] = "javascript";
|
||||
const char kMailToScheme[] = "mailto";
|
||||
const char kTelScheme[] = "tel";
|
||||
+const char kTraceScheme[] = "trk";
|
||||
const char kWsScheme[] = "ws";
|
||||
const char kWssScheme[] = "wss";
|
||||
|
||||
diff --git a/url/url_constants.h b/url/url_constants.h
|
||||
--- a/url/url_constants.h
|
||||
+++ b/url/url_constants.h
|
||||
@@ -32,6 +32,7 @@ COMPONENT_EXPORT(URL) extern const char kHttpsScheme[];
|
||||
COMPONENT_EXPORT(URL) extern const char kJavaScriptScheme[];
|
||||
COMPONENT_EXPORT(URL) extern const char kMailToScheme[];
|
||||
COMPONENT_EXPORT(URL) extern const char kTelScheme[];
|
||||
+COMPONENT_EXPORT(URL) extern const char kTraceScheme[];
|
||||
COMPONENT_EXPORT(URL) extern const char kWsScheme[];
|
||||
COMPONENT_EXPORT(URL) extern const char kWssScheme[];
|
||||
|
||||
diff --git a/url/url_util.cc b/url/url_util.cc
|
||||
--- a/url/url_util.cc
|
||||
+++ b/url/url_util.cc
|
||||
@@ -52,6 +52,7 @@ struct SchemeRegistry {
|
||||
kHttpsScheme,
|
||||
kAboutScheme,
|
||||
kDataScheme,
|
||||
+ kTraceScheme,
|
||||
kWssScheme,
|
||||
};
|
||||
|
||||
@@ -67,6 +68,7 @@ struct SchemeRegistry {
|
||||
kAboutScheme,
|
||||
kJavaScriptScheme,
|
||||
kDataScheme,
|
||||
+ kTraceScheme,
|
||||
};
|
||||
|
||||
// Schemes that can be sent CORS requests.
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -179,7 +179,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
|||
#include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h"
|
||||
#include "chrome/browser/page_load_metrics/page_load_metrics_util.h"
|
||||
#include "chrome/browser/password_manager/chrome_password_manager_client.h"
|
||||
@@ -4043,16 +4041,6 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
||||
@@ -4044,16 +4042,6 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
||||
content::NavigationHandle* handle) {
|
||||
std::vector<std::unique_ptr<content::NavigationThrottle>> throttles;
|
||||
|
||||
|
@ -196,7 +196,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
|||
#if BUILDFLAG(ENABLE_PLUGINS)
|
||||
std::unique_ptr<content::NavigationThrottle> flash_url_throttle =
|
||||
FlashDownloadInterception::MaybeCreateThrottleFor(handle);
|
||||
@@ -4162,12 +4150,6 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
||||
@@ -4163,12 +4151,6 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,292 +0,0 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Sat, 24 Mar 2018 05:18:03 +0100
|
||||
Subject: Canvas: fingerprinting mitigations for image data and webGL
|
||||
|
||||
Disable webGL renderer info and modify the color data returned by ToBlob,
|
||||
ToDataURL and getImageData so that it will contain randomly manipulated
|
||||
pixels (maximum 20) that slightly change the color of the R,G,B components
|
||||
without a visible effect.
|
||||
|
||||
Credits to Slaviro (https://github.com/Slaviro) for coming up with a better
|
||||
approach to change color components.
|
||||
---
|
||||
.../canvas/canvas2d/canvas_rendering_context_2d.cc | 3 +-
|
||||
.../modules/webgl/webgl_debug_renderer_info.cc | 4 +-
|
||||
third_party/blink/renderer/platform/BUILD.gn | 4 +-
|
||||
.../platform/graphics/image_data_buffer.cc | 5 +
|
||||
.../platform/graphics/static_bitmap_image.cc | 156 +++++++++++++++++++++
|
||||
.../platform/graphics/static_bitmap_image.h | 2 +
|
||||
6 files changed, 169 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc
|
||||
--- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc
|
||||
+++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.h"
|
||||
|
||||
-#include "base/rand_util.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/rand_util.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
@@ -817,7 +816,7 @@ TextMetrics* CanvasRenderingContext2D::measureText(const String& text) {
|
||||
GetState().GetTextAlign(), text);
|
||||
|
||||
// scale text metrics by 3/1000000th
|
||||
- auto shuffleFactor = 1 + (base::RandDouble() - 0.5) * 0.000003;
|
||||
+ auto shuffleFactor = 1 + (canvas()->GetDocument().GetShuffleFactorX() - 0.5) * 0.000003;
|
||||
text_metrics->Shuffle(shuffleFactor);
|
||||
|
||||
return text_metrics;
|
||||
diff --git a/third_party/blink/renderer/modules/webgl/webgl_debug_renderer_info.cc b/third_party/blink/renderer/modules/webgl/webgl_debug_renderer_info.cc
|
||||
--- a/third_party/blink/renderer/modules/webgl/webgl_debug_renderer_info.cc
|
||||
+++ b/third_party/blink/renderer/modules/webgl/webgl_debug_renderer_info.cc
|
||||
@@ -37,11 +37,11 @@ WebGLExtensionName WebGLDebugRendererInfo::GetName() const {
|
||||
|
||||
WebGLDebugRendererInfo* WebGLDebugRendererInfo::Create(
|
||||
WebGLRenderingContextBase* context) {
|
||||
- return MakeGarbageCollected<WebGLDebugRendererInfo>(context);
|
||||
+ return nullptr;
|
||||
}
|
||||
|
||||
bool WebGLDebugRendererInfo::Supported(WebGLRenderingContextBase*) {
|
||||
- return true;
|
||||
+ return false;
|
||||
}
|
||||
|
||||
const char* WebGLDebugRendererInfo::ExtensionName() {
|
||||
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn
|
||||
--- a/third_party/blink/renderer/platform/BUILD.gn
|
||||
+++ b/third_party/blink/renderer/platform/BUILD.gn
|
||||
@@ -1417,7 +1417,9 @@ jumbo_component("platform") {
|
||||
"//third_party/blink/renderer:non_test_config",
|
||||
]
|
||||
|
||||
- include_dirs = []
|
||||
+ include_dirs = [
|
||||
+ "//third_party/skia/include/private", # For shuffler in graphics/static_bitmap_image.cc
|
||||
+ ]
|
||||
|
||||
public_deps = [
|
||||
":blink_platform_public_deps",
|
||||
diff --git a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc b/third_party/blink/renderer/platform/graphics/image_data_buffer.cc
|
||||
--- a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc
|
||||
+++ b/third_party/blink/renderer/platform/graphics/image_data_buffer.cc
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
+#include "base/rand_util.h"
|
||||
+#include "base/logging.h"
|
||||
#include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h"
|
||||
#include "third_party/blink/renderer/platform/image-encoders/image_encoder.h"
|
||||
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
|
||||
@@ -127,6 +129,9 @@ bool ImageDataBuffer::EncodeImageInternal(const ImageEncodingMimeType mime_type,
|
||||
const SkPixmap& pixmap) const {
|
||||
DCHECK(is_valid_);
|
||||
|
||||
+ // shuffle subchannel color data within the pixmap
|
||||
+ StaticBitmapImage::ShuffleSubchannelColorData(pixmap_.writable_addr(), pixmap_.info(), 0, 0);
|
||||
+
|
||||
if (mime_type == kMimeTypeJpeg) {
|
||||
SkJpegEncoder::Options options;
|
||||
options.fQuality = ImageEncoder::ComputeJpegQuality(quality);
|
||||
diff --git a/third_party/blink/renderer/platform/graphics/static_bitmap_image.cc b/third_party/blink/renderer/platform/graphics/static_bitmap_image.cc
|
||||
--- a/third_party/blink/renderer/platform/graphics/static_bitmap_image.cc
|
||||
+++ b/third_party/blink/renderer/platform/graphics/static_bitmap_image.cc
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h"
|
||||
|
||||
+#include "base/rand_util.h"
|
||||
+#include "base/logging.h"
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "gpu/command_buffer/client/gles2_interface.h"
|
||||
#include "third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.h"
|
||||
@@ -15,6 +17,7 @@
|
||||
#include "third_party/skia/include/core/SkCanvas.h"
|
||||
#include "third_party/skia/include/core/SkImage.h"
|
||||
#include "third_party/skia/include/core/SkPaint.h"
|
||||
+#include "third_party/skia/include/private/SkColorData.h"
|
||||
#include "third_party/skia/include/core/SkSurface.h"
|
||||
#include "third_party/skia/include/gpu/GrContext.h"
|
||||
#include "v8/include/v8.h"
|
||||
@@ -154,10 +157,163 @@ bool StaticBitmapImage::ConvertToArrayBufferContents(
|
||||
DCHECK(read_pixels_successful ||
|
||||
!sk_image->bounds().intersect(SkIRect::MakeXYWH(
|
||||
rect.X(), rect.Y(), info.width(), info.height())));
|
||||
+
|
||||
+ ShuffleSubchannelColorData(result.Data(), info, rect.X(), rect.Y());
|
||||
+
|
||||
result.Transfer(dest_contents);
|
||||
return true;
|
||||
}
|
||||
|
||||
+// set the component to maximum-delta if it is >= maximum, or add to existing color component (color + delta)
|
||||
+#define shuffleComponent(color, max, delta) ( (color) >= (max) ? ((max)-(delta)) : ((color)+(delta)) )
|
||||
+
|
||||
+#define writable_addr(T, p, stride, x, y) (T*)((const char *)p + y * stride + x * sizeof(T))
|
||||
+
|
||||
+void StaticBitmapImage::ShuffleSubchannelColorData(const void *addr, const SkImageInfo& info, int srcX, int srcY) {
|
||||
+ auto w = info.width() - srcX, h = info.height() - srcY;
|
||||
+
|
||||
+ // skip tiny images; info.width()/height() can also be 0
|
||||
+ if ((w < 8) || (h < 8)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // generate the first random number here
|
||||
+ double shuffleX = base::RandDouble();
|
||||
+
|
||||
+ // cap maximum pixels to change
|
||||
+ auto pixels = (w + h) / 128;
|
||||
+ if (pixels > 20) {
|
||||
+ pixels = 20;
|
||||
+ } else if (pixels < 2) {
|
||||
+ pixels = 2;
|
||||
+ }
|
||||
+
|
||||
+ auto colorType = info.colorType();
|
||||
+ auto fRowBytes = info.minRowBytes(); // stride
|
||||
+
|
||||
+ DLOG(INFO) << "BRM: ShuffleSubchannelColorData() w=" << w << " h=" << h << " colorType=" << colorType << " fRowBytes=" << fRowBytes;
|
||||
+
|
||||
+ // second random number (for y/height)
|
||||
+ double shuffleY = base::RandDouble();
|
||||
+
|
||||
+ // calculate random coordinates using bisection
|
||||
+ auto currentW = w, currentH = h;
|
||||
+ for(;pixels >= 0; pixels--) {
|
||||
+ int x = currentW * shuffleX, y = currentH * shuffleY;
|
||||
+
|
||||
+ // calculate randomisation amounts for each RGB component
|
||||
+ uint8_t shuffleR = base::RandInt(0, 4);
|
||||
+ uint8_t shuffleG = (shuffleR + x) % 4;
|
||||
+ uint8_t shuffleB = (shuffleG + y) % 4;
|
||||
+
|
||||
+ // manipulate pixel data to slightly change the R, G, B components
|
||||
+ switch (colorType) {
|
||||
+ case kAlpha_8_SkColorType:
|
||||
+ {
|
||||
+ auto *pixel = writable_addr(uint8_t, addr, fRowBytes, x, y);
|
||||
+ auto r = SkColorGetR(*pixel), g = SkColorGetG(*pixel), b = SkColorGetB(*pixel), a = SkColorGetA(*pixel);
|
||||
+
|
||||
+ r = shuffleComponent(r, UINT8_MAX-1, shuffleR);
|
||||
+ g = shuffleComponent(g, UINT8_MAX-1, shuffleG);
|
||||
+ b = shuffleComponent(b, UINT8_MAX-1, shuffleB);
|
||||
+ // alpha is left unchanged
|
||||
+
|
||||
+ *pixel = SkColorSetARGB(a, r, g, b);
|
||||
+ }
|
||||
+ break;
|
||||
+ case kGray_8_SkColorType:
|
||||
+ {
|
||||
+ auto *pixel = writable_addr(uint8_t, addr, fRowBytes, x, y);
|
||||
+ *pixel = shuffleComponent(*pixel, UINT8_MAX-1, shuffleB);
|
||||
+ }
|
||||
+ break;
|
||||
+ case kRGB_565_SkColorType:
|
||||
+ {
|
||||
+ auto *pixel = writable_addr(uint16_t, addr, fRowBytes, x, y);
|
||||
+ unsigned r = SkPacked16ToR32(*pixel);
|
||||
+ unsigned g = SkPacked16ToG32(*pixel);
|
||||
+ unsigned b = SkPacked16ToB32(*pixel);
|
||||
+
|
||||
+ r = shuffleComponent(r, 31, shuffleR);
|
||||
+ g = shuffleComponent(g, 63, shuffleG);
|
||||
+ b = shuffleComponent(b, 31, shuffleB);
|
||||
+
|
||||
+ unsigned r16 = (r & SK_R16_MASK) << SK_R16_SHIFT;
|
||||
+ unsigned g16 = (g & SK_G16_MASK) << SK_G16_SHIFT;
|
||||
+ unsigned b16 = (b & SK_B16_MASK) << SK_B16_SHIFT;
|
||||
+
|
||||
+ *pixel = r16 | g16 | b16;
|
||||
+ }
|
||||
+ break;
|
||||
+ case kARGB_4444_SkColorType:
|
||||
+ {
|
||||
+ auto *pixel = writable_addr(uint16_t, addr, fRowBytes, x, y);
|
||||
+ auto a = SkGetPackedA4444(*pixel), r = SkGetPackedR4444(*pixel), g = SkGetPackedG4444(*pixel), b = SkGetPackedB4444(*pixel);
|
||||
+
|
||||
+ r = shuffleComponent(r, 15, shuffleR);
|
||||
+ g = shuffleComponent(g, 15, shuffleG);
|
||||
+ b = shuffleComponent(b, 15, shuffleB);
|
||||
+ // alpha is left unchanged
|
||||
+
|
||||
+ unsigned a4 = (a & 0xF) << SK_A4444_SHIFT;
|
||||
+ unsigned r4 = (r & 0xF) << SK_R4444_SHIFT;
|
||||
+ unsigned g4 = (g & 0xF) << SK_G4444_SHIFT;
|
||||
+ unsigned b4 = (b & 0xF) << SK_B4444_SHIFT;
|
||||
+
|
||||
+ *pixel = r4 | b4 | g4 | a4;
|
||||
+ }
|
||||
+ break;
|
||||
+ case kRGBA_8888_SkColorType:
|
||||
+ {
|
||||
+ auto *pixel = writable_addr(uint32_t, addr, fRowBytes, x, y);
|
||||
+ auto a = SkGetPackedA32(*pixel), r = SkGetPackedR32(*pixel), g = SkGetPackedG32(*pixel), b = SkGetPackedB32(*pixel);
|
||||
+
|
||||
+ r = shuffleComponent(r, UINT8_MAX-1, shuffleR);
|
||||
+ g = shuffleComponent(g, UINT8_MAX-1, shuffleG);
|
||||
+ b = shuffleComponent(b, UINT8_MAX-1, shuffleB);
|
||||
+ // alpha is left unchanged
|
||||
+
|
||||
+ *pixel = (a << SK_A32_SHIFT) | (r << SK_R32_SHIFT) |
|
||||
+ (g << SK_G32_SHIFT) | (b << SK_B32_SHIFT);
|
||||
+ }
|
||||
+ break;
|
||||
+ case kBGRA_8888_SkColorType:
|
||||
+ {
|
||||
+ auto *pixel = writable_addr(uint32_t, addr, fRowBytes, x, y);
|
||||
+ auto a = SkGetPackedA32(*pixel), b = SkGetPackedR32(*pixel), g = SkGetPackedG32(*pixel), r = SkGetPackedB32(*pixel);
|
||||
+
|
||||
+ r = shuffleComponent(r, UINT8_MAX-1, shuffleR);
|
||||
+ g = shuffleComponent(g, UINT8_MAX-1, shuffleG);
|
||||
+ b = shuffleComponent(b, UINT8_MAX-1, shuffleB);
|
||||
+ // alpha is left unchanged
|
||||
+
|
||||
+ *pixel = (a << SK_BGRA_A32_SHIFT) | (r << SK_BGRA_R32_SHIFT) |
|
||||
+ (g << SK_BGRA_G32_SHIFT) | (b << SK_BGRA_B32_SHIFT);
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ // the remaining formats are not expected to be used in Chromium
|
||||
+ LOG(WARNING) << "BRM: ShuffleSubchannelColorData(): Ignoring pixel format";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // keep bisecting or reset current width/height as needed
|
||||
+ if (x == 0) {
|
||||
+ currentW = w;
|
||||
+ } else {
|
||||
+ currentW = x;
|
||||
+ }
|
||||
+ if (y == 0) {
|
||||
+ currentH = h;
|
||||
+ } else {
|
||||
+ currentH = y;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#undef writable_addr
|
||||
+#undef shuffleComponent
|
||||
+
|
||||
const gpu::SyncToken& StaticBitmapImage::GetSyncToken() const {
|
||||
static const gpu::SyncToken sync_token;
|
||||
return sync_token;
|
||||
diff --git a/third_party/blink/renderer/platform/graphics/static_bitmap_image.h b/third_party/blink/renderer/platform/graphics/static_bitmap_image.h
|
||||
--- a/third_party/blink/renderer/platform/graphics/static_bitmap_image.h
|
||||
+++ b/third_party/blink/renderer/platform/graphics/static_bitmap_image.h
|
||||
@@ -46,6 +46,8 @@ class PLATFORM_EXPORT StaticBitmapImage : public Image {
|
||||
static scoped_refptr<StaticBitmapImage> Create(WTF::ArrayBufferContents&,
|
||||
const SkImageInfo&);
|
||||
|
||||
+ static void ShuffleSubchannelColorData(const void *addr, const SkImageInfo& info, int srcX, int srcY);
|
||||
+
|
||||
bool IsStaticBitmapImage() const override { return true; }
|
||||
|
||||
// Methods overridden by all sub-classes
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Sun, 27 Oct 2019 10:21:19 +0100
|
||||
Subject: Disable HEAD requests for single-word Omnibar searches
|
||||
|
||||
Patch from https://github.com/Eloston/ungoogled-chromium/issues/814#issuecomment-526873727
|
||||
---
|
||||
chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc | 8 ++++----
|
||||
chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.h | 2 +-
|
||||
2 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc
|
||||
--- a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc
|
||||
+++ b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.cc
|
||||
@@ -85,8 +85,8 @@ ChromeOmniboxNavigationObserver::ChromeOmniboxNavigationObserver(
|
||||
shortcuts_backend_(ShortcutsBackendFactory::GetForProfile(profile)),
|
||||
load_state_(LOAD_NOT_SEEN),
|
||||
fetch_state_(FETCH_NOT_COMPLETE) {
|
||||
- if (alternate_nav_match_.destination_url.is_valid())
|
||||
- CreateLoader(alternate_nav_match_.destination_url);
|
||||
+// if (alternate_nav_match_.destination_url.is_valid())
|
||||
+// CreateLoader(alternate_nav_match_.destination_url);
|
||||
|
||||
// We need to start by listening to AllSources, since we don't know which tab
|
||||
// the navigation might occur in.
|
||||
@@ -286,7 +286,7 @@ void ChromeOmniboxNavigationObserver::OnAllLoadingFinished() {
|
||||
delete this;
|
||||
}
|
||||
|
||||
-void ChromeOmniboxNavigationObserver::CreateLoader(
|
||||
+/*void ChromeOmniboxNavigationObserver::CreateLoader(
|
||||
const GURL& destination_url) {
|
||||
net::NetworkTrafficAnnotationTag traffic_annotation =
|
||||
net::DefineNetworkTrafficAnnotation("omnibox_navigation_observer", R"(
|
||||
@@ -327,4 +327,4 @@ void ChromeOmniboxNavigationObserver::CreateLoader(
|
||||
loader_->SetAllowHttpErrorResults(true);
|
||||
loader_->SetOnRedirectCallback(base::BindRepeating(
|
||||
&ChromeOmniboxNavigationObserver::OnURLRedirect, base::Unretained(this)));
|
||||
-}
|
||||
+}*/
|
||||
diff --git a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.h b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.h
|
||||
--- a/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.h
|
||||
+++ b/chrome/browser/ui/omnibox/chrome_omnibox_navigation_observer.h
|
||||
@@ -127,7 +127,7 @@ class ChromeOmniboxNavigationObserver : public OmniboxNavigationObserver,
|
||||
|
||||
// Creates a URL loader for |destination_url| and stores it in |loader_|.
|
||||
// Does not start the loader.
|
||||
- void CreateLoader(const GURL& destination_url);
|
||||
+ //void CreateLoader(const GURL& destination_url);
|
||||
|
||||
const base::string16 text_;
|
||||
const AutocompleteMatch match_;
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Tue, 12 Jun 2018 15:09:26 +0200
|
||||
Subject: Disable signin/data reduction promos
|
||||
Subject: Disable all promo dialogs
|
||||
|
||||
---
|
||||
.../chrome/browser/ChromeTabbedActivity.java | 30 +---------------------
|
|
@ -2,10 +2,24 @@ From: Daniel Micay <danielmicay@gmail.com>
|
|||
Date: Wed, 23 Nov 2016 09:26:51 -0500
|
||||
Subject: Disable contextual search by default
|
||||
|
||||
Disable contextual search in preference by default
|
||||
---
|
||||
chrome/browser/profiles/profile.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
.../src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java | 2 +-
|
||||
chrome/browser/profiles/profile.cc | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java
|
||||
@@ -423,7 +423,7 @@ public class PrefServiceBridge {
|
||||
* @return Whether the Contextual Search feature was disabled by the user explicitly.
|
||||
*/
|
||||
public boolean isContextualSearchDisabled() {
|
||||
- return getContextualSearchPreference().equals(CONTEXTUAL_SEARCH_DISABLED);
|
||||
+ return !getContextualSearchPreference().equals(CONTEXTUAL_SEARCH_ENABLED);
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
|
||||
--- a/chrome/browser/profiles/profile.cc
|
||||
+++ b/chrome/browser/profiles/profile.cc
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Fri, 27 Oct 2017 15:53:37 +0200
|
||||
Subject: Disable data saver
|
||||
|
||||
---
|
||||
.../datareduction/DataReductionPreferenceFragment.java | 17 +++++------------
|
||||
chrome/android/java/strings/android_chrome_strings.grd | 3 ---
|
||||
2 files changed, 5 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionPreferenceFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionPreferenceFragment.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionPreferenceFragment.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/datareduction/DataReductionPreferenceFragment.java
|
||||
@@ -45,10 +45,10 @@ public class DataReductionPreferenceFragment extends PreferenceFragmentCompat {
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
PreferenceUtils.addPreferencesFromResource(this, R.xml.data_reduction_preferences);
|
||||
getActivity().setTitle(R.string.data_reduction_title_lite_mode);
|
||||
- boolean isEnabled = DataReductionProxySettings.getInstance().isDataReductionProxyEnabled();
|
||||
- mIsEnabled = !isEnabled;
|
||||
- mWasEnabledAtCreation = isEnabled;
|
||||
- updatePreferences(isEnabled);
|
||||
+
|
||||
+ mIsEnabled = false;
|
||||
+ mWasEnabledAtCreation = false;
|
||||
+ updatePreferences(false);
|
||||
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
@@ -143,14 +143,7 @@ public class DataReductionPreferenceFragment extends PreferenceFragmentCompat {
|
||||
* Returns summary string.
|
||||
*/
|
||||
public static String generateSummary(Resources resources) {
|
||||
- if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) {
|
||||
- String percent =
|
||||
- DataReductionProxySettings.getInstance().getContentLengthPercentSavings();
|
||||
- return resources.getString(
|
||||
- R.string.data_reduction_menu_item_summary_lite_mode, percent);
|
||||
- } else {
|
||||
- return (String) resources.getText(R.string.text_off);
|
||||
- }
|
||||
+ return (String) resources.getText(R.string.text_off);
|
||||
}
|
||||
|
||||
private void createDataReductionSwitch(boolean isEnabled) {
|
||||
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
--- a/chrome/android/java/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
@@ -1288,9 +1288,6 @@ Your Google account may have other forms of browsing history like searches and a
|
||||
<message name="IDS_DATA_REDUCTION_DESCRIPTION_LITE_MODE" desc="Text describing how the Lite mode feature works. Seen only before the user has enabled the feature.">
|
||||
When Lite mode is on, Chrome uses Google servers to make pages load faster. Lite mode rewrites very slow pages to load only essential content. Lite mode does not apply to Incognito tabs.
|
||||
</message>
|
||||
- <message name="IDS_DATA_REDUCTION_MENU_ITEM_SUMMARY_LITE_MODE" desc="Label that states the percent of mobile data that was saved by Lite mode. Lite mode allows users to to reduce their mobile data usage by compressing network traffic.">
|
||||
- <ph name="PERCENT">%1$s<ex>49%</ex></ph> data savings
|
||||
- </message>
|
||||
<message name="IDS_DATA_REDUCTION_SAVINGS_LABEL" desc="Data Reduction statistics label that states the amount of mobile data that was saved by Lite mode. Lite mode allows users to to reduce their mobile data usage by compressing network traffic.">
|
||||
data saved
|
||||
</message>
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -3,18 +3,19 @@ Date: Tue, 16 Oct 2018 05:22:59 +0200
|
|||
Subject: Disable safe browsing
|
||||
|
||||
Originally based on ungoogled-chromium patch
|
||||
Contains Android-specific fixes to remove Safe Browsing
|
||||
---
|
||||
chrome/android/chrome_java_sources.gni | 1 -
|
||||
.../android/java/res/xml/privacy_preferences.xml | 21 -----
|
||||
.../java/res/xml/sync_and_services_preferences.xml | 20 -----
|
||||
.../preferences/privacy/PrivacyPreferences.java | 97 ----------------------
|
||||
.../preferences/privacy/PrivacyPreferences.java | 94 ----------------------
|
||||
.../chrome/browser/webshare/ShareServiceImpl.java | 6 --
|
||||
.../java/strings/android_chrome_strings.grd | 33 --------
|
||||
chrome/browser/BUILD.gn | 2 -
|
||||
chrome/browser/browser_process.h | 16 ----
|
||||
chrome/browser/browser_process_impl.cc | 36 --------
|
||||
chrome/browser/browser_process_impl.cc | 36 ---------
|
||||
chrome/browser/browser_process_impl.h | 6 --
|
||||
.../chrome_browsing_data_remover_delegate.cc | 41 ---------
|
||||
.../chrome_browsing_data_remover_delegate.cc | 41 ----------
|
||||
chrome/browser/chrome_content_browser_client.cc | 62 +++-----------
|
||||
.../file_type_policies_component_installer.cc | 16 +---
|
||||
.../download/chrome_download_manager_delegate.cc | 31 +++----
|
||||
|
@ -22,7 +23,7 @@ Originally based on ungoogled-chromium patch
|
|||
chrome/browser/download/download_item_model.cc | 13 ++-
|
||||
chrome/browser/download/download_item_model.h | 4 +
|
||||
chrome/browser/download/download_prefs.cc | 17 ++--
|
||||
.../browser/download/download_target_determiner.cc | 46 +++++-----
|
||||
.../browser/download/download_target_determiner.cc | 46 +++++------
|
||||
.../browser/download/download_target_determiner.h | 6 ++
|
||||
chrome/browser/download/download_target_info.cc | 4 +
|
||||
chrome/browser/download/download_target_info.h | 4 +
|
||||
|
@ -34,7 +35,7 @@ Originally based on ungoogled-chromium patch
|
|||
.../browser/extensions/blacklist_state_fetcher.cc | 34 +-------
|
||||
.../browser/extensions/blacklist_state_fetcher.h | 3 -
|
||||
.../metrics/chrome_metrics_service_client.cc | 3 -
|
||||
...chrome_native_file_system_permission_context.cc | 91 --------------------
|
||||
...chrome_native_file_system_permission_context.cc | 91 ---------------------
|
||||
.../chrome_native_file_system_permission_context.h | 6 --
|
||||
.../trial_comparison_cert_verifier_controller.cc | 3 -
|
||||
.../chrome_browser_main_extra_parts_profiles.cc | 1 -
|
||||
|
@ -42,7 +43,7 @@ Originally based on ungoogled-chromium patch
|
|||
chrome/browser/safe_browsing/BUILD.gn | 3 +-
|
||||
chrome/browser/ssl/captive_portal_blocking_page.cc | 7 +-
|
||||
chrome/browser/ssl/cert_report_helper.cc | 2 -
|
||||
chrome/browser/ssl/security_state_tab_helper.cc | 82 ------------------
|
||||
chrome/browser/ssl/security_state_tab_helper.cc | 82 -------------------
|
||||
.../chrome_subresource_filter_client.cc | 10 ---
|
||||
chrome/browser/ui/BUILD.gn | 1 -
|
||||
chrome/browser/ui/tab_helpers.cc | 11 +--
|
||||
|
@ -52,10 +53,10 @@ Originally based on ungoogled-chromium patch
|
|||
components/password_manager/core/browser/BUILD.gn | 2 +-
|
||||
components/safe_browsing/features.cc | 2 +-
|
||||
.../unified_consent/unified_consent_service.cc | 2 +-
|
||||
.../native_file_system_file_writer_impl.cc | 46 +---------
|
||||
.../native_file_system_file_writer_impl.cc | 46 +----------
|
||||
.../native_file_system_file_writer_impl.h | 15 +---
|
||||
.../native_file_system_permission_context.h | 7 --
|
||||
51 files changed, 119 insertions(+), 841 deletions(-)
|
||||
51 files changed, 119 insertions(+), 838 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni
|
||||
--- a/chrome/android/chrome_java_sources.gni
|
||||
|
@ -93,10 +94,10 @@ diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/androi
|
|||
- android:title="@string/safe_browsing_title"
|
||||
- android:summary="@string/safe_browsing_summary" />
|
||||
- <org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
android:key="network_predictions"
|
||||
android:title="@string/network_predictions_title"
|
||||
android:summary="@string/network_predictions_summary"
|
||||
@@ -38,14 +25,6 @@
|
||||
android:key="can_make_payment"
|
||||
android:title="@string/can_make_payment_title"
|
||||
android:summary="@string/settings_can_make_payment_toggle_label" />
|
||||
@@ -33,14 +20,6 @@
|
||||
android:title="@string/preload_pages_title"
|
||||
android:summary="@string/preload_pages_summary"
|
||||
android:persistent="false" />
|
||||
|
@ -163,7 +164,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
- private static final String PREF_SAFE_BROWSING = "safe_browsing";
|
||||
private static final String PREF_CAN_MAKE_PAYMENT = "can_make_payment";
|
||||
private static final String PREF_CONTEXTUAL_SEARCH = "contextual_search";
|
||||
private static final String PREF_NETWORK_PREDICTIONS = "network_predictions";
|
||||
private static final String PREF_NETWORK_PREDICTIONS = "preload_pages";
|
||||
private static final String PREF_DO_NOT_TRACK = "do_not_track";
|
||||
- private static final String PREF_USAGE_AND_CRASH_REPORTING = "usage_and_crash_reports";
|
||||
private static final String PREF_CLEAR_BROWSING_DATA = "clear_browsing_data";
|
||||
|
@ -220,7 +221,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
updateSummaries();
|
||||
}
|
||||
|
||||
@@ -146,18 +114,8 @@ public class PrivacyPreferences
|
||||
@@ -146,15 +114,8 @@ public class PrivacyPreferences
|
||||
String key = preference.getKey();
|
||||
if (PREF_SEARCH_SUGGESTIONS.equals(key)) {
|
||||
PrefServiceBridge.getInstance().setSearchSuggestEnabled((boolean) newValue);
|
||||
|
@ -233,13 +234,10 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
PrefServiceBridge.getInstance().setNetworkPredictionEnabled((boolean) newValue);
|
||||
- } else if (PREF_NAVIGATION_ERROR.equals(key)) {
|
||||
- PrefServiceBridge.getInstance().setResolveNavigationErrorEnabled((boolean) newValue);
|
||||
- } else if (PREF_CAN_MAKE_PAYMENT.equals(key)) {
|
||||
- PrefServiceBridge.getInstance().setBoolean(
|
||||
- Pref.CAN_MAKE_PAYMENT_ENABLED, (boolean) newValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -180,32 +138,12 @@ public class PrivacyPreferences
|
||||
} else if (PREF_CONTEXTUAL_SEARCH.equals(key)) {
|
||||
PrefServiceBridge.getInstance().setContextualSearchPreference(((boolean) newValue) ? "true" : "false");
|
||||
} else if (PREF_CAN_MAKE_PAYMENT.equals(key)) {
|
||||
@@ -182,32 +143,12 @@ public class PrivacyPreferences
|
||||
CharSequence textOn = getActivity().getResources().getText(R.string.text_on);
|
||||
CharSequence textOff = getActivity().getResources().getText(R.string.text_off);
|
||||
|
||||
|
@ -272,7 +270,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
CheckBoxPreference canMakePaymentPref =
|
||||
(CheckBoxPreference) findPreference(PREF_CAN_MAKE_PAYMENT);
|
||||
if (canMakePaymentPref != null) {
|
||||
@@ -223,50 +161,15 @@ public class PrivacyPreferences
|
||||
@@ -225,50 +166,15 @@ public class PrivacyPreferences
|
||||
boolean isContextualSearchEnabled = !prefServiceBridge.isContextualSearchDisabled();
|
||||
contextualPref.setSummary(isContextualSearchEnabled ? textOn : textOff);
|
||||
}
|
||||
|
@ -403,10 +401,10 @@ diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/and
|
|||
- <message name="IDS_SAFE_BROWSING_SUMMARY" desc="Summary for safe browsing.">
|
||||
- Sends URLs of some pages you visit to Google, when your security is at risk
|
||||
- </message>
|
||||
<message name="IDS_NETWORK_PREDICTIONS_TITLE" desc="Title of a setting in Chrome settings. Followed by a body that describes the setting. If setting is turned on, Chrome will download certain pages to the user’s phone automatically for offline reading. 'predictions' convey the idea that Chrome is using predictive models to figure out pages likely of interest to the user.">
|
||||
Use page predictions
|
||||
<message name="IDS_CONTEXTUAL_SEARCH_TITLE" desc="Name for the Contextual Search feature, which allows users to search for a term in a web page by tapping on it.">
|
||||
Tap to Search
|
||||
</message>
|
||||
@@ -4044,9 +4014,6 @@ The site does NOT gain access to the camera. The camera images are only visible
|
||||
@@ -4038,9 +4008,6 @@ The site does NOT gain access to the camera. The camera images are only visible
|
||||
<message name="IDS_USAGE_STATS_CONSENT_PROMPT" desc="Consent prompt when authorizing Digital Wellbeing to access Chrome usage data">
|
||||
You can see sites you visit in Chrome and set timers for them.\n\nGoogle gets info about the sites you set timers for and how long you visit them. This info is used to make Digital Wellbeing better.
|
||||
</message>
|
||||
|
@ -647,7 +645,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
|||
#include "chrome/browser/ssl/typed_navigation_timing_throttle.h"
|
||||
#include "chrome/browser/subresource_filter/chrome_subresource_filter_client.h"
|
||||
#include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
|
||||
@@ -861,30 +862,6 @@ void SetApplicationLocaleOnIOThread(const std::string& locale) {
|
||||
@@ -862,30 +863,6 @@ void SetApplicationLocaleOnIOThread(const std::string& locale) {
|
||||
GetIOThreadApplicationLocale() = locale;
|
||||
}
|
||||
|
||||
|
@ -678,7 +676,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
|||
#if defined(OS_ANDROID)
|
||||
float GetDeviceScaleAdjustment() {
|
||||
static const float kMinFSM = 1.05f;
|
||||
@@ -1263,7 +1240,9 @@ void ChromeContentBrowserClient::PostAfterStartupTask(
|
||||
@@ -1264,7 +1241,9 @@ void ChromeContentBrowserClient::PostAfterStartupTask(
|
||||
InitNetworkContextsParentDirectory();
|
||||
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
|
@ -688,7 +686,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
|||
}
|
||||
|
||||
bool ChromeContentBrowserClient::IsBrowserStartupComplete() {
|
||||
@@ -2030,7 +2009,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
@@ -2031,7 +2010,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
}
|
||||
#elif defined(OS_POSIX)
|
||||
#if defined(OS_ANDROID)
|
||||
|
@ -697,7 +695,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
|||
#else
|
||||
bool enable_crash_reporter = breakpad::IsCrashReporterEnabled();
|
||||
#endif
|
||||
@@ -2121,7 +2100,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
@@ -2122,7 +2101,7 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
// Disable client-side phishing detection in the renderer if it is
|
||||
// disabled in the Profile preferences or the browser process.
|
||||
if (!prefs->GetBoolean(prefs::kSafeBrowsingEnabled) ||
|
||||
|
@ -706,7 +704,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
|||
command_line->AppendSwitch(
|
||||
switches::kDisableClientSidePhishingDetection);
|
||||
}
|
||||
@@ -4201,12 +4180,12 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
||||
@@ -4202,12 +4181,12 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
||||
|
||||
throttles.push_back(std::make_unique<PolicyBlacklistNavigationThrottle>(
|
||||
handle, handle->GetWebContents()->GetBrowserContext()));
|
||||
|
@ -721,7 +719,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
|||
throttles.push_back(std::make_unique<LoginNavigationThrottle>(handle));
|
||||
|
||||
std::unique_ptr<content::NavigationThrottle> https_upgrade_timing_throttle =
|
||||
@@ -4237,11 +4216,6 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
||||
@@ -4238,11 +4217,6 @@ ChromeContentBrowserClient::CreateThrottlesForNavigation(
|
||||
PreviewsLitePageDecider::MaybeCreateThrottleFor(handle);
|
||||
if (previews_lite_page_throttle)
|
||||
throttles.push_back(std::move(previews_lite_page_throttle));
|
||||
|
@ -733,7 +731,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch
|
|||
|
||||
#if defined(OS_WIN) || defined(OS_MACOSX) || \
|
||||
(defined(OS_LINUX) && !defined(OS_CHROMEOS))
|
||||
@@ -5249,19 +5223,7 @@ ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate(
|
||||
@@ -5250,19 +5224,7 @@ ChromeContentBrowserClient::GetSafeBrowsingUrlCheckerDelegate(
|
||||
content::ResourceContext* resource_context) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
||||
|
||||
|
|
|
@ -1,384 +0,0 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Tue, 12 Jun 2018 14:23:07 +0200
|
||||
Subject: Disable signin and data saver preferences
|
||||
|
||||
Never show the data saver promo snackbar
|
||||
---
|
||||
chrome/android/java/res/xml/main_preferences.xml | 20 -----
|
||||
.../android/java/res/xml/privacy_preferences.xml | 7 --
|
||||
.../browser/preferences/MainPreferences.java | 86 +---------------------
|
||||
.../preferences/privacy/PrivacyPreferences.java | 15 ----
|
||||
.../sync/SyncAndServicesPreferences.java | 7 --
|
||||
.../preferences/sync/SyncPreferenceUtils.java | 3 -
|
||||
.../java/strings/android_chrome_strings.grd | 15 ----
|
||||
7 files changed, 1 insertion(+), 152 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/java/res/xml/main_preferences.xml b/chrome/android/java/res/xml/main_preferences.xml
|
||||
--- a/chrome/android/java/res/xml/main_preferences.xml
|
||||
+++ b/chrome/android/java/res/xml/main_preferences.xml
|
||||
@@ -7,21 +7,6 @@
|
||||
android:orderingFromXml="false">
|
||||
|
||||
<PreferenceCategory
|
||||
- android:key="account_section"
|
||||
- android:order="0"
|
||||
- android:title="@string/prefs_section_account"/>
|
||||
- <org.chromium.chrome.browser.preferences.sync.SignInPreference
|
||||
- android:key="sign_in"
|
||||
- android:order="1"
|
||||
- android:title="@string/sign_in_to_chrome"/>
|
||||
- <org.chromium.chrome.browser.preferences.ChromeBasePreference
|
||||
- android:key="sync_and_services"
|
||||
- android:order="2"
|
||||
- android:layout="@layout/account_management_account_row"
|
||||
- android:title="@string/prefs_sync_and_services"
|
||||
- android:fragment="org.chromium.chrome.browser.preferences.sync.SyncAndServicesPreferences"/>
|
||||
-
|
||||
- <PreferenceCategory
|
||||
android:key="basics_section"
|
||||
android:order="3"
|
||||
android:title="@string/prefs_section_basics"/>
|
||||
@@ -91,11 +76,6 @@
|
||||
android:order="16"
|
||||
android:title="@string/prefs_languages"/>
|
||||
<org.chromium.chrome.browser.preferences.ChromeBasePreference
|
||||
- android:fragment="org.chromium.chrome.browser.preferences.datareduction.DataReductionPreferenceFragment"
|
||||
- android:key="data_reduction"
|
||||
- android:order="17"
|
||||
- android:title="@string/data_reduction_title_lite_mode"/>
|
||||
- <org.chromium.chrome.browser.preferences.ChromeBasePreference
|
||||
android:fragment="org.chromium.chrome.browser.preferences.download.DownloadPreferences"
|
||||
android:key="downloads"
|
||||
android:order="18"
|
||||
diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
--- a/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
+++ b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
@@ -38,12 +38,5 @@
|
||||
android:title="@string/clear_browsing_data_title"
|
||||
android:summary="@string/clear_browsing_data_summary"
|
||||
android:fragment="org.chromium.chrome.browser.preferences.privacy.ClearBrowsingDataTabsFragment" />
|
||||
- <android.support.v7.preference.Preference
|
||||
- android:key="sync_and_services_link_divider"
|
||||
- android:layout="@layout/divider_preference"
|
||||
- android:selectable="false"/>
|
||||
- <org.chromium.chrome.browser.preferences.TextMessagePreference
|
||||
- android:key="sync_and_services_link"
|
||||
- android:summary="@string/privacy_sync_and_services_link"
|
||||
app:allowDividerBelow="false" />
|
||||
</PreferenceScreen>
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/MainPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/MainPreferences.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/MainPreferences.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/MainPreferences.java
|
||||
@@ -17,13 +17,11 @@ import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.VisibleForTesting;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.ChromeFeatureList;
|
||||
-import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
|
||||
import org.chromium.chrome.browser.night_mode.NightModeUtils;
|
||||
import org.chromium.chrome.browser.offlinepages.prefetch.PrefetchConfiguration;
|
||||
import org.chromium.chrome.browser.partnercustomizations.HomepageManager;
|
||||
import org.chromium.chrome.browser.password_manager.ManagePasswordsReferrer;
|
||||
import org.chromium.chrome.browser.preferences.autofill_assistant.AutofillAssistantPreferences;
|
||||
-import org.chromium.chrome.browser.preferences.datareduction.DataReductionPreferenceFragment;
|
||||
import org.chromium.chrome.browser.preferences.developer.DeveloperPreferences;
|
||||
import org.chromium.chrome.browser.preferences.sync.SignInPreference;
|
||||
import org.chromium.chrome.browser.preferences.sync.SyncPreferenceUtils;
|
||||
@@ -42,16 +40,11 @@ import java.util.Map;
|
||||
* The main settings screen, shown when the user first opens Settings.
|
||||
*/
|
||||
public class MainPreferences extends PreferenceFragmentCompat
|
||||
- implements TemplateUrlService.LoadListener, ProfileSyncService.SyncStateChangedListener,
|
||||
- SigninManager.SignInStateObserver {
|
||||
- public static final String PREF_ACCOUNT_SECTION = "account_section";
|
||||
- public static final String PREF_SIGN_IN = "sign_in";
|
||||
- public static final String PREF_SYNC_AND_SERVICES = "sync_and_services";
|
||||
+ implements TemplateUrlService.LoadListener {
|
||||
public static final String PREF_SEARCH_ENGINE = "search_engine";
|
||||
public static final String PREF_SAVED_PASSWORDS = "saved_passwords";
|
||||
public static final String PREF_HOMEPAGE = "homepage";
|
||||
public static final String PREF_UI_THEME = "ui_theme";
|
||||
- public static final String PREF_DATA_REDUCTION = "data_reduction";
|
||||
public static final String PREF_NOTIFICATIONS = "notifications";
|
||||
public static final String PREF_LANGUAGES = "languages";
|
||||
public static final String PREF_DOWNLOADS = "downloads";
|
||||
@@ -65,7 +58,6 @@ public class MainPreferences extends PreferenceFragmentCompat
|
||||
|
||||
private final ManagedPreferenceDelegate mManagedPreferenceDelegate;
|
||||
private final Map<String, Preference> mAllPreferences = new HashMap<>();
|
||||
- private SignInPreference mSignInPreference;
|
||||
|
||||
public MainPreferences() {
|
||||
setHasOptionsMenu(true);
|
||||
@@ -88,35 +80,16 @@ public class MainPreferences extends PreferenceFragmentCompat
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
- mSignInPreference.onPreferenceFragmentDestroyed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
- SigninManager signinManager = IdentityServicesProvider.getSigninManager();
|
||||
- if (signinManager.isSigninSupported()) {
|
||||
- signinManager.addSignInStateObserver(this);
|
||||
- mSignInPreference.registerForUpdates();
|
||||
- }
|
||||
- ProfileSyncService syncService = ProfileSyncService.get();
|
||||
- if (syncService != null) {
|
||||
- syncService.addSyncStateChangedListener(this);
|
||||
- }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
- SigninManager signinManager = IdentityServicesProvider.getSigninManager();
|
||||
- if (signinManager.isSigninSupported()) {
|
||||
- signinManager.removeSignInStateObserver(this);
|
||||
- mSignInPreference.unregisterForUpdates();
|
||||
- }
|
||||
- ProfileSyncService syncService = ProfileSyncService.get();
|
||||
- if (syncService != null) {
|
||||
- syncService.removeSyncStateChangedListener(this);
|
||||
- }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,12 +102,9 @@ public class MainPreferences extends PreferenceFragmentCompat
|
||||
PreferenceUtils.addPreferencesFromResource(this, R.xml.main_preferences);
|
||||
cachePreferences();
|
||||
|
||||
- mSignInPreference.setOnStateChangedCallback(this::onSignInPreferenceStateChanged);
|
||||
-
|
||||
updatePasswordsPreference();
|
||||
|
||||
setManagedPreferenceDelegateForPreference(PREF_SEARCH_ENGINE);
|
||||
- setManagedPreferenceDelegateForPreference(PREF_DATA_REDUCTION);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// If we are on Android O+ the Notifications preference should lead to the Android
|
||||
@@ -188,7 +158,6 @@ public class MainPreferences extends PreferenceFragmentCompat
|
||||
Preference preference = getPreferenceScreen().getPreference(index);
|
||||
mAllPreferences.put(preference.getKey(), preference);
|
||||
}
|
||||
- mSignInPreference = (SignInPreference) mAllPreferences.get(PREF_SIGN_IN);
|
||||
}
|
||||
|
||||
private void setManagedPreferenceDelegateForPreference(String key) {
|
||||
@@ -197,13 +166,6 @@ public class MainPreferences extends PreferenceFragmentCompat
|
||||
}
|
||||
|
||||
private void updatePreferences() {
|
||||
- if (IdentityServicesProvider.getSigninManager().isSigninSupported()) {
|
||||
- addPreferenceIfAbsent(PREF_SIGN_IN);
|
||||
- } else {
|
||||
- removePreferenceIfPresent(PREF_SIGN_IN);
|
||||
- }
|
||||
-
|
||||
- updateSyncAndServicesPreference();
|
||||
updateSearchEnginePreference();
|
||||
|
||||
Preference homepagePref = addPreferenceIfAbsent(PREF_HOMEPAGE);
|
||||
@@ -223,10 +185,6 @@ public class MainPreferences extends PreferenceFragmentCompat
|
||||
} else {
|
||||
removePreferenceIfPresent(PREF_DEVELOPER);
|
||||
}
|
||||
-
|
||||
- ChromeBasePreference dataReduction =
|
||||
- (ChromeBasePreference) findPreference(PREF_DATA_REDUCTION);
|
||||
- dataReduction.setSummary(DataReductionPreferenceFragment.generateSummary(getResources()));
|
||||
}
|
||||
|
||||
private Preference addPreferenceIfAbsent(String key) {
|
||||
@@ -240,13 +198,6 @@ public class MainPreferences extends PreferenceFragmentCompat
|
||||
if (preference != null) getPreferenceScreen().removePreference(preference);
|
||||
}
|
||||
|
||||
- private void updateSyncAndServicesPreference() {
|
||||
- ChromeBasePreference syncAndServices =
|
||||
- (ChromeBasePreference) findPreference(PREF_SYNC_AND_SERVICES);
|
||||
- syncAndServices.setIcon(SyncPreferenceUtils.getSyncStatusIcon(getActivity()));
|
||||
- syncAndServices.setSummary(SyncPreferenceUtils.getSyncStatusSummary(getActivity()));
|
||||
- }
|
||||
-
|
||||
private void updateSearchEnginePreference() {
|
||||
if (!TemplateUrlServiceFactory.get().isLoaded()) {
|
||||
ChromeBasePreference searchEnginePref =
|
||||
@@ -278,28 +229,6 @@ public class MainPreferences extends PreferenceFragmentCompat
|
||||
pref.setSummary(getResources().getString(isOn ? R.string.text_on : R.string.text_off));
|
||||
}
|
||||
|
||||
- // SigninManager.SignInStateObserver implementation.
|
||||
- @Override
|
||||
- public void onSignedIn() {
|
||||
- // After signing in or out of a managed account, preferences may change or become enabled
|
||||
- // or disabled.
|
||||
- new Handler().post(() -> updatePreferences());
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void onSignedOut() {
|
||||
- updatePreferences();
|
||||
- }
|
||||
-
|
||||
- private void onSignInPreferenceStateChanged() {
|
||||
- // Remove "Account" section header if the personalized sign-in promo is shown.
|
||||
- if (mSignInPreference.getState() == SignInPreference.State.PERSONALIZED_PROMO) {
|
||||
- removePreferenceIfPresent(PREF_ACCOUNT_SECTION);
|
||||
- } else {
|
||||
- addPreferenceIfAbsent(PREF_ACCOUNT_SECTION);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
// TemplateUrlService.LoadListener implementation.
|
||||
@Override
|
||||
public void onTemplateUrlServiceLoaded() {
|
||||
@@ -307,11 +236,6 @@ public class MainPreferences extends PreferenceFragmentCompat
|
||||
updateSearchEnginePreference();
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public void syncStateChanged() {
|
||||
- updateSyncAndServicesPreference();
|
||||
- }
|
||||
-
|
||||
@VisibleForTesting
|
||||
ManagedPreferenceDelegate getManagedPreferenceDelegateForTest() {
|
||||
return mManagedPreferenceDelegate;
|
||||
@@ -321,9 +245,6 @@ public class MainPreferences extends PreferenceFragmentCompat
|
||||
return new ManagedPreferenceDelegate() {
|
||||
@Override
|
||||
public boolean isPreferenceControlledByPolicy(Preference preference) {
|
||||
- if (PREF_DATA_REDUCTION.equals(preference.getKey())) {
|
||||
- return DataReductionProxySettings.getInstance().isDataReductionProxyManaged();
|
||||
- }
|
||||
if (PREF_SEARCH_ENGINE.equals(preference.getKey())) {
|
||||
return TemplateUrlServiceFactory.get().isDefaultSearchManaged();
|
||||
}
|
||||
@@ -332,11 +253,6 @@ public class MainPreferences extends PreferenceFragmentCompat
|
||||
|
||||
@Override
|
||||
public boolean isPreferenceClickDisabledByPolicy(Preference preference) {
|
||||
- if (PREF_DATA_REDUCTION.equals(preference.getKey())) {
|
||||
- DataReductionProxySettings settings = DataReductionProxySettings.getInstance();
|
||||
- return settings.isDataReductionProxyManaged()
|
||||
- && !settings.isDataReductionProxyEnabled();
|
||||
- }
|
||||
if (PREF_SEARCH_ENGINE.equals(preference.getKey())) {
|
||||
return TemplateUrlServiceFactory.get().isDefaultSearchManaged();
|
||||
}
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferences.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferences.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferences.java
|
||||
@@ -24,7 +24,6 @@ import org.chromium.chrome.browser.preferences.Pref;
|
||||
import org.chromium.chrome.browser.preferences.PrefServiceBridge;
|
||||
import org.chromium.chrome.browser.preferences.PreferenceUtils;
|
||||
import org.chromium.chrome.browser.preferences.PreferencesLauncher;
|
||||
-import org.chromium.chrome.browser.preferences.sync.SyncAndServicesPreferences;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.usage_stats.UsageStatsConsentDialog;
|
||||
import org.chromium.ui.text.NoUnderlineClickableSpan;
|
||||
@@ -41,9 +40,6 @@ public class PrivacyPreferences
|
||||
private static final String PREF_NETWORK_PREDICTIONS = "network_predictions";
|
||||
private static final String PREF_DO_NOT_TRACK = "do_not_track";
|
||||
private static final String PREF_CLEAR_BROWSING_DATA = "clear_browsing_data";
|
||||
- private static final String PREF_SYNC_AND_SERVICES_LINK_DIVIDER =
|
||||
- "sync_and_services_link_divider";
|
||||
- private static final String PREF_SYNC_AND_SERVICES_LINK = "sync_and_services_link";
|
||||
|
||||
private ManagedPreferenceDelegate mManagedPreferenceDelegate;
|
||||
|
||||
@@ -86,20 +82,9 @@ public class PrivacyPreferences
|
||||
networkPredictionPref.setOrder(canMakePaymentPref.getOrder());
|
||||
preferenceScreen.addPreference(networkPredictionPref);
|
||||
|
||||
- Preference syncAndServicesLink = findPreference(PREF_SYNC_AND_SERVICES_LINK);
|
||||
- NoUnderlineClickableSpan linkSpan = new NoUnderlineClickableSpan(getResources(), view -> {
|
||||
- PreferencesLauncher.launchSettingsPage(getActivity(), SyncAndServicesPreferences.class,
|
||||
- SyncAndServicesPreferences.createArguments(false));
|
||||
- });
|
||||
- syncAndServicesLink.setSummary(
|
||||
- SpanApplier.applySpans(getString(R.string.privacy_sync_and_services_link),
|
||||
- new SpanApplier.SpanInfo("<link>", "</link>", linkSpan)));
|
||||
-
|
||||
updateSummaries();
|
||||
return;
|
||||
}
|
||||
- preferenceScreen.removePreference(findPreference(PREF_SYNC_AND_SERVICES_LINK_DIVIDER));
|
||||
- preferenceScreen.removePreference(findPreference(PREF_SYNC_AND_SERVICES_LINK));
|
||||
|
||||
ChromeBaseCheckBoxPreference searchSuggestionsPref =
|
||||
(ChromeBaseCheckBoxPreference) findPreference(PREF_SEARCH_SUGGESTIONS);
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/sync/SyncAndServicesPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/sync/SyncAndServicesPreferences.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/sync/SyncAndServicesPreferences.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/sync/SyncAndServicesPreferences.java
|
||||
@@ -163,14 +163,7 @@ public class SyncAndServicesPreferences extends PreferenceFragmentCompat
|
||||
|
||||
mPrivacyPrefManager.migrateNetworkPredictionPreferences();
|
||||
|
||||
- getActivity().setTitle(R.string.prefs_sync_and_services);
|
||||
setHasOptionsMenu(true);
|
||||
- if (mIsFromSigninScreen) {
|
||||
- ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
|
||||
- assert actionBar != null;
|
||||
- actionBar.setHomeActionContentDescription(
|
||||
- R.string.prefs_sync_and_services_content_description);
|
||||
- }
|
||||
|
||||
PreferenceUtils.addPreferencesFromResource(this, R.xml.sync_and_services_preferences);
|
||||
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/sync/SyncPreferenceUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/sync/SyncPreferenceUtils.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/sync/SyncPreferenceUtils.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/sync/SyncPreferenceUtils.java
|
||||
@@ -119,9 +119,6 @@ public class SyncPreferenceUtils {
|
||||
if (profileSyncService.isPassphraseRequiredForDecryption()) {
|
||||
return res.getString(R.string.sync_need_passphrase);
|
||||
}
|
||||
- if (ChromeFeatureList.isEnabled(ChromeFeatureList.UNIFIED_CONSENT)) {
|
||||
- return context.getString(R.string.sync_and_services_summary_sync_on);
|
||||
- }
|
||||
return context.getString(R.string.account_management_sync_summary, accountName);
|
||||
}
|
||||
return context.getString(R.string.sync_is_disabled);
|
||||
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
--- a/chrome/android/java/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
@@ -345,24 +345,12 @@ CHAR-LIMIT guidelines:
|
||||
</message>
|
||||
|
||||
<!-- Sign-in, sync and personalization preferences -->
|
||||
- <message name="IDS_PREFS_SECTION_ACCOUNT" desc="Title for the group of account-related entries in Settings. [CHAR-LIMIT=32]">
|
||||
- Account
|
||||
- </message>
|
||||
<message name="IDS_SIGN_IN_TO_CHROME" desc="Title for the button to sign in to Chrome using one's Google account. [CHAR-LIMIT=27]">
|
||||
Sign in to Chrome
|
||||
</message>
|
||||
- <message name="IDS_PREFS_SYNC_AND_SERVICES" desc="Title for Settings section to manage data collection for Sync and Google services. [CHAR-LIMIT=40]">
|
||||
- Sync and Google services
|
||||
- </message>
|
||||
- <message name="IDS_PREFS_SYNC_AND_SERVICES_CONTENT_DESCRIPTION" desc="The accessibility text to read when the 'Sync and Google services' Settings page is opened from the sign-in page. This text is attached to the 'Navigate Up' button shown at the top of the screen. The first two sentences describe the screen that is currently shown to the user, while 'Navigate up' is a description for the button this text is attached to. 'Navigate up' should match TC ID 6794660482873516081.">
|
||||
- You are currently customizing your Sync and Google service settings. To finish turning on sync, tap the Confirm button near the bottom of the screen. Navigate up
|
||||
- </message>
|
||||
<message name="IDS_SIGNIN_PREF_SUMMARY" desc="Summary for the entry in Settings to sign in to Chrome, explaining benefits of signing in.">
|
||||
Sync and personalize across devices
|
||||
</message>
|
||||
- <message name="IDS_SYNC_AND_SERVICES_SUMMARY_SYNC_ON" desc="Summary for 'Sync and Google services' preference row when sync is enabled.">
|
||||
- Sync is on
|
||||
- </message>
|
||||
<message name="IDS_SIGN_IN_TO_CHROME_DISABLED_SUMMARY" desc="A descriptive line of text that appears under the 'Sign in to Chrome' option, in Chrome Settings on Android. The text explains why 'Sign in to Chrome' is disabled. 'Administrator' refers to the IT administrator of the company/organization that owns the user’s device.">
|
||||
Disabled by the administrator of this device
|
||||
</message>
|
||||
@@ -412,9 +400,6 @@ CHAR-LIMIT guidelines:
|
||||
<message name="IDS_URL_KEYED_ANONYMIZED_DATA_SUMMARY" desc="Summary for a checkbox in Settings that controls non-personalized URL collection and informs the user about the data shared by this feature.">
|
||||
Sends URLs of pages you visit to Google
|
||||
</message>
|
||||
- <message name="IDS_PRIVACY_SYNC_AND_SERVICES_LINK" desc="The text for Privacy preferences that is shown after all preference rows.">
|
||||
- For more settings that relate to privacy, security, and data collection, see <ph name="BEGIN_LINK"><link></ph>Sync and Google services<ph name="END_LINK"></link></ph>
|
||||
- </message>
|
||||
<message name="IDS_CANCEL_SYNC_DIALOG_TITLE" desc="The title of a dialog that is shown when users tries closing 'Sync and Google services' preferences without confirming the changes.">
|
||||
Cancel sync?
|
||||
</message>
|
||||
--
|
||||
2.11.0
|
||||
|
32
build/patches/Disable-some-signed-exchange-features.patch
Normal file
32
build/patches/Disable-some-signed-exchange-features.patch
Normal file
|
@ -0,0 +1,32 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Sat, 2 Nov 2019 16:22:56 +0100
|
||||
Subject: Disable some signed exchange features
|
||||
|
||||
---
|
||||
content/public/common/content_features.cc | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc
|
||||
--- a/content/public/common/content_features.cc
|
||||
+++ b/content/public/common/content_features.cc
|
||||
@@ -508,7 +508,7 @@ const base::Feature kSignedExchangePrefetchCacheForNavigations{
|
||||
// Signed Exchange Reporting for distributors
|
||||
// https://www.chromestatus.com/features/5687904902840320
|
||||
const base::Feature kSignedExchangeReportingForDistributors{
|
||||
- "SignedExchangeReportingForDistributors", base::FEATURE_ENABLED_BY_DEFAULT};
|
||||
+ "SignedExchangeReportingForDistributors", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
||||
// Subresource prefetching+loading via Signed HTTP Exchange
|
||||
// https://www.chromestatus.com/features/5126805474246656
|
||||
@@ -518,7 +518,7 @@ const base::Feature kSignedExchangeSubresourcePrefetch{
|
||||
// Origin-Signed HTTP Exchanges (for WebPackage Loading)
|
||||
// https://www.chromestatus.com/features/5745285984681984
|
||||
const base::Feature kSignedHTTPExchange{"SignedHTTPExchange",
|
||||
- base::FEATURE_ENABLED_BY_DEFAULT};
|
||||
+ base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
||||
// Whether to send a ping to the inner URL upon navigation or not.
|
||||
const base::Feature kSignedHTTPExchangePingValidity{
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -1,507 +0,0 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Sun, 14 Apr 2019 12:08:27 +0200
|
||||
Subject: Disable unused permissions
|
||||
|
||||
Disable sync adaptive and invalidation services from manifest
|
||||
|
||||
Prevents authorization prompt for Play services on reboot
|
||||
|
||||
Fixes building with debug symbols:
|
||||
|
||||
ld.lld: error: undefined symbol: notifier::NotifierOptions::NotifierOptions()
|
||||
>>> referenced by invalidation_service_util.cc:17 (../../components/invalidation/impl/invalidation_service_util.cc:17)
|
||||
>>> impl/invalidation_service_util.o:(invalidation::ParseNotifierOptions(base::CommandLine const&)) in archive obj/components/invalidation/impl/libimpl.a
|
||||
|
||||
Fixup more permission removal
|
||||
---
|
||||
chrome/android/BUILD.gn | 4 +-
|
||||
chrome/android/java/AndroidManifest.xml | 27 -----
|
||||
.../chromium/chrome/browser/ChromeActivity.java | 34 ------
|
||||
.../invalidation/impl/invalidation_service_util.cc | 21 ----
|
||||
.../invalidation/impl/invalidation_service_util.h | 6 +-
|
||||
.../signin/SystemAccountManagerDelegate.java | 38 +------
|
||||
.../components/sync/AndroidSyncSettings.java | 24 +---
|
||||
.../chromium/net/HttpNegotiateAuthenticator.java | 122 +--------------------
|
||||
.../chromoting/base/OAuthTokenFetcher.java | 2 -
|
||||
9 files changed, 13 insertions(+), 265 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
|
||||
--- a/chrome/android/BUILD.gn
|
||||
+++ b/chrome/android/BUILD.gn
|
||||
@@ -1158,8 +1158,7 @@ jinja_template_resources("chrome_public_apk_template_resources") {
|
||||
resources = [
|
||||
"java/res_template/xml/file_paths.xml",
|
||||
"java/res_template/xml/launchershortcuts.xml",
|
||||
- "java/res_template/xml/searchable.xml",
|
||||
- "java/res_template/xml/syncadapter.xml",
|
||||
+ "java/res_template/xml/searchable.xml"
|
||||
]
|
||||
res_dir = "java/res_template"
|
||||
variables = [ "manifest_package=$chrome_public_manifest_package" ]
|
||||
@@ -1170,7 +1169,6 @@ jinja_template_resources("chrome_test_apk_template_resources") {
|
||||
"java/res_template/xml/file_paths.xml",
|
||||
"java/res_template/xml/launchershortcuts.xml",
|
||||
"java/res_template/xml/searchable.xml",
|
||||
- "java/res_template/xml/syncadapter.xml",
|
||||
]
|
||||
res_dir = "java/res_template"
|
||||
|
||||
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
|
||||
--- a/chrome/android/java/AndroidManifest.xml
|
||||
+++ b/chrome/android/java/AndroidManifest.xml
|
||||
@@ -47,22 +47,16 @@ by a child template that "extends" this file.
|
||||
{% if target_sdk_version|int > 27 or target_sdk_version == "Q" %}
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
{% endif %}
|
||||
- <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
- <uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
|
||||
<uses-permission android:name="android.permission.NFC"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
- <uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
|
||||
- <uses-permission android:name="android.permission.READ_SYNC_STATS"/>
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||
- <uses-permission android:name="android.permission.USE_CREDENTIALS"/>
|
||||
<uses-permission-sdk-23 android:name="android.permission.USE_FINGERPRINT"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
- <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
|
||||
{% set enable_vr = enable_vr|default(0) %}
|
||||
{% if enable_vr == "true" %}
|
||||
<!-- Indicates use of Android's VR-mode, available only on Android N+. -->
|
||||
@@ -103,8 +97,6 @@ by a child template that "extends" this file.
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
|
||||
|
||||
- <uses-permission android:name="com.google.android.apps.now.CURRENT_ACCOUNT_ACCESS" />
|
||||
-
|
||||
{% block extra_uses_permissions %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -1009,16 +1001,6 @@ by a child template that "extends" this file.
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
- <!-- Sync adapter for browser invalidation. -->
|
||||
- <service android:name="org.chromium.chrome.browser.invalidation.ChromeBrowserSyncAdapterService"
|
||||
- android:exported="false">
|
||||
- <intent-filter>
|
||||
- <action android:name="android.content.SyncAdapter" />
|
||||
- </intent-filter>
|
||||
- <meta-data android:name="android.content.SyncAdapter"
|
||||
- android:resource="@xml/syncadapter" />
|
||||
- </service>
|
||||
-
|
||||
<!-- Broadcast receiver that will be notified of account changes -->
|
||||
<receiver android:name="org.chromium.chrome.browser.services.AccountsChangedReceiver">
|
||||
<intent-filter>
|
||||
@@ -1126,15 +1108,6 @@ by a child template that "extends" this file.
|
||||
<service android:name="org.chromium.chrome.browser.services.gcm.InvalidationGcmUpstreamSender"
|
||||
android:exported="false"/>
|
||||
|
||||
- <!-- Notification service for sync. -->
|
||||
- <meta-data android:name="ipc.invalidation.ticl.listener_service_class"
|
||||
- android:value="org.chromium.chrome.browser.invalidation.ChromeInvalidationClientService"/>
|
||||
- <service android:name="org.chromium.chrome.browser.invalidation.ChromeInvalidationClientService"
|
||||
- android:exported="false">
|
||||
- <intent-filter>
|
||||
- <action android:name="com.google.ipc.invalidation.AUTH_TOKEN_REQUEST"/>
|
||||
- </intent-filter>
|
||||
- </service>
|
||||
<service android:name="com.google.ipc.invalidation.ticl.android2.TiclService"
|
||||
android:exported="false"/>
|
||||
<service android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageSenderService"
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
|
||||
@@ -126,8 +126,6 @@ import org.chromium.chrome.browser.share.ShareMenuActionHandler;
|
||||
import org.chromium.chrome.browser.snackbar.BottomContainer;
|
||||
import org.chromium.chrome.browser.snackbar.SnackbarManager;
|
||||
import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarManageable;
|
||||
-import org.chromium.chrome.browser.sync.ProfileSyncService;
|
||||
-import org.chromium.chrome.browser.sync.SyncController;
|
||||
import org.chromium.chrome.browser.tab.Tab;
|
||||
import org.chromium.chrome.browser.tab.TabBrowserControlsState;
|
||||
import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager;
|
||||
@@ -265,9 +263,6 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
|
||||
@SuppressLint("NewApi")
|
||||
private TouchExplorationStateChangeListener mTouchExplorationStateChangeListener;
|
||||
|
||||
- // Observes when sync becomes ready to create the mContextReporter.
|
||||
- private ProfileSyncService.SyncStateChangedListener mSyncStateChangedListener;
|
||||
-
|
||||
@Nullable
|
||||
private ChromeFullscreenManager mFullscreenManager;
|
||||
|
||||
@@ -906,28 +901,6 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
|
||||
private void createContextReporterIfNeeded() {
|
||||
if (!mStarted) return; // Sync state reporting should work only in started state.
|
||||
if (mContextReporter != null || getActivityTab() == null) return;
|
||||
-
|
||||
- final SyncController syncController = SyncController.get(this);
|
||||
- final ProfileSyncService syncService = ProfileSyncService.get();
|
||||
-
|
||||
- if (syncController != null && syncController.isSyncingUrlsWithKeystorePassphrase()) {
|
||||
- assert syncService != null;
|
||||
- mContextReporter = AppHooks.get().createGsaHelper().getContextReporter(this);
|
||||
-
|
||||
- if (mSyncStateChangedListener != null) {
|
||||
- syncService.removeSyncStateChangedListener(mSyncStateChangedListener);
|
||||
- mSyncStateChangedListener = null;
|
||||
- }
|
||||
-
|
||||
- return;
|
||||
- } else {
|
||||
- ContextReporter.reportSyncStatus(syncService);
|
||||
- }
|
||||
-
|
||||
- if (mSyncStateChangedListener == null && syncService != null) {
|
||||
- mSyncStateChangedListener = () -> createContextReporterIfNeeded();
|
||||
- syncService.addSyncStateChangedListener(mSyncStateChangedListener);
|
||||
- }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -995,13 +968,6 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
|
||||
if (GSAState.getInstance(this).isGsaAvailable() && !SysUtils.isLowEndDevice()) {
|
||||
GSAAccountChangeListener.getInstance().disconnect();
|
||||
}
|
||||
- if (mSyncStateChangedListener != null) {
|
||||
- ProfileSyncService syncService = ProfileSyncService.get();
|
||||
- if (syncService != null) {
|
||||
- syncService.removeSyncStateChangedListener(mSyncStateChangedListener);
|
||||
- }
|
||||
- mSyncStateChangedListener = null;
|
||||
- }
|
||||
if (mContextReporter != null) mContextReporter.disable();
|
||||
|
||||
super.onStopWithNative();
|
||||
diff --git a/components/invalidation/impl/invalidation_service_util.cc b/components/invalidation/impl/invalidation_service_util.cc
|
||||
--- a/components/invalidation/impl/invalidation_service_util.cc
|
||||
+++ b/components/invalidation/impl/invalidation_service_util.cc
|
||||
@@ -12,27 +12,6 @@
|
||||
|
||||
namespace invalidation {
|
||||
|
||||
-notifier::NotifierOptions ParseNotifierOptions(
|
||||
- const base::CommandLine& command_line) {
|
||||
- notifier::NotifierOptions notifier_options;
|
||||
-
|
||||
- if (command_line.HasSwitch(switches::kSyncNotificationHostPort)) {
|
||||
- notifier_options.xmpp_host_port =
|
||||
- net::HostPortPair::FromString(
|
||||
- command_line.GetSwitchValueASCII(
|
||||
- switches::kSyncNotificationHostPort));
|
||||
- DVLOG(1) << "Using " << notifier_options.xmpp_host_port.ToString()
|
||||
- << " for test sync notification server.";
|
||||
- }
|
||||
-
|
||||
- notifier_options.allow_insecure_connection =
|
||||
- command_line.HasSwitch(switches::kSyncAllowInsecureXmppConnection);
|
||||
- DVLOG_IF(1, notifier_options.allow_insecure_connection)
|
||||
- << "Allowing insecure XMPP connections.";
|
||||
-
|
||||
- return notifier_options;
|
||||
-}
|
||||
-
|
||||
std::string GenerateInvalidatorClientId() {
|
||||
// Generate a GUID with 128 bits worth of base64-encoded randomness.
|
||||
// This format is similar to that of sync's cache_guid.
|
||||
diff --git a/components/invalidation/impl/invalidation_service_util.h b/components/invalidation/impl/invalidation_service_util.h
|
||||
--- a/components/invalidation/impl/invalidation_service_util.h
|
||||
+++ b/components/invalidation/impl/invalidation_service_util.h
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef COMPONENTS_INVALIDATION_IMPL_INVALIDATION_SERVICE_UTIL_H_
|
||||
#define COMPONENTS_INVALIDATION_IMPL_INVALIDATION_SERVICE_UTIL_H_
|
||||
|
||||
-#include "jingle/notifier/base/notifier_options.h"
|
||||
+#include <string>
|
||||
|
||||
namespace base {
|
||||
class CommandLine;
|
||||
@@ -13,10 +13,6 @@ class CommandLine;
|
||||
|
||||
namespace invalidation {
|
||||
|
||||
-// Parses the given command line for notifier options.
|
||||
-notifier::NotifierOptions ParseNotifierOptions(
|
||||
- const base::CommandLine& command_line);
|
||||
-
|
||||
// Generates a unique client ID for the invalidator.
|
||||
std::string GenerateInvalidatorClientId();
|
||||
|
||||
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
|
||||
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
|
||||
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
|
||||
@@ -167,16 +167,6 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
|
||||
|
||||
@Override
|
||||
public boolean hasFeatures(Account account, String[] features) {
|
||||
- if (!hasGetAccountsPermission()) {
|
||||
- return false;
|
||||
- }
|
||||
- try {
|
||||
- return mAccountManager.hasFeatures(account, features, null, null).getResult();
|
||||
- } catch (AuthenticatorException | IOException e) {
|
||||
- Log.e(TAG, "Error while checking features: ", e);
|
||||
- } catch (OperationCanceledException e) {
|
||||
- Log.e(TAG, "Checking features was cancelled. This should not happen.");
|
||||
- }
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -216,32 +206,10 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
|
||||
public void updateCredentials(
|
||||
Account account, Activity activity, final Callback<Boolean> callback) {
|
||||
ThreadUtils.assertOnUiThread();
|
||||
- if (!hasManageAccountsPermission()) {
|
||||
- if (callback != null) {
|
||||
- ThreadUtils.postOnUiThread(() -> callback.onResult(false));
|
||||
- }
|
||||
- return;
|
||||
+ if (callback != null) {
|
||||
+ ThreadUtils.postOnUiThread(() -> callback.onResult(false));
|
||||
}
|
||||
-
|
||||
- AccountManagerCallback<Bundle> realCallback = future -> {
|
||||
- Bundle bundle = null;
|
||||
- try {
|
||||
- bundle = future.getResult();
|
||||
- } catch (AuthenticatorException | IOException e) {
|
||||
- Log.e(TAG, "Error while update credentials: ", e);
|
||||
- } catch (OperationCanceledException e) {
|
||||
- Log.w(TAG, "Updating credentials was cancelled.");
|
||||
- }
|
||||
- boolean success =
|
||||
- bundle != null && bundle.getString(AccountManager.KEY_ACCOUNT_TYPE) != null;
|
||||
- if (callback != null) {
|
||||
- callback.onResult(success);
|
||||
- }
|
||||
- };
|
||||
- // Android 4.4 throws NullPointerException if null is passed
|
||||
- Bundle emptyOptions = new Bundle();
|
||||
- mAccountManager.updateCredentials(
|
||||
- account, "android", emptyOptions, activity, realCallback, null);
|
||||
+ return;
|
||||
}
|
||||
|
||||
protected boolean hasGetAccountsPermission() {
|
||||
diff --git a/components/sync/android/java/src/org/chromium/components/sync/AndroidSyncSettings.java b/components/sync/android/java/src/org/chromium/components/sync/AndroidSyncSettings.java
|
||||
--- a/components/sync/android/java/src/org/chromium/components/sync/AndroidSyncSettings.java
|
||||
+++ b/components/sync/android/java/src/org/chromium/components/sync/AndroidSyncSettings.java
|
||||
@@ -212,13 +212,7 @@ public class AndroidSyncSettings {
|
||||
|
||||
private void setChromeSyncEnabled(boolean value) {
|
||||
synchronized (mLock) {
|
||||
- updateSyncability(null);
|
||||
- if (value == mChromeSyncEnabled || mAccount == null) return;
|
||||
- mChromeSyncEnabled = value;
|
||||
-
|
||||
- StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
|
||||
- mSyncContentResolverDelegate.setSyncAutomatically(mAccount, mContractAuthority, value);
|
||||
- StrictMode.setThreadPolicy(oldPolicy);
|
||||
+ mChromeSyncEnabled = false;
|
||||
}
|
||||
notifyObservers();
|
||||
}
|
||||
@@ -299,19 +293,9 @@ public class AndroidSyncSettings {
|
||||
boolean oldChromeSyncEnabled = mChromeSyncEnabled;
|
||||
boolean oldMasterSyncEnabled = mMasterSyncEnabled;
|
||||
|
||||
- StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
|
||||
- if (mAccount != null) {
|
||||
- mIsSyncable =
|
||||
- mSyncContentResolverDelegate.getIsSyncable(mAccount, mContractAuthority)
|
||||
- == 1;
|
||||
- mChromeSyncEnabled = mSyncContentResolverDelegate.getSyncAutomatically(
|
||||
- mAccount, mContractAuthority);
|
||||
- } else {
|
||||
- mIsSyncable = false;
|
||||
- mChromeSyncEnabled = false;
|
||||
- }
|
||||
- mMasterSyncEnabled = mSyncContentResolverDelegate.getMasterSyncAutomatically();
|
||||
- StrictMode.setThreadPolicy(oldPolicy);
|
||||
+ mIsSyncable = false;
|
||||
+ mChromeSyncEnabled = false;
|
||||
+ mMasterSyncEnabled = false;
|
||||
|
||||
return oldChromeSyncEnabled != mChromeSyncEnabled
|
||||
|| oldMasterSyncEnabled != mMasterSyncEnabled;
|
||||
diff --git a/net/android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java b/net/android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java
|
||||
--- a/net/android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java
|
||||
+++ b/net/android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java
|
||||
@@ -96,50 +96,7 @@ public class HttpNegotiateAuthenticator {
|
||||
|
||||
@Override
|
||||
public void run(AccountManagerFuture<Account[]> future) {
|
||||
- Account[] accounts;
|
||||
- try {
|
||||
- accounts = future.getResult();
|
||||
- } catch (OperationCanceledException | AuthenticatorException | IOException e) {
|
||||
- Log.w(TAG, "ERR_UNEXPECTED: Error while attempting to retrieve accounts.", e);
|
||||
- nativeSetResult(mRequestData.nativeResultObject, NetError.ERR_UNEXPECTED, null);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (accounts.length == 0) {
|
||||
- Log.w(TAG, "ERR_MISSING_AUTH_CREDENTIALS: No account provided for the kerberos "
|
||||
- + "authentication. Please verify the configuration policies and "
|
||||
- + "that the CONTACTS runtime permission is granted. ");
|
||||
- nativeSetResult(mRequestData.nativeResultObject,
|
||||
- NetError.ERR_MISSING_AUTH_CREDENTIALS, null);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (accounts.length > 1) {
|
||||
- Log.w(TAG, "ERR_MISSING_AUTH_CREDENTIALS: Found %d accounts eligible for the "
|
||||
- + "kerberos authentication. Please fix the configuration by "
|
||||
- + "providing a single account.",
|
||||
- accounts.length);
|
||||
- nativeSetResult(mRequestData.nativeResultObject,
|
||||
- NetError.ERR_MISSING_AUTH_CREDENTIALS, null);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (lacksPermission(ContextUtils.getApplicationContext(),
|
||||
- "android.permission.USE_CREDENTIALS", true)) {
|
||||
- // Protecting the AccountManager#getAuthToken call.
|
||||
- // API < 23 Requires the USE_CREDENTIALS permission or throws an exception.
|
||||
- // API >= 23 USE_CREDENTIALS permission is removed
|
||||
- Log.e(TAG, "ERR_MISCONFIGURED_AUTH_ENVIRONMENT: USE_CREDENTIALS permission not "
|
||||
- + "granted. Aborting authentication.");
|
||||
- nativeSetResult(mRequestData.nativeResultObject,
|
||||
- NetError.ERR_MISCONFIGURED_AUTH_ENVIRONMENT, null);
|
||||
- return;
|
||||
- }
|
||||
- mRequestData.account = accounts[0];
|
||||
- mRequestData.accountManager.getAuthToken(mRequestData.account,
|
||||
- mRequestData.authTokenType, mRequestData.options, true /* notifyAuthFailure */,
|
||||
- new GetTokenCallback(mRequestData),
|
||||
- new Handler(ThreadUtils.getUiThreadLooper()));
|
||||
+ // account-based authentication removed for privacy-violations concerns
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,41 +109,7 @@ public class HttpNegotiateAuthenticator {
|
||||
|
||||
@Override
|
||||
public void run(AccountManagerFuture<Bundle> future) {
|
||||
- Bundle result;
|
||||
- try {
|
||||
- result = future.getResult();
|
||||
- } catch (OperationCanceledException | AuthenticatorException | IOException e) {
|
||||
- Log.w(TAG, "ERR_UNEXPECTED: Error while attempting to obtain a token.", e);
|
||||
- nativeSetResult(mRequestData.nativeResultObject, NetError.ERR_UNEXPECTED, null);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (result.containsKey(AccountManager.KEY_INTENT)) {
|
||||
- final Context appContext = ContextUtils.getApplicationContext();
|
||||
-
|
||||
- // We wait for a broadcast that should be sent once the user is done interacting
|
||||
- // with the notification
|
||||
- // TODO(dgn) We currently hang around if the notification is swiped away, until
|
||||
- // a LOGIN_ACCOUNTS_CHANGED_ACTION filter is received. It might be for something
|
||||
- // unrelated then we would wait again here. Maybe we should limit the number of
|
||||
- // retries in some way?
|
||||
- BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
|
||||
-
|
||||
- @Override
|
||||
- public void onReceive(Context context, Intent intent) {
|
||||
- appContext.unregisterReceiver(this);
|
||||
- mRequestData.accountManager.getAuthToken(mRequestData.account,
|
||||
- mRequestData.authTokenType, mRequestData.options,
|
||||
- true /* notifyAuthFailure */, new GetTokenCallback(mRequestData),
|
||||
- null);
|
||||
- }
|
||||
-
|
||||
- };
|
||||
- appContext.registerReceiver(broadcastReceiver,
|
||||
- new IntentFilter(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION));
|
||||
- } else {
|
||||
- processResult(result, mRequestData);
|
||||
- }
|
||||
+ // ditto
|
||||
}
|
||||
}
|
||||
|
||||
@@ -300,22 +223,7 @@ public class HttpNegotiateAuthenticator {
|
||||
*/
|
||||
private void requestTokenWithoutActivity(
|
||||
Context ctx, RequestData requestData, String[] features) {
|
||||
- if (lacksPermission(ctx, Manifest.permission.GET_ACCOUNTS, true /* onlyPreM */)) {
|
||||
- // Protecting the AccountManager#getAccountsByTypeAndFeatures call.
|
||||
- // API < 23 Requires the GET_ACCOUNTS permission or throws an exception.
|
||||
- // API >= 23 Requires the GET_ACCOUNTS permission (CONTACTS permission group) or
|
||||
- // returns only the accounts whose authenticator has a signature that
|
||||
- // matches our app. Working with this restriction and not requesting
|
||||
- // the permission is a valid use case in the context of WebView, so we
|
||||
- // don't require it on M+
|
||||
- Log.e(TAG, "ERR_MISCONFIGURED_AUTH_ENVIRONMENT: GET_ACCOUNTS permission not "
|
||||
- + "granted. Aborting authentication.");
|
||||
- nativeSetResult(requestData.nativeResultObject,
|
||||
- NetError.ERR_MISCONFIGURED_AUTH_ENVIRONMENT, null);
|
||||
- return;
|
||||
- }
|
||||
- requestData.accountManager.getAccountsByTypeAndFeatures(mAccountType, features,
|
||||
- new GetAccountsCallback(requestData), new Handler(ThreadUtils.getUiThreadLooper()));
|
||||
+ // ditto
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,29 +242,7 @@ public class HttpNegotiateAuthenticator {
|
||||
*/
|
||||
private void requestTokenWithActivity(
|
||||
Context ctx, Activity activity, RequestData requestData, String[] features) {
|
||||
- boolean isPreM = Build.VERSION.SDK_INT < Build.VERSION_CODES.M;
|
||||
- String permission = isPreM
|
||||
- ? "android.permission.MANAGE_ACCOUNTS"
|
||||
- : Manifest.permission.GET_ACCOUNTS;
|
||||
-
|
||||
- // Check if the AccountManager#getAuthTokenByFeatures call can be made.
|
||||
- // API < 23 Requires the MANAGE_ACCOUNTS permission.
|
||||
- // API >= 23 Requires the GET_ACCOUNTS permission to behave properly. When it's not granted,
|
||||
- // accounts not managed by the current application can't be retrieved. Depending
|
||||
- // on the authenticator implementation, it might prompt to create an account, but
|
||||
- // that won't be saved. This would be a bad user experience, so we also consider
|
||||
- // it a failure case.
|
||||
- if (lacksPermission(ctx, permission, isPreM)) {
|
||||
- Log.e(TAG, "ERR_MISCONFIGURED_AUTH_ENVIRONMENT: %s permission not granted. "
|
||||
- + "Aborting authentication", permission);
|
||||
- nativeSetResult(requestData.nativeResultObject,
|
||||
- NetError.ERR_MISCONFIGURED_AUTH_ENVIRONMENT, null);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- requestData.accountManager.getAuthTokenByFeatures(mAccountType, requestData.authTokenType,
|
||||
- features, activity, null, requestData.options, new GetTokenCallback(requestData),
|
||||
- new Handler(ThreadUtils.getUiThreadLooper()));
|
||||
+ // ditto
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/remoting/android/java/src/org/chromium/chromoting/base/OAuthTokenFetcher.java b/remoting/android/java/src/org/chromium/chromoting/base/OAuthTokenFetcher.java
|
||||
--- a/remoting/android/java/src/org/chromium/chromoting/base/OAuthTokenFetcher.java
|
||||
+++ b/remoting/android/java/src/org/chromium/chromoting/base/OAuthTokenFetcher.java
|
||||
@@ -92,7 +92,6 @@ public class OAuthTokenFetcher {
|
||||
|
||||
/** Begins fetching a token. Should be called on the main thread. */
|
||||
public void fetch() {
|
||||
- fetchImpl(null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +100,6 @@ public class OAuthTokenFetcher {
|
||||
* @param expiredToken A previously-fetched token which has expired.
|
||||
*/
|
||||
public void clearAndFetch(String expiredToken) {
|
||||
- fetchImpl(expiredToken);
|
||||
}
|
||||
|
||||
private void fetchImpl(final String expiredToken) {
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -63,7 +63,7 @@ diff --git a/chrome/browser/android/search_permissions/search_permissions_servic
|
|||
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
|
||||
--- a/chrome/common/chrome_features.cc
|
||||
+++ b/chrome/common/chrome_features.cc
|
||||
@@ -288,7 +288,7 @@ const base::FeatureParam<std::string> kDnsOverHttpsTemplatesParam{
|
||||
@@ -279,7 +279,7 @@ const base::FeatureParam<std::string> kDnsOverHttpsTemplatesParam{
|
||||
#if defined(OS_ANDROID)
|
||||
// Enable changing default downloads storage location on Android.
|
||||
const base::Feature kDownloadsLocationChange{"DownloadsLocationChange",
|
||||
|
|
|
@ -9,7 +9,7 @@ Subject: Enable changing default downloads storage location by default
|
|||
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
|
||||
--- a/chrome/common/chrome_features.cc
|
||||
+++ b/chrome/common/chrome_features.cc
|
||||
@@ -288,7 +288,7 @@ const base::FeatureParam<std::string> kDnsOverHttpsTemplatesParam{
|
||||
@@ -279,7 +279,7 @@ const base::FeatureParam<std::string> kDnsOverHttpsTemplatesParam{
|
||||
#if defined(OS_ANDROID)
|
||||
// Enable changing default downloads storage location on Android.
|
||||
const base::Feature kDownloadsLocationChange{"DownloadsLocationChange",
|
||||
|
|
|
@ -9,7 +9,7 @@ Subject: Enable site per process isolation for devices with enough memory
|
|||
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
|
||||
--- a/chrome/common/chrome_features.cc
|
||||
+++ b/chrome/common/chrome_features.cc
|
||||
@@ -617,11 +617,7 @@ const base::Feature kShowTrustedPublisherURL{"ShowTrustedPublisherURL",
|
||||
@@ -608,11 +608,7 @@ const base::Feature kShowTrustedPublisherURL{"ShowTrustedPublisherURL",
|
||||
// browser_features, as they are only used on the browser side.
|
||||
const base::Feature kSitePerProcess {
|
||||
"site-per-process",
|
||||
|
@ -21,7 +21,7 @@ diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc
|
|||
};
|
||||
|
||||
// Controls a mode for dynamically process-isolating sites where the user has
|
||||
@@ -643,7 +639,7 @@ const base::Feature kSiteIsolationForPasswordSites{
|
||||
@@ -634,7 +630,7 @@ const base::Feature kSiteIsolationForPasswordSites{
|
||||
// base::SysInfo::AmountOfPhysicalMemoryMB().
|
||||
const base::Feature kSitePerProcessOnlyForHighMemoryClients{
|
||||
"site-per-process-only-for-high-memory-clients",
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Sun, 27 Oct 2019 10:18:39 +0100
|
||||
Subject: Increase number of autocomplete matches from 5 to 10
|
||||
|
||||
Patch from https://github.com/Eloston/ungoogled-chromium/issues/814#issuecomment-526874703
|
||||
---
|
||||
components/omnibox/browser/autocomplete_result.cc | 7 ++-----
|
||||
components/omnibox/browser/omnibox_field_trial.cc | 3 ++-
|
||||
2 files changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/components/omnibox/browser/autocomplete_result.cc b/components/omnibox/browser/autocomplete_result.cc
|
||||
--- a/components/omnibox/browser/autocomplete_result.cc
|
||||
+++ b/components/omnibox/browser/autocomplete_result.cc
|
||||
@@ -48,17 +48,14 @@ struct MatchGURLHash {
|
||||
// static
|
||||
size_t AutocompleteResult::GetMaxMatches(bool is_zero_suggest) {
|
||||
#if (defined(OS_ANDROID))
|
||||
- constexpr size_t kDefaultMaxAutocompleteMatches = 5;
|
||||
+ constexpr size_t kDefaultMaxAutocompleteMatches = 10; // was 6, this needs to be double the value of default_max_matches_per_provider from components/omnibox/browser/omnibox_field_trial.cc
|
||||
if (is_zero_suggest)
|
||||
return kDefaultMaxAutocompleteMatches;
|
||||
#else
|
||||
constexpr size_t kDefaultMaxAutocompleteMatches = 6;
|
||||
#endif // defined(OS_ANDROID)
|
||||
|
||||
- return base::GetFieldTrialParamByFeatureAsInt(
|
||||
- omnibox::kUIExperimentMaxAutocompleteMatches,
|
||||
- OmniboxFieldTrial::kUIMaxAutocompleteMatchesParam,
|
||||
- kDefaultMaxAutocompleteMatches);
|
||||
+ return kDefaultMaxAutocompleteMatches;
|
||||
}
|
||||
|
||||
AutocompleteResult::AutocompleteResult() {
|
||||
diff --git a/components/omnibox/browser/omnibox_field_trial.cc b/components/omnibox/browser/omnibox_field_trial.cc
|
||||
--- a/components/omnibox/browser/omnibox_field_trial.cc
|
||||
+++ b/components/omnibox/browser/omnibox_field_trial.cc
|
||||
@@ -321,7 +321,8 @@ void OmniboxFieldTrial::GetDemotionsByType(
|
||||
|
||||
size_t OmniboxFieldTrial::GetProviderMaxMatches(
|
||||
AutocompleteProvider::Type provider) {
|
||||
- size_t default_max_matches_per_provider = 3;
|
||||
+ size_t default_max_matches_per_provider = 5; // was 3; this needs to be half the value of kDefaultMaxAutocompleteMatches from components/omnibox/browser/autocomplete_result.cc
|
||||
+ return default_max_matches_per_provider;
|
||||
|
||||
std::string param_value = base::GetFieldTrialParamValueByFeature(
|
||||
omnibox::kUIExperimentMaxAutocompleteMatches,
|
||||
--
|
||||
2.11.0
|
||||
|
File diff suppressed because one or more lines are too long
|
@ -36,7 +36,7 @@ diff --git a/chrome/browser/background/background_mode_manager.cc b/chrome/brows
|
|||
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
|
||||
--- a/chrome/browser/chrome_content_browser_client.cc
|
||||
+++ b/chrome/browser/chrome_content_browser_client.cc
|
||||
@@ -1149,7 +1149,7 @@ void ChromeContentBrowserClient::RegisterLocalStatePrefs(
|
||||
@@ -1150,7 +1150,7 @@ void ChromeContentBrowserClient::RegisterLocalStatePrefs(
|
||||
void ChromeContentBrowserClient::RegisterProfilePrefs(
|
||||
user_prefs::PrefRegistrySyncable* registry) {
|
||||
registry->RegisterBooleanPref(prefs::kDisable3DAPIs, false);
|
||||
|
|
|
@ -0,0 +1,732 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Fri, 30 Mar 2018 10:09:03 +0200
|
||||
Subject: Multiple fingerprinting mitigations for canvas, text and client
|
||||
rectangles
|
||||
|
||||
1. getClientRects, getBoundingClientRect, measureText: add fingerprinting mitigation
|
||||
|
||||
Scale the result of Range::getClientRects, Element::getBoundingClientRect and
|
||||
Canvas::measureText by a random +/-3/1000000th of the original value for each
|
||||
float in the returned Rect/Quad.
|
||||
|
||||
It contains improvements from ungoogled-chromium which add two flags:
|
||||
1. --fingerprinting-client-rects-noise to enable fingerprinting deception for Range::getClientRects and Element::getBoundingClientRect
|
||||
2. --fingerprinting-canvas-measuretext-noise to enable fingerprinting deception for Canvas::measureText
|
||||
|
||||
2. Canvas: fingerprinting mitigations for image data and webGL
|
||||
|
||||
Disable webGL renderer info and modify the color data returned by ToBlob,
|
||||
ToDataURL and getImageData so that it will contain randomly manipulated
|
||||
pixels (maximum 20) that slightly change the color of the R,G,B components
|
||||
without a visible effect.
|
||||
|
||||
Credits to Slaviro (https://github.com/Slaviro) for coming up with a better
|
||||
approach to change color components.
|
||||
|
||||
Added flag --fingerprinting-canvas-image-data-noise to disable Canvas image data fingerprinting deception
|
||||
---
|
||||
chrome/browser/BUILD.gn | 1 +
|
||||
chrome/browser/about_flags.cc | 13 ++
|
||||
content/browser/BUILD.gn | 1 +
|
||||
.../renderer_host/render_process_host_impl.cc | 4 +
|
||||
content/child/BUILD.gn | 1 +
|
||||
content/child/runtime_features.cc | 8 ++
|
||||
.../blink/public/platform/web_runtime_features.h | 3 +
|
||||
third_party/blink/renderer/core/dom/document.cc | 18 +++
|
||||
third_party/blink/renderer/core/dom/document.h | 7 +
|
||||
third_party/blink/renderer/core/dom/element.cc | 8 ++
|
||||
third_party/blink/renderer/core/dom/range.cc | 12 +-
|
||||
.../renderer/core/html/canvas/text_metrics.cc | 18 +++
|
||||
.../blink/renderer/core/html/canvas/text_metrics.h | 2 +
|
||||
.../canvas/canvas2d/canvas_rendering_context_2d.cc | 8 +-
|
||||
.../modules/webgl/webgl_debug_renderer_info.cc | 4 +-
|
||||
third_party/blink/renderer/platform/BUILD.gn | 5 +-
|
||||
.../platform/exported/web_runtime_features.cc | 12 ++
|
||||
.../platform/graphics/image_data_buffer.cc | 7 +
|
||||
.../platform/graphics/static_bitmap_image.cc | 159 +++++++++++++++++++++
|
||||
.../platform/graphics/static_bitmap_image.h | 2 +
|
||||
.../platform/runtime_enabled_features.json5 | 9 ++
|
||||
third_party/ungoogled/BUILD.gn | 10 ++
|
||||
third_party/ungoogled/ungoogled_switches.cc | 18 +++
|
||||
third_party/ungoogled/ungoogled_switches.h | 18 +++
|
||||
24 files changed, 343 insertions(+), 5 deletions(-)
|
||||
create mode 100644 third_party/ungoogled/BUILD.gn
|
||||
create mode 100644 third_party/ungoogled/ungoogled_switches.cc
|
||||
create mode 100644 third_party/ungoogled/ungoogled_switches.h
|
||||
|
||||
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
|
||||
--- a/chrome/browser/BUILD.gn
|
||||
+++ b/chrome/browser/BUILD.gn
|
||||
@@ -2200,6 +2200,7 @@ jumbo_split_static_library("browser") {
|
||||
"//third_party/metrics_proto",
|
||||
"//third_party/re2",
|
||||
"//third_party/smhasher:cityhash",
|
||||
+ "//third_party/ungoogled:switches",
|
||||
"//third_party/webrtc_overrides",
|
||||
"//third_party/webrtc_overrides:init_webrtc",
|
||||
"//third_party/widevine/cdm:buildflags",
|
||||
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||||
--- a/chrome/browser/about_flags.cc
|
||||
+++ b/chrome/browser/about_flags.cc
|
||||
@@ -147,6 +147,7 @@
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
#include "third_party/blink/public/common/forcedark/forcedark_switches.h"
|
||||
#include "third_party/leveldatabase/leveldb_features.h"
|
||||
+#include "third_party/ungoogled/ungoogled_switches.h"
|
||||
#include "ui/accessibility/accessibility_switches.h"
|
||||
#include "ui/base/ui_base_features.h"
|
||||
#include "ui/base/ui_base_switches.h"
|
||||
@@ -1405,12 +1406,24 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
{"enable-webrtc-srtp-aes-gcm", flag_descriptions::kWebrtcSrtpAesGcmName,
|
||||
flag_descriptions::kWebrtcSrtpAesGcmDescription, kOsAll,
|
||||
SINGLE_VALUE_TYPE(switches::kEnableWebRtcSrtpAesGcm)},
|
||||
+ {"fingerprinting-canvas-image-data-noise",
|
||||
+ "Disable Canvas image data fingerprint deception",
|
||||
+ "Slightly modifies at most 20 pixels in Canvas image data extracted via JS APIs",
|
||||
+ kOsAll, SINGLE_DISABLE_VALUE_TYPE(switches::kFingerprintingCanvasImageDataNoise)},
|
||||
{"enable-webrtc-stun-origin", flag_descriptions::kWebrtcStunOriginName,
|
||||
flag_descriptions::kWebrtcStunOriginDescription, kOsAll,
|
||||
SINGLE_VALUE_TYPE(switches::kEnableWebRtcStunOrigin)},
|
||||
{"enable-webrtc-hybrid-agc", flag_descriptions::kWebrtcHybridAgcName,
|
||||
flag_descriptions::kWebrtcHybridAgcDescription, kOsAll,
|
||||
FEATURE_VALUE_TYPE(features::kWebRtcHybridAgc)},
|
||||
+ {"fingerprinting-client-rects-noise",
|
||||
+ "Disable get*ClientRects() fingerprint deception",
|
||||
+ "Scale the output values of Range::getClientRects() and Element::getBoundingClientRect() with a randomly selected factor in the range -0.0003% to 0.0003%, which are recomputed on every document initialization.",
|
||||
+ kOsAll, SINGLE_DISABLE_VALUE_TYPE(switches::kFingerprintingClientRectsNoise)},
|
||||
+ {"fingerprinting-canvas-measuretext-noise",
|
||||
+ "Disable Canvas::measureText() fingerprint deception",
|
||||
+ "Scale the output values of Canvas::measureText() with a randomly selected factor in the range -0.0003% to 0.0003%, which are recomputed on every document initialization.",
|
||||
+ kOsAll, SINGLE_DISABLE_VALUE_TYPE(switches::kFingerprintingCanvasMeasureTextNoise)},
|
||||
{"enable-webrtc-new-encode-cpu-load-estimator",
|
||||
flag_descriptions::kWebrtcNewEncodeCpuLoadEstimatorName,
|
||||
flag_descriptions::kWebrtcNewEncodeCpuLoadEstimatorDescription, kOsAll,
|
||||
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
|
||||
--- a/content/browser/BUILD.gn
|
||||
+++ b/content/browser/BUILD.gn
|
||||
@@ -206,6 +206,7 @@ jumbo_source_set("browser") {
|
||||
"//third_party/libyuv",
|
||||
"//third_party/re2",
|
||||
"//third_party/sqlite",
|
||||
+ "//third_party/ungoogled:switches",
|
||||
"//third_party/webrtc/modules/desktop_capture:primitives",
|
||||
"//third_party/webrtc/rtc_base:rtc_base",
|
||||
"//third_party/zlib",
|
||||
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
--- a/content/browser/renderer_host/render_process_host_impl.cc
|
||||
+++ b/content/browser/renderer_host/render_process_host_impl.cc
|
||||
@@ -213,6 +213,7 @@
|
||||
#include "third_party/blink/public/common/page/launching_process_state.h"
|
||||
#include "third_party/blink/public/common/user_agent/user_agent_metadata.h"
|
||||
#include "third_party/blink/public/public_buildflags.h"
|
||||
+#include "third_party/ungoogled/ungoogled_switches.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
#include "ui/accessibility/accessibility_switches.h"
|
||||
#include "ui/base/ui_base_switches.h"
|
||||
@@ -2970,6 +2971,9 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
|
||||
switches::kEnableWebGLSwapChain,
|
||||
switches::kEnableWebVR,
|
||||
switches::kFileUrlPathAlias,
|
||||
+ switches::kFingerprintingClientRectsNoise,
|
||||
+ switches::kFingerprintingCanvasMeasureTextNoise,
|
||||
+ switches::kFingerprintingCanvasImageDataNoise,
|
||||
switches::kForceDisplayColorProfile,
|
||||
switches::kForceDeviceScaleFactor,
|
||||
switches::kForceGpuMemAvailableMb,
|
||||
diff --git a/content/child/BUILD.gn b/content/child/BUILD.gn
|
||||
--- a/content/child/BUILD.gn
|
||||
+++ b/content/child/BUILD.gn
|
||||
@@ -120,6 +120,7 @@ target(link_target_type, "child") {
|
||||
"//third_party/blink/public:scaled_resources",
|
||||
"//third_party/blink/public/common",
|
||||
"//third_party/ced",
|
||||
+ "//third_party/ungoogled:switches",
|
||||
"//third_party/zlib/google:compression_utils",
|
||||
"//ui/base",
|
||||
"//ui/events/blink",
|
||||
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc
|
||||
--- a/content/child/runtime_features.cc
|
||||
+++ b/content/child/runtime_features.cc
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "services/network/public/cpp/features.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
#include "third_party/blink/public/platform/web_runtime_features.h"
|
||||
+#include "third_party/ungoogled/ungoogled_switches.h"
|
||||
#include "ui/base/ui_base_features.h"
|
||||
#include "ui/events/blink/blink_features.h"
|
||||
#include "ui/gfx/switches.h"
|
||||
@@ -461,6 +462,13 @@ void SetIndividualRuntimeFeatures(
|
||||
WebRuntimeFeatures::EnableAllowSyncXHRInPageDismissal(true);
|
||||
}
|
||||
|
||||
+ WebRuntimeFeatures::EnableFingerprintingClientRectsNoise(
|
||||
+ !command_line.HasSwitch(switches::kFingerprintingClientRectsNoise));
|
||||
+ WebRuntimeFeatures::EnableFingerprintingCanvasMeasureTextNoise(
|
||||
+ !command_line.HasSwitch(switches::kFingerprintingCanvasMeasureTextNoise));
|
||||
+ WebRuntimeFeatures::EnableFingerprintingCanvasImageDataNoise(
|
||||
+ !command_line.HasSwitch(switches::kFingerprintingCanvasImageDataNoise));
|
||||
+
|
||||
WebRuntimeFeatures::EnableAutoplayIgnoresWebAudio(
|
||||
base::FeatureList::IsEnabled(media::kAutoplayIgnoreWebAudio));
|
||||
|
||||
diff --git a/third_party/blink/public/platform/web_runtime_features.h b/third_party/blink/public/platform/web_runtime_features.h
|
||||
--- a/third_party/blink/public/platform/web_runtime_features.h
|
||||
+++ b/third_party/blink/public/platform/web_runtime_features.h
|
||||
@@ -228,6 +228,9 @@ class WebRuntimeFeatures {
|
||||
BLINK_PLATFORM_EXPORT static void EnableMergeBlockingNonBlockingPools(bool);
|
||||
BLINK_PLATFORM_EXPORT static void EnableGetDisplayMedia(bool);
|
||||
BLINK_PLATFORM_EXPORT static void EnableAllowSyncXHRInPageDismissal(bool);
|
||||
+ BLINK_PLATFORM_EXPORT static void EnableFingerprintingClientRectsNoise(bool);
|
||||
+ BLINK_PLATFORM_EXPORT static void EnableFingerprintingCanvasMeasureTextNoise(bool);
|
||||
+ BLINK_PLATFORM_EXPORT static void EnableFingerprintingCanvasImageDataNoise(bool);
|
||||
BLINK_PLATFORM_EXPORT static void EnableShadowDOMV0(bool);
|
||||
BLINK_PLATFORM_EXPORT static void EnableCustomElementsV0(bool);
|
||||
BLINK_PLATFORM_EXPORT static void EnableHTMLImports(bool);
|
||||
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc
|
||||
--- a/third_party/blink/renderer/core/dom/document.cc
|
||||
+++ b/third_party/blink/renderer/core/dom/document.cc
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "base/auto_reset.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/optional.h"
|
||||
+#include "base/rand_util.h"
|
||||
#include "base/time/time.h"
|
||||
#include "cc/input/overscroll_behavior.h"
|
||||
#include "cc/input/scroll_snap_data.h"
|
||||
@@ -1199,6 +1200,15 @@ Document::Document(const DocumentInit& initializer,
|
||||
#ifndef NDEBUG
|
||||
liveDocumentSet().insert(this);
|
||||
#endif
|
||||
+
|
||||
+ if (RuntimeEnabledFeatures::FingerprintingClientRectsNoiseEnabled()) {
|
||||
+ // Precompute -0.0003% to 0.0003% noise factor for get*ClientRect*() fingerprinting
|
||||
+ noise_factor_x_ = 1 + (base::RandDouble() - 0.5) * 0.000003;
|
||||
+ noise_factor_y_ = 1 + (base::RandDouble() - 0.5) * 0.000003;
|
||||
+ } else {
|
||||
+ noise_factor_x_ = 1;
|
||||
+ noise_factor_y_ = 1;
|
||||
+ }
|
||||
}
|
||||
|
||||
Document::~Document() {
|
||||
@@ -1227,6 +1237,14 @@ Range* Document::CreateRangeAdjustedToTreeScope(const TreeScope& tree_scope,
|
||||
Position::BeforeNode(*shadow_host));
|
||||
}
|
||||
|
||||
+double Document::GetNoiseFactorX() {
|
||||
+ return noise_factor_x_;
|
||||
+}
|
||||
+
|
||||
+double Document::GetNoiseFactorY() {
|
||||
+ return noise_factor_y_;
|
||||
+}
|
||||
+
|
||||
SelectorQueryCache& Document::GetSelectorQueryCache() {
|
||||
if (!selector_query_cache_)
|
||||
selector_query_cache_ = std::make_unique<SelectorQueryCache>();
|
||||
diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h
|
||||
--- a/third_party/blink/renderer/core/dom/document.h
|
||||
+++ b/third_party/blink/renderer/core/dom/document.h
|
||||
@@ -408,6 +408,10 @@ class CORE_EXPORT Document : public ContainerNode,
|
||||
has_xml_declaration_ = has_xml_declaration ? 1 : 0;
|
||||
}
|
||||
|
||||
+ // Values for get*ClientRect fingerprint deception
|
||||
+ double GetNoiseFactorX();
|
||||
+ double GetNoiseFactorY();
|
||||
+
|
||||
String visibilityState() const;
|
||||
bool IsPageVisible() const;
|
||||
bool hidden() const;
|
||||
@@ -1905,6 +1909,9 @@ class CORE_EXPORT Document : public ContainerNode,
|
||||
|
||||
base::ElapsedTimer start_time_;
|
||||
|
||||
+ double noise_factor_x_;
|
||||
+ double noise_factor_y_;
|
||||
+
|
||||
Member<ScriptRunner> script_runner_;
|
||||
|
||||
HeapVector<Member<ScriptElementBase>> current_script_stack_;
|
||||
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc
|
||||
--- a/third_party/blink/renderer/core/dom/element.cc
|
||||
+++ b/third_party/blink/renderer/core/dom/element.cc
|
||||
@@ -1630,6 +1630,11 @@ DOMRectList* Element::getClientRects() {
|
||||
DCHECK(element_layout_object);
|
||||
GetDocument().AdjustFloatQuadsForScrollAndAbsoluteZoom(
|
||||
quads, *element_layout_object);
|
||||
+ if (RuntimeEnabledFeatures::FingerprintingClientRectsNoiseEnabled()) {
|
||||
+ for (FloatQuad& quad : quads) {
|
||||
+ quad.Scale(GetDocument().GetNoiseFactorX(), GetDocument().GetNoiseFactorY());
|
||||
+ }
|
||||
+ }
|
||||
return DOMRectList::Create(quads);
|
||||
}
|
||||
|
||||
@@ -1647,6 +1652,9 @@ DOMRect* Element::getBoundingClientRect() {
|
||||
DCHECK(element_layout_object);
|
||||
GetDocument().AdjustFloatRectForScrollAndAbsoluteZoom(result,
|
||||
*element_layout_object);
|
||||
+ if (RuntimeEnabledFeatures::FingerprintingClientRectsNoiseEnabled()) {
|
||||
+ result.Scale(GetDocument().GetNoiseFactorX(), GetDocument().GetNoiseFactorY());
|
||||
+ }
|
||||
return DOMRect::FromFloatRect(result);
|
||||
}
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/dom/range.cc b/third_party/blink/renderer/core/dom/range.cc
|
||||
--- a/third_party/blink/renderer/core/dom/range.cc
|
||||
+++ b/third_party/blink/renderer/core/dom/range.cc
|
||||
@@ -1631,11 +1631,21 @@ DOMRectList* Range::getClientRects() const {
|
||||
Vector<FloatQuad> quads;
|
||||
GetBorderAndTextQuads(quads);
|
||||
|
||||
+ if (RuntimeEnabledFeatures::FingerprintingClientRectsNoiseEnabled()) {
|
||||
+ for (FloatQuad& quad : quads) {
|
||||
+ quad.Scale(owner_document_->GetNoiseFactorX(), owner_document_->GetNoiseFactorY());
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return DOMRectList::Create(quads);
|
||||
}
|
||||
|
||||
DOMRect* Range::getBoundingClientRect() const {
|
||||
- return DOMRect::FromFloatRect(BoundingRect());
|
||||
+ auto rect = BoundingRect();
|
||||
+ if (RuntimeEnabledFeatures::FingerprintingClientRectsNoiseEnabled()) {
|
||||
+ rect.Scale(owner_document_->GetNoiseFactorX(), owner_document_->GetNoiseFactorY());
|
||||
+ }
|
||||
+ return DOMRect::FromFloatRect(rect);
|
||||
}
|
||||
|
||||
// TODO(editing-dev): We should make
|
||||
diff --git a/third_party/blink/renderer/core/html/canvas/text_metrics.cc b/third_party/blink/renderer/core/html/canvas/text_metrics.cc
|
||||
--- a/third_party/blink/renderer/core/html/canvas/text_metrics.cc
|
||||
+++ b/third_party/blink/renderer/core/html/canvas/text_metrics.cc
|
||||
@@ -54,6 +54,24 @@ TextMetrics::TextMetrics(const Font& font,
|
||||
Update(font, direction, baseline, align, text);
|
||||
}
|
||||
|
||||
+void TextMetrics::Shuffle(const double factor) {
|
||||
+ // x-direction
|
||||
+ width_ *= factor;
|
||||
+ actual_bounding_box_left_ *= factor;
|
||||
+ actual_bounding_box_right_ *= factor;
|
||||
+
|
||||
+ // y-direction
|
||||
+ font_bounding_box_ascent_ *= factor;
|
||||
+ font_bounding_box_descent_ *= factor;
|
||||
+ actual_bounding_box_ascent_ *= factor;
|
||||
+ actual_bounding_box_descent_ *= factor;
|
||||
+ em_height_ascent_ *= factor;
|
||||
+ em_height_descent_ *= factor;
|
||||
+ baselines_->setAlphabetic(baselines_->alphabetic() * factor);
|
||||
+ baselines_->setHanging(baselines_->hanging() * factor);
|
||||
+ baselines_->setIdeographic(baselines_->ideographic() * factor);
|
||||
+}
|
||||
+
|
||||
void TextMetrics::Update(const Font& font,
|
||||
const TextDirection& direction,
|
||||
const TextBaseline& baseline,
|
||||
diff --git a/third_party/blink/renderer/core/html/canvas/text_metrics.h b/third_party/blink/renderer/core/html/canvas/text_metrics.h
|
||||
--- a/third_party/blink/renderer/core/html/canvas/text_metrics.h
|
||||
+++ b/third_party/blink/renderer/core/html/canvas/text_metrics.h
|
||||
@@ -64,6 +64,8 @@ class CORE_EXPORT TextMetrics final : public ScriptWrappable {
|
||||
|
||||
void Trace(Visitor*) override;
|
||||
|
||||
+ void Shuffle(const double factor);
|
||||
+
|
||||
private:
|
||||
void Update(const Font&,
|
||||
const TextDirection&,
|
||||
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc
|
||||
--- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc
|
||||
+++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc
|
||||
@@ -811,9 +811,15 @@ TextMetrics* CanvasRenderingContext2D::measureText(const String& text) {
|
||||
else
|
||||
direction = ToTextDirection(GetState().GetDirection(), canvas());
|
||||
|
||||
- return MakeGarbageCollected<TextMetrics>(font, direction,
|
||||
+ TextMetrics* text_metrics = MakeGarbageCollected<TextMetrics>(font, direction,
|
||||
GetState().GetTextBaseline(),
|
||||
GetState().GetTextAlign(), text);
|
||||
+
|
||||
+ // Scale text metrics if enabled
|
||||
+ if (RuntimeEnabledFeatures::FingerprintingCanvasMeasureTextNoiseEnabled()) {
|
||||
+ text_metrics->Shuffle(canvas()->GetDocument().GetNoiseFactorX());
|
||||
+ }
|
||||
+ return text_metrics;
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::DrawTextInternal(
|
||||
diff --git a/third_party/blink/renderer/modules/webgl/webgl_debug_renderer_info.cc b/third_party/blink/renderer/modules/webgl/webgl_debug_renderer_info.cc
|
||||
--- a/third_party/blink/renderer/modules/webgl/webgl_debug_renderer_info.cc
|
||||
+++ b/third_party/blink/renderer/modules/webgl/webgl_debug_renderer_info.cc
|
||||
@@ -37,11 +37,11 @@ WebGLExtensionName WebGLDebugRendererInfo::GetName() const {
|
||||
|
||||
WebGLDebugRendererInfo* WebGLDebugRendererInfo::Create(
|
||||
WebGLRenderingContextBase* context) {
|
||||
- return MakeGarbageCollected<WebGLDebugRendererInfo>(context);
|
||||
+ return nullptr;
|
||||
}
|
||||
|
||||
bool WebGLDebugRendererInfo::Supported(WebGLRenderingContextBase*) {
|
||||
- return true;
|
||||
+ return false;
|
||||
}
|
||||
|
||||
const char* WebGLDebugRendererInfo::ExtensionName() {
|
||||
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn
|
||||
--- a/third_party/blink/renderer/platform/BUILD.gn
|
||||
+++ b/third_party/blink/renderer/platform/BUILD.gn
|
||||
@@ -1417,7 +1417,9 @@ jumbo_component("platform") {
|
||||
"//third_party/blink/renderer:non_test_config",
|
||||
]
|
||||
|
||||
- include_dirs = []
|
||||
+ include_dirs = [
|
||||
+ "//third_party/skia/include/private", # For shuffler in graphics/static_bitmap_image.cc
|
||||
+ ]
|
||||
|
||||
public_deps = [
|
||||
":blink_platform_public_deps",
|
||||
@@ -1450,6 +1452,7 @@ jumbo_component("platform") {
|
||||
"//third_party/ced",
|
||||
"//third_party/emoji-segmenter",
|
||||
"//third_party/icu",
|
||||
+ "//third_party/ungoogled:switches",
|
||||
"//third_party/webrtc/api:libjingle_logging_api",
|
||||
"//third_party/webrtc/api/audio_codecs/L16:audio_decoder_L16",
|
||||
"//third_party/webrtc/api/audio_codecs/L16:audio_encoder_L16",
|
||||
diff --git a/third_party/blink/renderer/platform/exported/web_runtime_features.cc b/third_party/blink/renderer/platform/exported/web_runtime_features.cc
|
||||
--- a/third_party/blink/renderer/platform/exported/web_runtime_features.cc
|
||||
+++ b/third_party/blink/renderer/platform/exported/web_runtime_features.cc
|
||||
@@ -722,4 +722,16 @@ void WebRuntimeFeatures::EnableAcceleratedSmallCanvases(bool enable) {
|
||||
RuntimeEnabledFeatures::SetAcceleratedSmallCanvasesEnabled(enable);
|
||||
}
|
||||
|
||||
+void WebRuntimeFeatures::EnableFingerprintingClientRectsNoise(bool enable) {
|
||||
+ RuntimeEnabledFeatures::SetFingerprintingClientRectsNoiseEnabled(enable);
|
||||
+}
|
||||
+
|
||||
+void WebRuntimeFeatures::EnableFingerprintingCanvasMeasureTextNoise(bool enable) {
|
||||
+ RuntimeEnabledFeatures::SetFingerprintingCanvasMeasureTextNoiseEnabled(enable);
|
||||
+}
|
||||
+
|
||||
+void WebRuntimeFeatures::EnableFingerprintingCanvasImageDataNoise(bool enable) {
|
||||
+ RuntimeEnabledFeatures::SetFingerprintingCanvasImageDataNoiseEnabled(enable);
|
||||
+}
|
||||
+
|
||||
} // namespace blink
|
||||
diff --git a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc b/third_party/blink/renderer/platform/graphics/image_data_buffer.cc
|
||||
--- a/third_party/blink/renderer/platform/graphics/image_data_buffer.cc
|
||||
+++ b/third_party/blink/renderer/platform/graphics/image_data_buffer.cc
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <memory>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
+#include "base/rand_util.h"
|
||||
+#include "base/logging.h"
|
||||
#include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h"
|
||||
#include "third_party/blink/renderer/platform/image-encoders/image_encoder.h"
|
||||
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
|
||||
@@ -127,6 +129,11 @@ bool ImageDataBuffer::EncodeImageInternal(const ImageEncodingMimeType mime_type,
|
||||
const SkPixmap& pixmap) const {
|
||||
DCHECK(is_valid_);
|
||||
|
||||
+ if (RuntimeEnabledFeatures::FingerprintingCanvasImageDataNoiseEnabled()) {
|
||||
+ // shuffle subchannel color data within the pixmap
|
||||
+ StaticBitmapImage::ShuffleSubchannelColorData(pixmap_.writable_addr(), pixmap_.info(), 0, 0);
|
||||
+ }
|
||||
+
|
||||
if (mime_type == kMimeTypeJpeg) {
|
||||
SkJpegEncoder::Options options;
|
||||
options.fQuality = ImageEncoder::ComputeJpegQuality(quality);
|
||||
diff --git a/third_party/blink/renderer/platform/graphics/static_bitmap_image.cc b/third_party/blink/renderer/platform/graphics/static_bitmap_image.cc
|
||||
--- a/third_party/blink/renderer/platform/graphics/static_bitmap_image.cc
|
||||
+++ b/third_party/blink/renderer/platform/graphics/static_bitmap_image.cc
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h"
|
||||
|
||||
+#include "base/rand_util.h"
|
||||
+#include "base/logging.h"
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "gpu/command_buffer/client/gles2_interface.h"
|
||||
#include "third_party/blink/renderer/platform/graphics/accelerated_static_bitmap_image.h"
|
||||
@@ -11,12 +13,14 @@
|
||||
#include "third_party/blink/renderer/platform/graphics/image_observer.h"
|
||||
#include "third_party/blink/renderer/platform/graphics/paint/paint_image.h"
|
||||
#include "third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.h"
|
||||
+#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
|
||||
#include "third_party/blink/renderer/platform/wtf/typed_arrays/array_buffer_contents.h"
|
||||
#include "third_party/skia/include/core/SkCanvas.h"
|
||||
#include "third_party/skia/include/core/SkImage.h"
|
||||
#include "third_party/skia/include/core/SkPaint.h"
|
||||
#include "third_party/skia/include/core/SkSurface.h"
|
||||
#include "third_party/skia/include/gpu/GrContext.h"
|
||||
+#include "third_party/skia/include/private/SkColorData.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
namespace blink {
|
||||
@@ -154,10 +158,165 @@ bool StaticBitmapImage::ConvertToArrayBufferContents(
|
||||
DCHECK(read_pixels_successful ||
|
||||
!sk_image->bounds().intersect(SkIRect::MakeXYWH(
|
||||
rect.X(), rect.Y(), info.width(), info.height())));
|
||||
+
|
||||
+ if (RuntimeEnabledFeatures::FingerprintingCanvasImageDataNoiseEnabled()) {
|
||||
+ ShuffleSubchannelColorData(result.Data(), info, rect.X(), rect.Y());
|
||||
+ }
|
||||
+
|
||||
result.Transfer(dest_contents);
|
||||
return true;
|
||||
}
|
||||
|
||||
+// set the component to maximum-delta if it is >= maximum, or add to existing color component (color + delta)
|
||||
+#define shuffleComponent(color, max, delta) ( (color) >= (max) ? ((max)-(delta)) : ((color)+(delta)) )
|
||||
+
|
||||
+#define writable_addr(T, p, stride, x, y) (T*)((const char *)p + y * stride + x * sizeof(T))
|
||||
+
|
||||
+void StaticBitmapImage::ShuffleSubchannelColorData(const void *addr, const SkImageInfo& info, int srcX, int srcY) {
|
||||
+ auto w = info.width() - srcX, h = info.height() - srcY;
|
||||
+
|
||||
+ // skip tiny images; info.width()/height() can also be 0
|
||||
+ if ((w < 8) || (h < 8)) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // generate the first random number here
|
||||
+ double shuffleX = base::RandDouble();
|
||||
+
|
||||
+ // cap maximum pixels to change
|
||||
+ auto pixels = (w + h) / 128;
|
||||
+ if (pixels > 20) {
|
||||
+ pixels = 20;
|
||||
+ } else if (pixels < 2) {
|
||||
+ pixels = 2;
|
||||
+ }
|
||||
+
|
||||
+ auto colorType = info.colorType();
|
||||
+ auto fRowBytes = info.minRowBytes(); // stride
|
||||
+
|
||||
+ DLOG(INFO) << "BRM: ShuffleSubchannelColorData() w=" << w << " h=" << h << " colorType=" << colorType << " fRowBytes=" << fRowBytes;
|
||||
+
|
||||
+ // second random number (for y/height)
|
||||
+ double shuffleY = base::RandDouble();
|
||||
+
|
||||
+ // calculate random coordinates using bisection
|
||||
+ auto currentW = w, currentH = h;
|
||||
+ for(;pixels >= 0; pixels--) {
|
||||
+ int x = currentW * shuffleX, y = currentH * shuffleY;
|
||||
+
|
||||
+ // calculate randomisation amounts for each RGB component
|
||||
+ uint8_t shuffleR = base::RandInt(0, 4);
|
||||
+ uint8_t shuffleG = (shuffleR + x) % 4;
|
||||
+ uint8_t shuffleB = (shuffleG + y) % 4;
|
||||
+
|
||||
+ // manipulate pixel data to slightly change the R, G, B components
|
||||
+ switch (colorType) {
|
||||
+ case kAlpha_8_SkColorType:
|
||||
+ {
|
||||
+ auto *pixel = writable_addr(uint8_t, addr, fRowBytes, x, y);
|
||||
+ auto r = SkColorGetR(*pixel), g = SkColorGetG(*pixel), b = SkColorGetB(*pixel), a = SkColorGetA(*pixel);
|
||||
+
|
||||
+ r = shuffleComponent(r, UINT8_MAX-1, shuffleR);
|
||||
+ g = shuffleComponent(g, UINT8_MAX-1, shuffleG);
|
||||
+ b = shuffleComponent(b, UINT8_MAX-1, shuffleB);
|
||||
+ // alpha is left unchanged
|
||||
+
|
||||
+ *pixel = SkColorSetARGB(a, r, g, b);
|
||||
+ }
|
||||
+ break;
|
||||
+ case kGray_8_SkColorType:
|
||||
+ {
|
||||
+ auto *pixel = writable_addr(uint8_t, addr, fRowBytes, x, y);
|
||||
+ *pixel = shuffleComponent(*pixel, UINT8_MAX-1, shuffleB);
|
||||
+ }
|
||||
+ break;
|
||||
+ case kRGB_565_SkColorType:
|
||||
+ {
|
||||
+ auto *pixel = writable_addr(uint16_t, addr, fRowBytes, x, y);
|
||||
+ unsigned r = SkPacked16ToR32(*pixel);
|
||||
+ unsigned g = SkPacked16ToG32(*pixel);
|
||||
+ unsigned b = SkPacked16ToB32(*pixel);
|
||||
+
|
||||
+ r = shuffleComponent(r, 31, shuffleR);
|
||||
+ g = shuffleComponent(g, 63, shuffleG);
|
||||
+ b = shuffleComponent(b, 31, shuffleB);
|
||||
+
|
||||
+ unsigned r16 = (r & SK_R16_MASK) << SK_R16_SHIFT;
|
||||
+ unsigned g16 = (g & SK_G16_MASK) << SK_G16_SHIFT;
|
||||
+ unsigned b16 = (b & SK_B16_MASK) << SK_B16_SHIFT;
|
||||
+
|
||||
+ *pixel = r16 | g16 | b16;
|
||||
+ }
|
||||
+ break;
|
||||
+ case kARGB_4444_SkColorType:
|
||||
+ {
|
||||
+ auto *pixel = writable_addr(uint16_t, addr, fRowBytes, x, y);
|
||||
+ auto a = SkGetPackedA4444(*pixel), r = SkGetPackedR4444(*pixel), g = SkGetPackedG4444(*pixel), b = SkGetPackedB4444(*pixel);
|
||||
+
|
||||
+ r = shuffleComponent(r, 15, shuffleR);
|
||||
+ g = shuffleComponent(g, 15, shuffleG);
|
||||
+ b = shuffleComponent(b, 15, shuffleB);
|
||||
+ // alpha is left unchanged
|
||||
+
|
||||
+ unsigned a4 = (a & 0xF) << SK_A4444_SHIFT;
|
||||
+ unsigned r4 = (r & 0xF) << SK_R4444_SHIFT;
|
||||
+ unsigned g4 = (g & 0xF) << SK_G4444_SHIFT;
|
||||
+ unsigned b4 = (b & 0xF) << SK_B4444_SHIFT;
|
||||
+
|
||||
+ *pixel = r4 | b4 | g4 | a4;
|
||||
+ }
|
||||
+ break;
|
||||
+ case kRGBA_8888_SkColorType:
|
||||
+ {
|
||||
+ auto *pixel = writable_addr(uint32_t, addr, fRowBytes, x, y);
|
||||
+ auto a = SkGetPackedA32(*pixel), r = SkGetPackedR32(*pixel), g = SkGetPackedG32(*pixel), b = SkGetPackedB32(*pixel);
|
||||
+
|
||||
+ r = shuffleComponent(r, UINT8_MAX-1, shuffleR);
|
||||
+ g = shuffleComponent(g, UINT8_MAX-1, shuffleG);
|
||||
+ b = shuffleComponent(b, UINT8_MAX-1, shuffleB);
|
||||
+ // alpha is left unchanged
|
||||
+
|
||||
+ *pixel = (a << SK_A32_SHIFT) | (r << SK_R32_SHIFT) |
|
||||
+ (g << SK_G32_SHIFT) | (b << SK_B32_SHIFT);
|
||||
+ }
|
||||
+ break;
|
||||
+ case kBGRA_8888_SkColorType:
|
||||
+ {
|
||||
+ auto *pixel = writable_addr(uint32_t, addr, fRowBytes, x, y);
|
||||
+ auto a = SkGetPackedA32(*pixel), b = SkGetPackedR32(*pixel), g = SkGetPackedG32(*pixel), r = SkGetPackedB32(*pixel);
|
||||
+
|
||||
+ r = shuffleComponent(r, UINT8_MAX-1, shuffleR);
|
||||
+ g = shuffleComponent(g, UINT8_MAX-1, shuffleG);
|
||||
+ b = shuffleComponent(b, UINT8_MAX-1, shuffleB);
|
||||
+ // alpha is left unchanged
|
||||
+
|
||||
+ *pixel = (a << SK_BGRA_A32_SHIFT) | (r << SK_BGRA_R32_SHIFT) |
|
||||
+ (g << SK_BGRA_G32_SHIFT) | (b << SK_BGRA_B32_SHIFT);
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ // the remaining formats are not expected to be used in Chromium
|
||||
+ LOG(WARNING) << "BRM: ShuffleSubchannelColorData(): Ignoring pixel format";
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // keep bisecting or reset current width/height as needed
|
||||
+ if (x == 0) {
|
||||
+ currentW = w;
|
||||
+ } else {
|
||||
+ currentW = x;
|
||||
+ }
|
||||
+ if (y == 0) {
|
||||
+ currentH = h;
|
||||
+ } else {
|
||||
+ currentH = y;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#undef writable_addr
|
||||
+#undef shuffleComponent
|
||||
+
|
||||
const gpu::SyncToken& StaticBitmapImage::GetSyncToken() const {
|
||||
static const gpu::SyncToken sync_token;
|
||||
return sync_token;
|
||||
diff --git a/third_party/blink/renderer/platform/graphics/static_bitmap_image.h b/third_party/blink/renderer/platform/graphics/static_bitmap_image.h
|
||||
--- a/third_party/blink/renderer/platform/graphics/static_bitmap_image.h
|
||||
+++ b/third_party/blink/renderer/platform/graphics/static_bitmap_image.h
|
||||
@@ -46,6 +46,8 @@ class PLATFORM_EXPORT StaticBitmapImage : public Image {
|
||||
static scoped_refptr<StaticBitmapImage> Create(WTF::ArrayBufferContents&,
|
||||
const SkImageInfo&);
|
||||
|
||||
+ static void ShuffleSubchannelColorData(const void *addr, const SkImageInfo& info, int srcX, int srcY);
|
||||
+
|
||||
bool IsStaticBitmapImage() const override { return true; }
|
||||
|
||||
// Methods overridden by all sub-classes
|
||||
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
--- a/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
+++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
@@ -677,6 +677,15 @@
|
||||
name: "FileSystem",
|
||||
status: "stable",
|
||||
},
|
||||
+ {
|
||||
+ name: "FingerprintingClientRectsNoise",
|
||||
+ },
|
||||
+ {
|
||||
+ name: "FingerprintingCanvasMeasureTextNoise",
|
||||
+ },
|
||||
+ {
|
||||
+ name: "FingerprintingCanvasImageDataNoise",
|
||||
+ },
|
||||
// FirstContentfulPaintPlusPlus enables the Largest Text Paint metric, Last
|
||||
// Text Paint metric, Largest Image Paint metric and Last Image Paint
|
||||
// metric. See also: http://bit.ly/fcp_plus_plus
|
||||
diff --git a/third_party/ungoogled/BUILD.gn b/third_party/ungoogled/BUILD.gn
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/third_party/ungoogled/BUILD.gn
|
||||
@@ -0,0 +1,10 @@
|
||||
+# Copyright (c) 2018 The ungoogled-chromium Authors. All rights reserved.
|
||||
+# Use of this source code is governed by a BSD-style license that can be
|
||||
+# found in the LICENSE file.
|
||||
+
|
||||
+component("switches") {
|
||||
+ sources = [
|
||||
+ "ungoogled_switches.h",
|
||||
+ "ungoogled_switches.cc",
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/third_party/ungoogled/ungoogled_switches.cc b/third_party/ungoogled/ungoogled_switches.cc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/third_party/ungoogled/ungoogled_switches.cc
|
||||
@@ -0,0 +1,18 @@
|
||||
+// Copyright (c) 2018 The ungoogled-chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+#include "third_party/ungoogled/ungoogled_switches.h"
|
||||
+
|
||||
+namespace switches {
|
||||
+
|
||||
+// Enable fingerprinting deception for getClientRects and getBoundingClientRect
|
||||
+const char kFingerprintingClientRectsNoise[] = "fingerprinting-client-rects-noise";
|
||||
+
|
||||
+// Enable fingerprinting deception for measureText
|
||||
+const char kFingerprintingCanvasMeasureTextNoise[] = "fingerprinting-canvas-measuretext-noise";
|
||||
+
|
||||
+// Enable fingerprinting deception for Canvas image data
|
||||
+const char kFingerprintingCanvasImageDataNoise[] = "fingerprinting-canvas-image-data-noise";
|
||||
+
|
||||
+} // namespace switches
|
||||
diff --git a/third_party/ungoogled/ungoogled_switches.h b/third_party/ungoogled/ungoogled_switches.h
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/third_party/ungoogled/ungoogled_switches.h
|
||||
@@ -0,0 +1,18 @@
|
||||
+// Copyright (c) 2018 The ungoogled-chromium Authors. All rights reserved.
|
||||
+// Use of this source code is governed by a BSD-style license that can be
|
||||
+// found in the LICENSE file.
|
||||
+
|
||||
+// Defines all the fingerprinting command-line switches.
|
||||
+
|
||||
+#ifndef THIRD_PARTY_UNGOOGLED_FINGERPRINTING_SWITCHES_H_
|
||||
+#define THIRD_PARTY_UNGOOGLED_FINGERPRINTING_SWITCHES_H_
|
||||
+
|
||||
+namespace switches {
|
||||
+
|
||||
+extern const char kFingerprintingClientRectsNoise[];
|
||||
+extern const char kFingerprintingCanvasMeasureTextNoise[];
|
||||
+extern const char kFingerprintingCanvasImageDataNoise[];
|
||||
+
|
||||
+}
|
||||
+
|
||||
+#endif // THIRD_PARTY_UNGOOGLED_FINGERPRINTING_SWITCHES_H_
|
||||
--
|
||||
2.11.0
|
||||
|
104
build/patches/Remove-SMS-integration.patch
Normal file
104
build/patches/Remove-SMS-integration.patch
Normal file
|
@ -0,0 +1,104 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Sun, 3 Nov 2019 08:22:29 +0100
|
||||
Subject: Remove SMS integration
|
||||
|
||||
---
|
||||
content/public/android/BUILD.gn | 2 -
|
||||
.../org/chromium/content/browser/sms/Wrappers.java | 74 ----------------------
|
||||
2 files changed, 76 deletions(-)
|
||||
delete mode 100644 content/public/android/java/src/org/chromium/content/browser/sms/Wrappers.java
|
||||
|
||||
diff --git a/content/public/android/BUILD.gn b/content/public/android/BUILD.gn
|
||||
--- a/content/public/android/BUILD.gn
|
||||
+++ b/content/public/android/BUILD.gn
|
||||
@@ -231,8 +231,6 @@ android_library("content_java") {
|
||||
"java/src/org/chromium/content/browser/selection/SmartSelectionClient.java",
|
||||
"java/src/org/chromium/content/browser/selection/SmartSelectionMetricsLogger.java",
|
||||
"java/src/org/chromium/content/browser/selection/SmartSelectionProvider.java",
|
||||
- "java/src/org/chromium/content/browser/sms/SmsReceiver.java",
|
||||
- "java/src/org/chromium/content/browser/sms/Wrappers.java",
|
||||
"java/src/org/chromium/content/browser/webcontents/WebContentsImpl.java",
|
||||
"java/src/org/chromium/content/browser/webcontents/WebContentsObserverProxy.java",
|
||||
"java/src/org/chromium/content/common/ContentSwitchUtils.java",
|
||||
diff --git a/content/public/android/java/src/org/chromium/content/browser/sms/Wrappers.java b/content/public/android/java/src/org/chromium/content/browser/sms/Wrappers.java
|
||||
deleted file mode 100644
|
||||
--- a/content/public/android/java/src/org/chromium/content/browser/sms/Wrappers.java
|
||||
+++ /dev/null
|
||||
@@ -1,74 +0,0 @@
|
||||
-// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
-// Use of this source code is governed by a BSD-style license that can be
|
||||
-// found in the LICENSE file.
|
||||
-
|
||||
-package org.chromium.content.browser.sms;
|
||||
-
|
||||
-import android.content.BroadcastReceiver;
|
||||
-import android.content.Context;
|
||||
-import android.content.ContextWrapper;
|
||||
-import android.content.Intent;
|
||||
-import android.content.IntentFilter;
|
||||
-
|
||||
-import com.google.android.gms.auth.api.phone.SmsRetrieverClient;
|
||||
-import com.google.android.gms.tasks.Task;
|
||||
-
|
||||
-class Wrappers {
|
||||
- // Prevent instantiation.
|
||||
- private Wrappers() {}
|
||||
-
|
||||
- /**
|
||||
- * Wraps com.google.android.gms.auth.api.phone.SmsRetrieverClient.
|
||||
- */
|
||||
- static class SmsRetrieverClientWrapper {
|
||||
- private final SmsRetrieverClient mSmsRetrieverClient;
|
||||
- private SmsReceiverContext mContext;
|
||||
-
|
||||
- public SmsRetrieverClientWrapper(SmsRetrieverClient smsRetrieverClient) {
|
||||
- mSmsRetrieverClient = smsRetrieverClient;
|
||||
- }
|
||||
-
|
||||
- public void setContext(SmsReceiverContext context) {
|
||||
- mContext = context;
|
||||
- }
|
||||
-
|
||||
- public SmsReceiverContext getContext() {
|
||||
- return mContext;
|
||||
- }
|
||||
-
|
||||
- public Task<Void> startSmsRetriever() {
|
||||
- return mSmsRetrieverClient.startSmsRetriever();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Extends android.content.ContextWrapper to store and retrieve the
|
||||
- * registered BroadcastReceiver.
|
||||
- */
|
||||
- static class SmsReceiverContext extends ContextWrapper {
|
||||
- private BroadcastReceiver mReceiver;
|
||||
-
|
||||
- public SmsReceiverContext(Context context) {
|
||||
- super(context);
|
||||
- }
|
||||
-
|
||||
- public BroadcastReceiver getRegisteredReceiver() {
|
||||
- return mReceiver;
|
||||
- }
|
||||
-
|
||||
- // ---------------------------------------------------------------------
|
||||
- // Context overrides:
|
||||
-
|
||||
- @Override
|
||||
- public Intent registerReceiver(BroadcastReceiver receiver, IntentFilter filter) {
|
||||
- mReceiver = receiver;
|
||||
- return super.registerReceiver(receiver, filter);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void unregisterReceiver(BroadcastReceiver receiver) {
|
||||
- mReceiver = null;
|
||||
- super.unregisterReceiver(receiver);
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
--
|
||||
2.11.0
|
||||
|
132
build/patches/Remove-dependency-on-com.google.android.gcm.patch
Normal file
132
build/patches/Remove-dependency-on-com.google.android.gcm.patch
Normal file
|
@ -0,0 +1,132 @@
|
|||
From: Wengling Chen <feiyu2817@gmail.com>
|
||||
Date: Sat, 2 Nov 2019 09:29:52 +0100
|
||||
Subject: Remove dependency on com.google.android.gcm
|
||||
|
||||
---
|
||||
third_party/android_sdk/BUILD.gn | 3 --
|
||||
.../external/client/android2/AndroidManifest.xml | 35 ----------------------
|
||||
.../channel/AndroidMessageReceiverService.java | 17 -----------
|
||||
.../channel/AndroidMessageSenderService.java | 3 +-
|
||||
4 files changed, 1 insertion(+), 57 deletions(-)
|
||||
|
||||
diff --git a/third_party/android_sdk/BUILD.gn b/third_party/android_sdk/BUILD.gn
|
||||
--- a/third_party/android_sdk/BUILD.gn
|
||||
+++ b/third_party/android_sdk/BUILD.gn
|
||||
@@ -67,7 +67,4 @@ if (enable_java_templates) {
|
||||
testonly = true
|
||||
java_files = [ "//third_party/android_sdk/public/extras/chromium/support/src/org/chromium/android/support/PackageManagerWrapper.java" ]
|
||||
}
|
||||
- android_java_prebuilt("android_gcm_java") {
|
||||
- jar_path = "//third_party/android_sdk/public/extras/google/gcm/gcm-client/dist/gcm.jar"
|
||||
- }
|
||||
}
|
||||
diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifest.xml b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifest.xml
|
||||
--- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifest.xml
|
||||
+++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifest.xml
|
||||
@@ -4,10 +4,6 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.google.ipc.invalidation.client.android2">
|
||||
|
||||
- <!-- App receives GCM messages. -->
|
||||
- <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||
- <!-- GCM connects to Google Services. -->
|
||||
- <uses-permission android:name="android.permission.INTERNET" />
|
||||
<!-- Keeps the processor from sleeping when a message is received. -->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
@@ -16,40 +12,9 @@
|
||||
<service android:exported="false"
|
||||
android:name="com.google.ipc.invalidation.ticl.android2.TiclService"/>
|
||||
|
||||
- <!-- Ticl sender. -->
|
||||
- <service android:exported="false"
|
||||
- android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageSenderService"/>
|
||||
-
|
||||
<!-- Receiver for scheduler alarms. -->
|
||||
<receiver android:exported="false"
|
||||
android:name="com.google.ipc.invalidation.ticl.android2.AndroidInternalScheduler$AlarmReceiver"/>
|
||||
|
||||
- <!-- GCM Broadcast Receiver -->
|
||||
- <receiver android:exported="true"
|
||||
- android:name="com.google.ipc.invalidation.external.client.contrib.MultiplexingGcmListener$GCMReceiver"
|
||||
- android:permission="com.google.android.c2dm.permission.SEND">
|
||||
- <intent-filter>
|
||||
- <action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||
- <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
||||
- <category android:name="com.google.ipc.invalidation.ticl.android2" />
|
||||
- </intent-filter>
|
||||
- </receiver>
|
||||
-
|
||||
- <!-- GCM multiplexer -->
|
||||
- <service android:exported="false"
|
||||
- android:name="com.google.ipc.invalidation.external.client.contrib.MultiplexingGcmListener">
|
||||
- <meta-data android:name="sender_ids" android:value="ipc.invalidation@gmail.com"/>
|
||||
- </service>
|
||||
-
|
||||
- <!-- Invalidation service multiplexed GCM receiver -->
|
||||
- <service android:exported="false"
|
||||
- android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageReceiverService"
|
||||
- android:enabled="true"/>
|
||||
- <receiver android:exported="false"
|
||||
- android:name="com.google.ipc.invalidation.ticl.android2.channel.AndroidMessageReceiverService$Receiver">
|
||||
- <intent-filter>
|
||||
- <action android:name="com.google.ipc.invalidation.gcmmplex.EVENT" />
|
||||
- </intent-filter>
|
||||
- </receiver>
|
||||
</application>
|
||||
</manifest>
|
||||
diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageReceiverService.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageReceiverService.java
|
||||
--- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageReceiverService.java
|
||||
+++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageReceiverService.java
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.google.ipc.invalidation.ticl.android2.channel;
|
||||
|
||||
-import com.google.android.gcm.GCMRegistrar;
|
||||
import com.google.ipc.invalidation.external.client.SystemResources.Logger;
|
||||
import com.google.ipc.invalidation.external.client.android.service.AndroidLogger;
|
||||
import com.google.ipc.invalidation.external.client.contrib.MultiplexingGcmListener;
|
||||
@@ -126,20 +125,4 @@ public class AndroidMessageReceiverService extends MultiplexingGcmListener.Abstr
|
||||
// now, there is nothing to do.
|
||||
}
|
||||
|
||||
- /**
|
||||
- * Initializes GCM as a convenience method for tests. In production, applications should handle
|
||||
- * this.
|
||||
- */
|
||||
- public static void initializeGcmForTest(Context context, Logger logger, String senderId) {
|
||||
- // Initialize GCM.
|
||||
- GCMRegistrar.checkDevice(context);
|
||||
- GCMRegistrar.checkManifest(context);
|
||||
- String regId = GCMRegistrar.getRegistrationId(context);
|
||||
- if (regId.isEmpty()) {
|
||||
- logger.info("Not registered with GCM; registering");
|
||||
- GCMRegistrar.register(context, senderId);
|
||||
- } else {
|
||||
- logger.fine("Already registered with GCM: %s", regId);
|
||||
- }
|
||||
- }
|
||||
}
|
||||
diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageSenderService.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageSenderService.java
|
||||
--- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageSenderService.java
|
||||
+++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidMessageSenderService.java
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.google.ipc.invalidation.ticl.android2.channel;
|
||||
|
||||
-import com.google.android.gcm.GCMRegistrar;
|
||||
import com.google.ipc.invalidation.common.GcmSharedConstants;
|
||||
import com.google.ipc.invalidation.external.client.SystemResources.Logger;
|
||||
import com.google.ipc.invalidation.external.client.android.service.AndroidLogger;
|
||||
@@ -395,7 +394,7 @@ public class AndroidMessageSenderService extends IntentService {
|
||||
// No client key when using old style registration id.
|
||||
clientKey = "";
|
||||
try {
|
||||
- registrationId = GCMRegistrar.getRegistrationId(context);
|
||||
+ registrationId = null;
|
||||
} catch (RuntimeException exception) {
|
||||
// GCMRegistrar#getRegistrationId occasionally throws a runtime exception. Catching the
|
||||
// exception rather than crashing.
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
From: Wengling Chen <feiyu2817@gmail.com>
|
||||
Date: Sat, 2 Nov 2019 09:22:31 +0100
|
||||
Subject: Remove dependency on com.google.android.gms.auth
|
||||
|
||||
---
|
||||
chrome/android/BUILD.gn | 1 -
|
||||
components/signin/core/browser/android/BUILD.gn | 1 -
|
||||
.../components/signin/AccountIdProvider.java | 10 +----
|
||||
.../signin/SystemAccountManagerDelegate.java | 15 +-------
|
||||
content/public/android/BUILD.gn | 1 -
|
||||
content/test/BUILD.gn | 1 -
|
||||
third_party/android_deps/BUILD.gn | 44 ----------------------
|
||||
third_party/robolectric/BUILD.gn | 1 -
|
||||
8 files changed, 2 insertions(+), 72 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
|
||||
--- a/chrome/android/BUILD.gn
|
||||
+++ b/chrome/android/BUILD.gn
|
||||
@@ -267,7 +267,6 @@ android_library("chrome_java") {
|
||||
":thumbnail_cache_entry_proto_java",
|
||||
":update_proto_java",
|
||||
":usage_stats_proto_java",
|
||||
- "$google_play_services_package:google_play_services_auth_base_java",
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
"$google_play_services_package:google_play_services_cast_framework_java",
|
||||
diff --git a/components/signin/core/browser/android/BUILD.gn b/components/signin/core/browser/android/BUILD.gn
|
||||
--- a/components/signin/core/browser/android/BUILD.gn
|
||||
+++ b/components/signin/core/browser/android/BUILD.gn
|
||||
@@ -15,7 +15,6 @@ generate_jni("jni_headers") {
|
||||
|
||||
android_library("java") {
|
||||
deps = [
|
||||
- "$google_play_services_package:google_play_services_auth_base_java",
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
"//base:base_java",
|
||||
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountIdProvider.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountIdProvider.java
|
||||
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountIdProvider.java
|
||||
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountIdProvider.java
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
package org.chromium.components.signin;
|
||||
|
||||
-import com.google.android.gms.common.ConnectionResult;
|
||||
-import com.google.android.gms.common.GoogleApiAvailability;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.base.StrictModeContext;
|
||||
@@ -47,12 +44,7 @@ public class AccountIdProvider {
|
||||
* Google Play services is available.
|
||||
*/
|
||||
public boolean canBeUsed() {
|
||||
- // TODO(http://crbug.com/577190): Remove StrictMode override.
|
||||
- try (StrictModeContext ignored = StrictModeContext.allowDiskWrites()) {
|
||||
- int resultCode = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(
|
||||
- ContextUtils.getApplicationContext());
|
||||
- return resultCode == ConnectionResult.SUCCESS;
|
||||
- }
|
||||
+ return false;
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
|
||||
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
|
||||
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
|
||||
@@ -24,9 +24,6 @@ import android.os.PatternMatcher;
|
||||
import android.os.Process;
|
||||
import android.os.SystemClock;
|
||||
|
||||
-import com.google.android.gms.common.ConnectionResult;
|
||||
-import com.google.android.gms.common.GoogleApiAvailability;
|
||||
-
|
||||
import org.chromium.base.ApiCompatibilityUtils;
|
||||
import org.chromium.base.Callback;
|
||||
import org.chromium.base.ContextUtils;
|
||||
@@ -82,17 +79,7 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
|
||||
}
|
||||
|
||||
protected void checkCanUseGooglePlayServices() throws AccountManagerDelegateException {
|
||||
- Context context = ContextUtils.getApplicationContext();
|
||||
- final int resultCode =
|
||||
- GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
|
||||
- if (resultCode == ConnectionResult.SUCCESS) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- throw new GmsAvailabilityException(
|
||||
- String.format("Can't use Google Play Services: %s",
|
||||
- GoogleApiAvailability.getInstance().getErrorString(resultCode)),
|
||||
- resultCode);
|
||||
+ throw new GmsAvailabilityException("Can't use Google Play Services", 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/content/public/android/BUILD.gn b/content/public/android/BUILD.gn
|
||||
--- a/content/public/android/BUILD.gn
|
||||
+++ b/content/public/android/BUILD.gn
|
||||
@@ -52,7 +52,6 @@ action("generate_sandboxed_service_srcjar") {
|
||||
android_library("content_java") {
|
||||
deps = [
|
||||
":content_java_resources",
|
||||
- "$google_play_services_package:google_play_services_auth_api_phone_java",
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
"$google_play_services_package:google_play_services_tasks_java",
|
||||
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
|
||||
--- a/content/test/BUILD.gn
|
||||
+++ b/content/test/BUILD.gn
|
||||
@@ -2442,7 +2442,6 @@ if (is_android) {
|
||||
testonly = true
|
||||
java_files = content_java_sources_needing_jni
|
||||
deps = [
|
||||
- "$google_play_services_package:google_play_services_auth_api_phone_java",
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
"$google_play_services_package:google_play_services_tasks_java",
|
||||
diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn
|
||||
--- a/third_party/android_deps/BUILD.gn
|
||||
+++ b/third_party/android_deps/BUILD.gn
|
||||
@@ -772,50 +772,6 @@ android_aar_prebuilt("com_android_support_viewpager_java") {
|
||||
}
|
||||
|
||||
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_auth_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_auth/play-services-auth-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_auth/com_google_android_gms_play_services_auth.info"
|
||||
- deps = [
|
||||
- ":google_play_services_auth_api_phone_java",
|
||||
- ":google_play_services_auth_base_java",
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_tasks_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_auth_api_phone_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_auth_api_phone/play-services-auth-api-phone-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_auth_api_phone/com_google_android_gms_play_services_auth_api_phone.info"
|
||||
- deps = [
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_tasks_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_auth_base_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_auth_base/play-services-auth-base-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_auth_base/com_google_android_gms_play_services_auth_base.info"
|
||||
- deps = [
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_tasks_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
android_aar_prebuilt("google_play_services_base_java") {
|
||||
aar_path = "libs/com_google_android_gms_play_services_base/play-services-base-15.0.1.aar"
|
||||
info_path = "libs/com_google_android_gms_play_services_base/com_google_android_gms_play_services_base.info"
|
||||
diff --git a/third_party/robolectric/BUILD.gn b/third_party/robolectric/BUILD.gn
|
||||
--- a/third_party/robolectric/BUILD.gn
|
||||
+++ b/third_party/robolectric/BUILD.gn
|
||||
@@ -938,7 +938,6 @@ java_library("shadows_play_services_java") {
|
||||
":robolectric_shadowapi_java",
|
||||
":robolectric_utils_java",
|
||||
":shadows_core_java",
|
||||
- "$google_play_services_package:google_play_services_auth_base_java",
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
"//third_party/android_deps:android_support_v4_java",
|
||||
--
|
||||
2.11.0
|
||||
|
1523
build/patches/Remove-dependency-on-com.google.android.gms.cast.patch
Normal file
1523
build/patches/Remove-dependency-on-com.google.android.gms.cast.patch
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,798 @@
|
|||
From: Wengling Chen <feiyu2817@gmail.com>
|
||||
Date: Sat, 2 Nov 2019 08:58:19 +0100
|
||||
Subject: Remove dependency on
|
||||
com.google.android.gms.common/auth/signin/dynamic,
|
||||
com.google.android.gms.tasks
|
||||
|
||||
---
|
||||
chrome/android/BUILD.gn | 8 ---
|
||||
chrome/android/features/media_router/BUILD.gn | 2 -
|
||||
.../browser/media/router/ChromeMediaRouter.java | 7 +-
|
||||
chrome/android/java/AndroidManifest.xml | 9 ---
|
||||
.../src/org/chromium/chrome/browser/AppHooks.java | 14 +---
|
||||
.../chromium/chrome/browser/ChromeVersionInfo.java | 12 +---
|
||||
.../browser/component_updater/UpdateScheduler.java | 3 -
|
||||
.../browser/externalauth/ExternalAuthUtils.java | 14 ++--
|
||||
.../externalauth/UserRecoverableErrorHandler.java | 7 --
|
||||
.../browser/gcore/ChromeGoogleApiClientImpl.java | 25 +------
|
||||
.../browser/gcore/GoogleApiClientHelper.java | 82 +---------------------
|
||||
.../chrome/browser/omaha/UpdateStatusProvider.java | 10 +--
|
||||
.../browser/preferences/PreferencesLauncher.java | 5 +-
|
||||
chrome/test/android/BUILD.gn | 2 -
|
||||
components/background_task_scheduler/BUILD.gn | 10 ---
|
||||
components/signin/core/browser/android/BUILD.gn | 2 -
|
||||
.../signin/GmsAvailabilityException.java | 4 +-
|
||||
content/public/android/BUILD.gn | 3 -
|
||||
content/test/BUILD.gn | 3 -
|
||||
device/BUILD.gn | 2 -
|
||||
remoting/android/client_java_tmpl.gni | 3 -
|
||||
services/BUILD.gn | 4 --
|
||||
services/device/geolocation/BUILD.gn | 2 -
|
||||
services/shape_detection/BUILD.gn | 2 -
|
||||
third_party/android_deps/BUILD.gn | 38 ----------
|
||||
third_party/cacheinvalidation/BUILD.gn | 1 -
|
||||
third_party/robolectric/BUILD.gn | 2 -
|
||||
27 files changed, 16 insertions(+), 260 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
|
||||
--- a/chrome/android/BUILD.gn
|
||||
+++ b/chrome/android/BUILD.gn
|
||||
@@ -267,9 +267,6 @@ android_library("chrome_java") {
|
||||
":thumbnail_cache_entry_proto_java",
|
||||
":update_proto_java",
|
||||
":usage_stats_proto_java",
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//base:jni_java",
|
||||
"//chrome/android/features/keyboard_accessory:public_java",
|
||||
@@ -685,8 +682,6 @@ junit_binary("chrome_junit_tests") {
|
||||
":chrome_java",
|
||||
":chrome_junit_test_support",
|
||||
":partner_location_descriptor_proto_java",
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//base:base_junit_test_support",
|
||||
@@ -784,9 +779,6 @@ android_library("chrome_test_java") {
|
||||
":browser_java_test_support",
|
||||
":chrome_test_util_java",
|
||||
":partner_location_descriptor_proto_java",
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//base/test:test_support_java",
|
||||
diff --git a/chrome/android/features/media_router/BUILD.gn b/chrome/android/features/media_router/BUILD.gn
|
||||
--- a/chrome/android/features/media_router/BUILD.gn
|
||||
+++ b/chrome/android/features/media_router/BUILD.gn
|
||||
@@ -9,8 +9,6 @@ import("//chrome/common/features.gni")
|
||||
android_library("java") {
|
||||
deps = [
|
||||
":java_resources",
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
"//base:base_java",
|
||||
"//base:jni_java",
|
||||
"//chrome/android:chrome_java",
|
||||
diff --git a/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java b/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java
|
||||
--- a/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java
|
||||
+++ b/chrome/android/features/media_router/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java
|
||||
@@ -7,9 +7,6 @@ package org.chromium.chrome.browser.media.router;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.media.MediaRouter;
|
||||
|
||||
-import com.google.android.gms.common.ConnectionResult;
|
||||
-import com.google.android.gms.common.GoogleApiAvailability;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.base.StrictModeContext;
|
||||
@@ -43,9 +40,7 @@ public class ChromeMediaRouter implements MediaRouteManager {
|
||||
int googleApiAvailabilityResult =
|
||||
AppHooks.get().isGoogleApiAvailableWithMinApkVersion(
|
||||
MIN_GOOGLE_PLAY_SERVICES_APK_VERSION);
|
||||
- if (googleApiAvailabilityResult != ConnectionResult.SUCCESS) {
|
||||
- GoogleApiAvailability.getInstance().showErrorNotification(
|
||||
- ContextUtils.getApplicationContext(), googleApiAvailabilityResult);
|
||||
+ if (true) {
|
||||
return;
|
||||
}
|
||||
MediaRouteProvider cafProvider = CafMediaRouteProvider.create(manager);
|
||||
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
|
||||
--- a/chrome/android/java/AndroidManifest.xml
|
||||
+++ b/chrome/android/java/AndroidManifest.xml
|
||||
@@ -889,15 +889,6 @@ by a child template that "extends" this file.
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
- <!-- Activity for dispatching intents to Instant Apps. -->
|
||||
- <activity
|
||||
- android:name="org.chromium.chrome.browser.instantapps.AuthenticatedProxyActivity"
|
||||
- android:exported="false"
|
||||
- android:theme="@android:style/Theme.NoDisplay"
|
||||
- android:noHistory="true"
|
||||
- android:excludeFromRecents="true">
|
||||
- </activity>
|
||||
-
|
||||
<activity
|
||||
android:name="org.chromium.chrome.browser.vr.VrCancelAnimationActivity"
|
||||
android:exported="false"
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java b/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java
|
||||
@@ -15,9 +15,6 @@ import android.support.annotation.Nullable;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
|
||||
-import com.google.android.gms.common.ConnectionResult;
|
||||
-import com.google.android.gms.common.GoogleApiAvailability;
|
||||
-
|
||||
import org.chromium.base.Callback;
|
||||
import org.chromium.base.CommandLine;
|
||||
import org.chromium.base.ContextUtils;
|
||||
@@ -419,16 +416,7 @@ public abstract class AppHooks {
|
||||
* same as {@link GoogleApiAvailability#isGooglePlayServicesAvailable()}.
|
||||
*/
|
||||
public int isGoogleApiAvailableWithMinApkVersion(int minApkVersion) {
|
||||
- try {
|
||||
- PackageInfo gmsPackageInfo =
|
||||
- ContextUtils.getApplicationContext().getPackageManager().getPackageInfo(
|
||||
- GoogleApiAvailability.GOOGLE_PLAY_SERVICES_PACKAGE, /* flags= */ 0);
|
||||
- int apkVersion = gmsPackageInfo.versionCode;
|
||||
- if (apkVersion >= minApkVersion) return ConnectionResult.SUCCESS;
|
||||
- } catch (PackageManager.NameNotFoundException e) {
|
||||
- return ConnectionResult.SERVICE_MISSING;
|
||||
- }
|
||||
- return ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED;
|
||||
+ return 1; /* SERVICE_MISSING*/
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java
|
||||
@@ -7,8 +7,6 @@ package org.chromium.chrome.browser;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
-import com.google.android.gms.common.GoogleApiAvailability;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.annotations.CalledByNative;
|
||||
import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
|
||||
@@ -95,7 +93,7 @@ public class ChromeVersionInfo {
|
||||
public static String getGmsInfo() {
|
||||
Context context = ContextUtils.getApplicationContext();
|
||||
|
||||
- final long sdkVersion = GoogleApiAvailability.GOOGLE_PLAY_SERVICES_VERSION_CODE;
|
||||
+ final long sdkVersion = 12600000;
|
||||
final long installedGmsVersion = getPlayServicesApkVersionNumber(context);
|
||||
|
||||
final String accessType;
|
||||
@@ -112,12 +110,6 @@ public class ChromeVersionInfo {
|
||||
}
|
||||
|
||||
private static long getPlayServicesApkVersionNumber(Context context) {
|
||||
- try {
|
||||
- return context.getPackageManager()
|
||||
- .getPackageInfo(GoogleApiAvailability.GOOGLE_PLAY_SERVICES_PACKAGE, 0)
|
||||
- .versionCode;
|
||||
- } catch (PackageManager.NameNotFoundException e) {
|
||||
- return 0;
|
||||
- }
|
||||
+ return 0;
|
||||
}
|
||||
}
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/component_updater/UpdateScheduler.java b/chrome/android/java/src/org/chromium/chrome/browser/component_updater/UpdateScheduler.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/component_updater/UpdateScheduler.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/component_updater/UpdateScheduler.java
|
||||
@@ -6,9 +6,6 @@ package org.chromium.chrome.browser.component_updater;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
-import com.google.android.gms.common.ConnectionResult;
|
||||
-import com.google.android.gms.common.GoogleApiAvailability;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.annotations.CalledByNative;
|
||||
import org.chromium.base.annotations.JNINamespace;
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/externalauth/ExternalAuthUtils.java
|
||||
@@ -13,9 +13,6 @@ import android.os.Binder;
|
||||
import android.support.annotation.WorkerThread;
|
||||
import android.text.TextUtils;
|
||||
|
||||
-import com.google.android.gms.common.ConnectionResult;
|
||||
-import com.google.android.gms.common.GoogleApiAvailability;
|
||||
-
|
||||
import org.chromium.base.CommandLine;
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.Log;
|
||||
@@ -157,9 +154,7 @@ public class ExternalAuthUtils {
|
||||
* when it is updating.
|
||||
*/
|
||||
public boolean isGooglePlayServicesMissing(final Context context) {
|
||||
- final int resultCode = checkGooglePlayServicesAvailable(context);
|
||||
- return (resultCode == ConnectionResult.SERVICE_MISSING
|
||||
- || resultCode == ConnectionResult.SERVICE_INVALID);
|
||||
+ return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -181,7 +176,6 @@ public class ExternalAuthUtils {
|
||||
|
||||
Context context = ContextUtils.getApplicationContext();
|
||||
final int resultCode = checkGooglePlayServicesAvailable(context);
|
||||
- if (resultCode == ConnectionResult.SUCCESS) return true;
|
||||
// resultCode is some kind of error.
|
||||
Log.v(TAG, "Unable to use Google Play Services: %s", describeError(resultCode));
|
||||
if (isUserRecoverableError(resultCode)) {
|
||||
@@ -251,7 +245,7 @@ public class ExternalAuthUtils {
|
||||
protected int checkGooglePlayServicesAvailable(final Context context) {
|
||||
// TODO(crbug.com/577190): Temporarily allowing disk access until more permanent fix is in.
|
||||
try (StrictModeContext ignored = StrictModeContext.allowDiskWrites()) {
|
||||
- return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);
|
||||
+ return 1; /*SERVICE_MISSING*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +257,7 @@ public class ExternalAuthUtils {
|
||||
* @return true If the code represents a user-recoverable error
|
||||
*/
|
||||
protected boolean isUserRecoverableError(final int errorCode) {
|
||||
- return GoogleApiAvailability.getInstance().isUserResolvableError(errorCode);
|
||||
+ return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -273,6 +267,6 @@ public class ExternalAuthUtils {
|
||||
* @return a textual description of the error code
|
||||
*/
|
||||
protected String describeError(final int errorCode) {
|
||||
- return GoogleApiAvailability.getInstance().getErrorString(errorCode);
|
||||
+ return "";
|
||||
}
|
||||
}
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/externalauth/UserRecoverableErrorHandler.java
|
||||
@@ -9,8 +9,6 @@ import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
|
||||
-import com.google.android.gms.common.GoogleApiAvailability;
|
||||
-
|
||||
import org.chromium.base.ThreadUtils;
|
||||
import org.chromium.base.metrics.CachedMetrics.ActionEvent;
|
||||
|
||||
@@ -97,7 +95,6 @@ public abstract class UserRecoverableErrorHandler {
|
||||
if (!sNotificationShown.getAndSet(true)) {
|
||||
return;
|
||||
}
|
||||
- GoogleApiAvailability.getInstance().showErrorNotification(context, errorCode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,11 +187,7 @@ public abstract class UserRecoverableErrorHandler {
|
||||
cancelDialog();
|
||||
}
|
||||
if (mDialog == null) {
|
||||
- mDialog = GoogleApiAvailability.getInstance().getErrorDialog(
|
||||
- mActivity, errorCode, NO_RESPONSE_REQUIRED);
|
||||
mErrorCode = errorCode;
|
||||
-
|
||||
- DialogUserActionRecorder.createAndAttachToDialog(mDialog);
|
||||
}
|
||||
// This can happen if |errorCode| is ConnectionResult.SERVICE_INVALID.
|
||||
if (mDialog != null && !mDialog.isShowing()) {
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/gcore/ChromeGoogleApiClientImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/gcore/ChromeGoogleApiClientImpl.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/gcore/ChromeGoogleApiClientImpl.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/gcore/ChromeGoogleApiClientImpl.java
|
||||
@@ -6,9 +6,6 @@ package org.chromium.chrome.browser.gcore;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
-import com.google.android.gms.common.ConnectionResult;
|
||||
-import com.google.android.gms.common.api.GoogleApiClient;
|
||||
-
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.base.TraceEvent;
|
||||
import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
|
||||
@@ -22,7 +19,6 @@ public class ChromeGoogleApiClientImpl implements ChromeGoogleApiClient {
|
||||
private static final String TAG = "Icing";
|
||||
|
||||
private final Context mApplicationContext;
|
||||
- private final GoogleApiClient mClient;
|
||||
|
||||
/**
|
||||
* @param context its application context will be exposed through
|
||||
@@ -31,10 +27,9 @@ public class ChromeGoogleApiClientImpl implements ChromeGoogleApiClient {
|
||||
* @param requireFirstPartyBuild true if the given client can only be used in a first-party
|
||||
* build.
|
||||
*/
|
||||
- public ChromeGoogleApiClientImpl(Context context, GoogleApiClient client,
|
||||
+ public ChromeGoogleApiClientImpl(Context context,
|
||||
boolean requireFirstPartyBuild) {
|
||||
mApplicationContext = context.getApplicationContext();
|
||||
- mClient = client;
|
||||
if (requireFirstPartyBuild && !ExternalAuthUtils.getInstance().isChromeGoogleSigned()) {
|
||||
throw new IllegalStateException("GoogleApiClient requires first-party build");
|
||||
}
|
||||
@@ -42,7 +37,6 @@ public class ChromeGoogleApiClientImpl implements ChromeGoogleApiClient {
|
||||
|
||||
@Override
|
||||
public void disconnect() {
|
||||
- mClient.disconnect();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,24 +52,11 @@ public class ChromeGoogleApiClientImpl implements ChromeGoogleApiClient {
|
||||
@Override
|
||||
public boolean connectWithTimeout(long timeout) {
|
||||
TraceEvent.begin("ChromeGoogleApiClientImpl:connectWithTimeout");
|
||||
- try {
|
||||
- ConnectionResult result = mClient.blockingConnect(timeout, TimeUnit.MILLISECONDS);
|
||||
- if (!result.isSuccess()) {
|
||||
- Log.e(TAG, "Connection to GmsCore unsuccessful. Error %d", result.getErrorCode());
|
||||
- } else {
|
||||
- Log.d(TAG, "Connection to GmsCore successful.");
|
||||
- }
|
||||
- return result.isSuccess();
|
||||
- } finally {
|
||||
- TraceEvent.end("ChromeGoogleApiClientImpl:connectWithTimeout");
|
||||
- }
|
||||
+ TraceEvent.end("ChromeGoogleApiClientImpl:connectWithTimeout");
|
||||
+ return false;
|
||||
}
|
||||
|
||||
public Context getApplicationContext() {
|
||||
return mApplicationContext;
|
||||
}
|
||||
-
|
||||
- public GoogleApiClient getApiClient() {
|
||||
- return mClient;
|
||||
- }
|
||||
}
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/gcore/GoogleApiClientHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/gcore/GoogleApiClientHelper.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/gcore/GoogleApiClientHelper.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/gcore/GoogleApiClientHelper.java
|
||||
@@ -7,11 +7,6 @@ package org.chromium.chrome.browser.gcore;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
||||
-import com.google.android.gms.common.ConnectionResult;
|
||||
-import com.google.android.gms.common.api.GoogleApiClient;
|
||||
-import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
|
||||
-import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
|
||||
-
|
||||
import org.chromium.base.ApplicationStatus;
|
||||
import org.chromium.base.ApplicationStatus.ApplicationStateListener;
|
||||
import org.chromium.base.Log;
|
||||
@@ -67,30 +62,16 @@ import org.chromium.base.ThreadUtils;
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
-public class GoogleApiClientHelper
|
||||
- implements OnConnectionFailedListener, ConnectionCallbacks {
|
||||
+public class GoogleApiClientHelper {
|
||||
private static final String TAG = "GCore";
|
||||
|
||||
private int mResolutionAttempts;
|
||||
private boolean mWasConnectedBefore;
|
||||
private final Handler mHandler = new Handler(ThreadUtils.getUiThreadLooper());
|
||||
- private final GoogleApiClient mClient;
|
||||
private long mDisconnectionDelayMs;
|
||||
private Runnable mPendingDisconnect;
|
||||
|
||||
/**
|
||||
- * Creates a helper and enrolls it in the various connection management features.
|
||||
- * See the class documentation for {@link GoogleApiClientHelper} for more information.
|
||||
- *
|
||||
- * @param client The client to wrap.
|
||||
- */
|
||||
- public GoogleApiClientHelper(GoogleApiClient client) {
|
||||
- mClient = client;
|
||||
- enableConnectionRetrying(true);
|
||||
- enableLifecycleManagement(true);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
* Opts in or out of lifecycle management. The client's connection will be closed and reopened
|
||||
* when Chrome goes in and out of background.
|
||||
*
|
||||
@@ -116,13 +97,6 @@ public class GoogleApiClientHelper
|
||||
* Enabling or disabling it while it is already enabled or disabled has no effect.
|
||||
*/
|
||||
public void enableConnectionRetrying(boolean enabled) {
|
||||
- if (enabled) {
|
||||
- mClient.registerConnectionCallbacks(this);
|
||||
- mClient.registerConnectionFailedListener(this);
|
||||
- } else {
|
||||
- mClient.unregisterConnectionCallbacks(this);
|
||||
- mClient.unregisterConnectionFailedListener(this);
|
||||
- }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,21 +129,11 @@ public class GoogleApiClientHelper
|
||||
// Cancel and reschedule the disconnection if we are in the background. We do it early to
|
||||
// avoid race conditions between a disconnect on the UI thread and the connect below.
|
||||
if (!ApplicationStatus.hasVisibleActivities()) scheduleDisconnection();
|
||||
-
|
||||
- // The client might be disconnected if we were idle in the background for too long.
|
||||
- if (!mClient.isConnected() && !mClient.isConnecting()) {
|
||||
- Log.d(TAG, "Reconnecting the client.");
|
||||
- mClient.connect();
|
||||
- }
|
||||
}
|
||||
|
||||
void restoreConnectedState() {
|
||||
// If we go back to the foreground before a delayed disconnect happens, cancel it.
|
||||
cancelPendingDisconnection();
|
||||
-
|
||||
- if (mWasConnectedBefore) {
|
||||
- mClient.connect();
|
||||
- }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -192,12 +156,6 @@ public class GoogleApiClientHelper
|
||||
}
|
||||
|
||||
private void disconnect() {
|
||||
- if (mClient.isConnected() || mClient.isConnecting()) {
|
||||
- mWasConnectedBefore = true;
|
||||
- }
|
||||
-
|
||||
- // We always call disconnect to abort possibly pending connection requests.
|
||||
- mClient.disconnect();
|
||||
}
|
||||
|
||||
private void cancelPendingDisconnection() {
|
||||
@@ -207,43 +165,7 @@ public class GoogleApiClientHelper
|
||||
mPendingDisconnect = null;
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public void onConnectionFailed(ConnectionResult result) {
|
||||
- if (!isErrorRecoverableByRetrying(result.getErrorCode())) {
|
||||
- Log.d(TAG, "Not retrying managed client connection. Unrecoverable error: %d",
|
||||
- result.getErrorCode());
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (mResolutionAttempts < ConnectedTask.RETRY_NUMBER_LIMIT) {
|
||||
- Log.d(TAG, "Retrying managed client connection. attempt %d/%d - errorCode: %d",
|
||||
- mResolutionAttempts, ConnectedTask.RETRY_NUMBER_LIMIT, result.getErrorCode());
|
||||
- mResolutionAttempts += 1;
|
||||
-
|
||||
- mHandler.postDelayed(new Runnable() {
|
||||
- @Override
|
||||
- public void run() {
|
||||
- mClient.connect();
|
||||
- }
|
||||
- }, ConnectedTask.CONNECTION_RETRY_TIME_MS);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void onConnected(Bundle connectionHint) {
|
||||
- mResolutionAttempts = 0;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void onConnectionSuspended(int cause) {
|
||||
- // GoogleApiClient handles retrying on suspension itself. Logging in case it didn't succeed
|
||||
- // for some reason.
|
||||
- Log.w(TAG, "Managed client connection suspended. Cause: %d", cause);
|
||||
- }
|
||||
-
|
||||
private static boolean isErrorRecoverableByRetrying(int errorCode) {
|
||||
- return errorCode == ConnectionResult.INTERNAL_ERROR
|
||||
- || errorCode == ConnectionResult.NETWORK_ERROR
|
||||
- || errorCode == ConnectionResult.SERVICE_UPDATING;
|
||||
+ return false;
|
||||
}
|
||||
}
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java
|
||||
@@ -19,8 +19,6 @@ import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
-import com.google.android.gms.common.GooglePlayServicesUtil;
|
||||
-
|
||||
import org.chromium.base.ActivityState;
|
||||
import org.chromium.base.ApplicationStatus;
|
||||
import org.chromium.base.ApplicationStatus.ActivityStateListener;
|
||||
@@ -463,13 +461,7 @@ public class UpdateStatusProvider implements ActivityStateListener {
|
||||
}
|
||||
|
||||
private boolean isGooglePlayStoreAvailable(Context context) {
|
||||
- try {
|
||||
- context.getPackageManager().getPackageInfo(
|
||||
- GooglePlayServicesUtil.GOOGLE_PLAY_STORE_PACKAGE, 0);
|
||||
- } catch (PackageManager.NameNotFoundException e) {
|
||||
- return false;
|
||||
- }
|
||||
- return true;
|
||||
+ return false;
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PreferencesLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PreferencesLauncher.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PreferencesLauncher.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PreferencesLauncher.java
|
||||
@@ -12,8 +12,6 @@ import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
-import com.google.android.gms.common.ConnectionResult;
|
||||
-
|
||||
import org.chromium.base.annotations.CalledByNative;
|
||||
import org.chromium.base.metrics.RecordHistogram;
|
||||
import org.chromium.base.metrics.RecordUserAction;
|
||||
@@ -202,8 +200,7 @@ public class PreferencesLauncher {
|
||||
int minGooglePlayServicesVersion = ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
|
||||
GOOGLE_ACCOUNT_PWM_UI, MIN_GOOGLE_PLAY_SERVICES_VERSION_PARAM,
|
||||
DEFAULT_MIN_GOOGLE_PLAY_SERVICES_APK_VERSION);
|
||||
- if (AppHooks.get().isGoogleApiAvailableWithMinApkVersion(minGooglePlayServicesVersion)
|
||||
- != ConnectionResult.SUCCESS)
|
||||
+ if (true)
|
||||
return false;
|
||||
|
||||
if (!ChromeFeatureList.isEnabled(GOOGLE_ACCOUNT_PWM_UI)) return false;
|
||||
diff --git a/chrome/test/android/BUILD.gn b/chrome/test/android/BUILD.gn
|
||||
--- a/chrome/test/android/BUILD.gn
|
||||
+++ b/chrome/test/android/BUILD.gn
|
||||
@@ -153,8 +153,6 @@ android_library("chrome_java_test_support") {
|
||||
"javatests/src/org/chromium/chrome/test/util/TranslateUtil.java",
|
||||
]
|
||||
deps = [
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//chrome/android:chrome_java",
|
||||
diff --git a/components/background_task_scheduler/BUILD.gn b/components/background_task_scheduler/BUILD.gn
|
||||
--- a/components/background_task_scheduler/BUILD.gn
|
||||
+++ b/components/background_task_scheduler/BUILD.gn
|
||||
@@ -52,9 +52,6 @@ if (is_android) {
|
||||
deps = [
|
||||
":background_task_scheduler_task_ids_java",
|
||||
":scheduled_task_java",
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//content/public/android:content_java",
|
||||
"//third_party/android_deps:com_android_support_support_annotations_java",
|
||||
@@ -75,9 +72,6 @@ if (is_android) {
|
||||
deps = [
|
||||
":background_task_scheduler_java",
|
||||
":background_task_scheduler_task_ids_java",
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//content/public/test/android:content_java_test_support",
|
||||
@@ -104,10 +98,6 @@ if (is_android) {
|
||||
|
||||
deps = [
|
||||
":background_task_scheduler_java",
|
||||
- "$google_play_services_package:google_play_services_auth_base_java",
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//base:base_junit_test_support",
|
||||
diff --git a/components/signin/core/browser/android/BUILD.gn b/components/signin/core/browser/android/BUILD.gn
|
||||
--- a/components/signin/core/browser/android/BUILD.gn
|
||||
+++ b/components/signin/core/browser/android/BUILD.gn
|
||||
@@ -15,8 +15,6 @@ generate_jni("jni_headers") {
|
||||
|
||||
android_library("java") {
|
||||
deps = [
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
"//base:base_java",
|
||||
"//base:jni_java",
|
||||
"//net/android:net_java",
|
||||
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/GmsAvailabilityException.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/GmsAvailabilityException.java
|
||||
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/GmsAvailabilityException.java
|
||||
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/GmsAvailabilityException.java
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
package org.chromium.components.signin;
|
||||
|
||||
-import com.google.android.gms.common.GoogleApiAvailability;
|
||||
-
|
||||
/**
|
||||
* This class encapsulates return code if GMSCore package is not available.
|
||||
*/
|
||||
@@ -27,6 +25,6 @@ public class GmsAvailabilityException extends AccountManagerDelegateException {
|
||||
}
|
||||
|
||||
public boolean isUserResolvableError() {
|
||||
- return GoogleApiAvailability.getInstance().isUserResolvableError(mResultCode);
|
||||
+ return false;
|
||||
}
|
||||
}
|
||||
diff --git a/content/public/android/BUILD.gn b/content/public/android/BUILD.gn
|
||||
--- a/content/public/android/BUILD.gn
|
||||
+++ b/content/public/android/BUILD.gn
|
||||
@@ -52,9 +52,6 @@ action("generate_sandboxed_service_srcjar") {
|
||||
android_library("content_java") {
|
||||
deps = [
|
||||
":content_java_resources",
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//base:jni_java",
|
||||
"//components/download/public/common:public_java",
|
||||
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
|
||||
--- a/content/test/BUILD.gn
|
||||
+++ b/content/test/BUILD.gn
|
||||
@@ -2442,9 +2442,6 @@ if (is_android) {
|
||||
testonly = true
|
||||
java_files = content_java_sources_needing_jni
|
||||
deps = [
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//content/public/android:content_java",
|
||||
]
|
||||
diff --git a/device/BUILD.gn b/device/BUILD.gn
|
||||
--- a/device/BUILD.gn
|
||||
+++ b/device/BUILD.gn
|
||||
@@ -386,8 +386,6 @@ if (is_android) {
|
||||
junit_binary("device_junit_tests") {
|
||||
java_files = [ "gamepad/android/junit/src/org/chromium/device/gamepad/GamepadMappingsTest.java" ]
|
||||
deps = [
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//base:base_junit_test_support",
|
||||
diff --git a/remoting/android/client_java_tmpl.gni b/remoting/android/client_java_tmpl.gni
|
||||
--- a/remoting/android/client_java_tmpl.gni
|
||||
+++ b/remoting/android/client_java_tmpl.gni
|
||||
@@ -101,9 +101,6 @@ template("remoting_android_client_java_tmpl") {
|
||||
|
||||
if (defined(invoker.play_services_package)) {
|
||||
deps += [
|
||||
- "${invoker.play_services_package}:google_play_services_auth_base_java",
|
||||
- "${invoker.play_services_package}:google_play_services_base_java",
|
||||
- "${invoker.play_services_package}:google_play_services_basement_java",
|
||||
]
|
||||
}
|
||||
|
||||
diff --git a/services/BUILD.gn b/services/BUILD.gn
|
||||
--- a/services/BUILD.gn
|
||||
+++ b/services/BUILD.gn
|
||||
@@ -107,8 +107,6 @@ if (is_android) {
|
||||
"shape_detection/android/junit/src/org/chromium/shape_detection/BitmapUtilsTest.java",
|
||||
]
|
||||
deps = [
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//base:base_junit_test_support",
|
||||
@@ -136,8 +134,6 @@ if (is_android) {
|
||||
"shape_detection/android/javatests/src/org/chromium/shape_detection/TextDetectionImplTest.java",
|
||||
]
|
||||
deps = [
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//mojo/public/java:base_java",
|
||||
diff --git a/services/device/geolocation/BUILD.gn b/services/device/geolocation/BUILD.gn
|
||||
--- a/services/device/geolocation/BUILD.gn
|
||||
+++ b/services/device/geolocation/BUILD.gn
|
||||
@@ -141,8 +141,6 @@ if (is_android) {
|
||||
deps = [
|
||||
":geolocation",
|
||||
":geolocation_jni_headers",
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
"//base:base_java",
|
||||
"//components/location/android:location_java",
|
||||
"//services/device/public/java:geolocation_java",
|
||||
diff --git a/services/shape_detection/BUILD.gn b/services/shape_detection/BUILD.gn
|
||||
--- a/services/shape_detection/BUILD.gn
|
||||
+++ b/services/shape_detection/BUILD.gn
|
||||
@@ -89,8 +89,6 @@ if (is_android) {
|
||||
]
|
||||
|
||||
deps = [
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
"//base:base_java",
|
||||
"//mojo/public/java:base_java",
|
||||
"//mojo/public/java:bindings_java",
|
||||
diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn
|
||||
--- a/third_party/android_deps/BUILD.gn
|
||||
+++ b/third_party/android_deps/BUILD.gn
|
||||
@@ -772,44 +772,6 @@ android_aar_prebuilt("com_android_support_viewpager_java") {
|
||||
}
|
||||
|
||||
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_base_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_base/play-services-base-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_base/com_google_android_gms_play_services_base.info"
|
||||
- deps = [
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_tasks_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_basement_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_basement/play-services-basement-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_basement/com_google_android_gms_play_services_basement.info"
|
||||
- deps = [
|
||||
- ":com_android_support_support_v4_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
- input_jars_paths = [ "$android_sdk/optional/org.apache.http.legacy.jar" ]
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_tasks_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_tasks/play-services-tasks-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_tasks/com_google_android_gms_play_services_tasks.info"
|
||||
- deps = [
|
||||
- ":google_play_services_basement_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
android_aar_prebuilt("com_google_android_material_material_java") {
|
||||
aar_path = "libs/com_google_android_material_material/material-1.0.0-rc02.aar"
|
||||
info_path = "libs/com_google_android_material_material/com_google_android_material_material.info"
|
||||
diff --git a/third_party/cacheinvalidation/BUILD.gn b/third_party/cacheinvalidation/BUILD.gn
|
||||
--- a/third_party/cacheinvalidation/BUILD.gn
|
||||
+++ b/third_party/cacheinvalidation/BUILD.gn
|
||||
@@ -137,7 +137,6 @@ if (is_android) {
|
||||
jacoco_never_instrument = true
|
||||
deps = [
|
||||
":cacheinvalidation_proto_java",
|
||||
- "$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//third_party/android_protobuf:protobuf_nano_javalib",
|
||||
]
|
||||
diff --git a/third_party/robolectric/BUILD.gn b/third_party/robolectric/BUILD.gn
|
||||
--- a/third_party/robolectric/BUILD.gn
|
||||
+++ b/third_party/robolectric/BUILD.gn
|
||||
@@ -938,8 +938,6 @@ java_library("shadows_play_services_java") {
|
||||
":robolectric_shadowapi_java",
|
||||
":robolectric_utils_java",
|
||||
":shadows_core_java",
|
||||
- "$google_play_services_package:google_play_services_base_java",
|
||||
- "$google_play_services_package:google_play_services_basement_java",
|
||||
"//third_party/android_deps:android_support_v4_java",
|
||||
"//third_party/gson:gson_java",
|
||||
"//third_party/guava:guava_java",
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -0,0 +1,554 @@
|
|||
From: Wengling Chen <feiyu2817@gmail.com>
|
||||
Date: Sat, 2 Nov 2019 07:58:48 +0100
|
||||
Subject: Remove dependency on com.google.android.gms.fido,
|
||||
com.google.android.gms.iid, com.google.android.gms.instantapps,
|
||||
com.google.android.gms.location
|
||||
|
||||
---
|
||||
chrome/android/BUILD.gn | 5 -
|
||||
.../externalnav/ExternalNavigationHandler.java | 3 -
|
||||
.../browser/instantapps/InstantAppsHandler.java | 59 +-----------
|
||||
components/gcm_driver/instance_id/android/BUILD.gn | 2 -
|
||||
.../instance_id/InstanceIDWithSubtype.java | 28 +-----
|
||||
device/BUILD.gn | 1 -
|
||||
services/device/geolocation/BUILD.gn | 1 -
|
||||
.../geolocation/LocationProviderGmsCore.java | 103 +--------------------
|
||||
third_party/android_deps/BUILD.gn | 58 ------------
|
||||
third_party/cacheinvalidation/BUILD.gn | 1 -
|
||||
.../client/android2/AndroidManifestUpdatedGcm.xml | 3 -
|
||||
11 files changed, 9 insertions(+), 255 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
|
||||
--- a/chrome/android/BUILD.gn
|
||||
+++ b/chrome/android/BUILD.gn
|
||||
@@ -271,8 +271,6 @@ android_library("chrome_java") {
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
"$google_play_services_package:google_play_services_cast_framework_java",
|
||||
"$google_play_services_package:google_play_services_cast_java",
|
||||
- "$google_play_services_package:google_play_services_fido_java",
|
||||
- "$google_play_services_package:google_play_services_iid_java",
|
||||
"$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//base:jni_java",
|
||||
@@ -693,7 +691,6 @@ junit_binary("chrome_junit_tests") {
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
"$google_play_services_package:google_play_services_cast_framework_java",
|
||||
"$google_play_services_package:google_play_services_cast_java",
|
||||
- "$google_play_services_package:google_play_services_fido_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//base:base_junit_test_support",
|
||||
@@ -795,8 +792,6 @@ android_library("chrome_test_java") {
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
"$google_play_services_package:google_play_services_cast_framework_java",
|
||||
"$google_play_services_package:google_play_services_cast_java",
|
||||
- "$google_play_services_package:google_play_services_fido_java",
|
||||
- "$google_play_services_package:google_play_services_iid_java",
|
||||
"$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
|
||||
@@ -581,7 +581,6 @@ public class ExternalNavigationHandler {
|
||||
if (shouldProxyForInstantApps) {
|
||||
RecordHistogram.recordEnumeratedHistogram("Android.InstantApps.DirectInstantAppsIntent",
|
||||
AiaIntent.SERP, AiaIntent.NUM_ENTRIES);
|
||||
- intent.putExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER, true);
|
||||
} else if (isDirectInstantAppsIntent) {
|
||||
// For security reasons, we disable all intent:// URLs to Instant Apps that are
|
||||
// not coming from SERP.
|
||||
@@ -590,8 +589,6 @@ public class ExternalNavigationHandler {
|
||||
AiaIntent.OTHER, AiaIntent.NUM_ENTRIES);
|
||||
return OverrideUrlLoadingResult.NO_OVERRIDE;
|
||||
} else {
|
||||
- // Make sure this extra is not sent unless we've done the verification.
|
||||
- intent.removeExtra(InstantAppsHandler.IS_GOOGLE_SEARCH_REFERRER);
|
||||
}
|
||||
|
||||
boolean deviceCanHandleIntent = deviceCanHandleIntent(intent);
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/instantapps/InstantAppsHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/instantapps/InstantAppsHandler.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/instantapps/InstantAppsHandler.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/instantapps/InstantAppsHandler.java
|
||||
@@ -42,36 +42,6 @@ public class InstantAppsHandler {
|
||||
// TODO(mariakhomenko): Use system once we roll to O SDK.
|
||||
private static final int FLAG_DO_NOT_LAUNCH = 0x00000200;
|
||||
|
||||
- // TODO(mariakhomenko): Depend directly on the constants once we roll to v8 libraries.
|
||||
- private static final String DO_NOT_LAUNCH_EXTRA =
|
||||
- "com.google.android.gms.instantapps.DO_NOT_LAUNCH_INSTANT_APP";
|
||||
-
|
||||
- protected static final String IS_REFERRER_TRUSTED_EXTRA =
|
||||
- "com.google.android.gms.instantapps.IS_REFERRER_TRUSTED";
|
||||
-
|
||||
- protected static final String IS_USER_CONFIRMED_LAUNCH_EXTRA =
|
||||
- "com.google.android.gms.instantapps.IS_USER_CONFIRMED_LAUNCH";
|
||||
-
|
||||
- protected static final String TRUSTED_REFERRER_PKG_EXTRA =
|
||||
- "com.google.android.gms.instantapps.TRUSTED_REFERRER_PKG";
|
||||
-
|
||||
- public static final String IS_GOOGLE_SEARCH_REFERRER =
|
||||
- "com.google.android.gms.instantapps.IS_GOOGLE_SEARCH_REFERRER";
|
||||
-
|
||||
- private static final String BROWSER_LAUNCH_REASON =
|
||||
- "com.google.android.gms.instantapps.BROWSER_LAUNCH_REASON";
|
||||
-
|
||||
- private static final String SUPERVISOR_PKG = "com.google.android.instantapps.supervisor";
|
||||
-
|
||||
- private static final String[] SUPERVISOR_START_ACTIONS = {
|
||||
- "com.google.android.instantapps.START", "com.google.android.instantapps.nmr1.INSTALL",
|
||||
- "com.google.android.instantapps.nmr1.VIEW"};
|
||||
-
|
||||
- // Instant Apps system resolver activity on N-MR1+.
|
||||
- @VisibleForTesting
|
||||
- public static final String EPHEMERAL_INSTALLER_CLASS =
|
||||
- "com.google.android.gms.instantapps.routing.EphemeralInstallerActivity";
|
||||
-
|
||||
/** Finch experiment name. */
|
||||
private static final String INSTANT_APPS_EXPERIMENT_NAME = "InstantApps";
|
||||
|
||||
@@ -123,14 +93,6 @@ public class InstantAppsHandler {
|
||||
* @return Whether the given intent is going to open an Instant App.
|
||||
*/
|
||||
public static boolean isIntentToInstantApp(Intent intent) {
|
||||
- if (SUPERVISOR_PKG.equals(intent.getPackage())) return true;
|
||||
-
|
||||
- String intentAction = intent.getAction();
|
||||
- for (String action : SUPERVISOR_START_ACTIONS) {
|
||||
- if (action.equals(intentAction)) {
|
||||
- return true;
|
||||
- }
|
||||
- }
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -167,13 +129,7 @@ public class InstantAppsHandler {
|
||||
sFallbackIntentTimes.record(SystemClock.elapsedRealtime() - startTime);
|
||||
intent.removeExtra(INSTANT_APP_START_TIME_EXTRA);
|
||||
}
|
||||
- int callSource = IntentUtils.safeGetIntExtra(intent, BROWSER_LAUNCH_REASON, 0);
|
||||
- if (callSource > 0 && callSource < SOURCE_BOUNDARY) {
|
||||
- sFallbackCallSource.record(callSource);
|
||||
- intent.removeExtra(BROWSER_LAUNCH_REASON);
|
||||
- } else if (callSource >= SOURCE_BOUNDARY) {
|
||||
- Log.e(TAG, "Unexpected call source constant for Instant Apps: " + callSource);
|
||||
- }
|
||||
+ Log.e(TAG, "Unexpected call source constant for Instant Apps");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,14 +164,6 @@ public class InstantAppsHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (IntentUtils.safeGetBooleanExtra(intent, DO_NOT_LAUNCH_EXTRA, false)
|
||||
- || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
- && (intent.getFlags() & FLAG_DO_NOT_LAUNCH) != 0)) {
|
||||
- maybeRecordFallbackStats(intent);
|
||||
- Log.i(TAG, "Not handling with Instant Apps (DO_NOT_LAUNCH_EXTRA)");
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
if (IntentUtils.safeGetBooleanExtra(
|
||||
intent, IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, false)
|
||||
|| IntentUtils.safeHasExtra(intent, ShortcutHelper.EXTRA_SOURCE)
|
||||
@@ -240,7 +188,6 @@ public class InstantAppsHandler {
|
||||
}
|
||||
|
||||
Intent callbackIntent = new Intent(intent);
|
||||
- callbackIntent.putExtra(DO_NOT_LAUNCH_EXTRA, true);
|
||||
callbackIntent.putExtra(INSTANT_APP_START_TIME_EXTRA, startTime);
|
||||
|
||||
return tryLaunchingInstantApp(context, intent, isCustomTabsIntent, callbackIntent);
|
||||
@@ -343,12 +290,9 @@ public class InstantAppsHandler {
|
||||
Intent iaIntent = data.getIntent();
|
||||
if (data.getReferrer() != null) {
|
||||
iaIntent.putExtra(Intent.EXTRA_REFERRER, data.getReferrer());
|
||||
- iaIntent.putExtra(IS_REFERRER_TRUSTED_EXTRA, true);
|
||||
}
|
||||
|
||||
Context appContext = ContextUtils.getApplicationContext();
|
||||
- iaIntent.putExtra(TRUSTED_REFERRER_PKG_EXTRA, appContext.getPackageName());
|
||||
- iaIntent.putExtra(IS_USER_CONFIRMED_LAUNCH_EXTRA, true);
|
||||
|
||||
try {
|
||||
appContext.startActivity(iaIntent);
|
||||
@@ -394,7 +338,6 @@ public class InstantAppsHandler {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
return info.isInstantAppAvailable;
|
||||
} else if (info.activityInfo != null) {
|
||||
- return EPHEMERAL_INSTALLER_CLASS.equals(info.activityInfo.name);
|
||||
}
|
||||
|
||||
return false;
|
||||
diff --git a/components/gcm_driver/instance_id/android/BUILD.gn b/components/gcm_driver/instance_id/android/BUILD.gn
|
||||
--- a/components/gcm_driver/instance_id/android/BUILD.gn
|
||||
+++ b/components/gcm_driver/instance_id/android/BUILD.gn
|
||||
@@ -18,7 +18,6 @@ generate_jni("test_support_jni_headers") {
|
||||
|
||||
android_library("instance_id_driver_java") {
|
||||
deps = [
|
||||
- "$google_play_services_package:google_play_services_iid_java",
|
||||
"//base:base_java",
|
||||
"//components/gcm_driver/android:gcm_driver_java",
|
||||
]
|
||||
@@ -34,7 +33,6 @@ android_library("instance_id_driver_java") {
|
||||
android_library("instance_id_driver_test_support_java") {
|
||||
deps = [
|
||||
":instance_id_driver_java",
|
||||
- "$google_play_services_package:google_play_services_iid_java",
|
||||
"//base:base_java",
|
||||
]
|
||||
|
||||
diff --git a/components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDWithSubtype.java b/components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDWithSubtype.java
|
||||
--- a/components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDWithSubtype.java
|
||||
+++ b/components/gcm_driver/instance_id/android/java/src/org/chromium/components/gcm_driver/instance_id/InstanceIDWithSubtype.java
|
||||
@@ -8,8 +8,6 @@ import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
-import com.google.android.gms.iid.InstanceID;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.VisibleForTesting;
|
||||
|
||||
@@ -25,8 +23,6 @@ public class InstanceIDWithSubtype {
|
||||
// Must match the private InstanceID.OPTION_SUBTYPE, which is guaranteed to not change.
|
||||
private static final String OPTION_SUBTYPE = "subtype";
|
||||
|
||||
- private final InstanceID mInstanceID;
|
||||
-
|
||||
/**
|
||||
* Cached instances. May be accessed from multiple threads; synchronize on sSubtypeInstancesLock
|
||||
*/
|
||||
@@ -38,10 +34,6 @@ public class InstanceIDWithSubtype {
|
||||
@VisibleForTesting
|
||||
protected static FakeFactory sFakeFactoryForTesting;
|
||||
|
||||
- protected InstanceIDWithSubtype(InstanceID instanceID) {
|
||||
- mInstanceID = instanceID;
|
||||
- }
|
||||
-
|
||||
/**
|
||||
* Returns an instance of this class. Unlike {@link InstanceID#getInstance(Context)}, it is not
|
||||
* a singleton, but instead a different instance will be returned for each {@code subtype}.
|
||||
@@ -57,11 +49,6 @@ public class InstanceIDWithSubtype {
|
||||
if (sFakeFactoryForTesting != null) {
|
||||
existing = sFakeFactoryForTesting.create(subtype);
|
||||
} else {
|
||||
- Bundle options = new Bundle();
|
||||
- options.putCharSequence(OPTION_SUBTYPE, subtype);
|
||||
- InstanceID instanceID =
|
||||
- InstanceID.getInstance(ContextUtils.getApplicationContext(), options);
|
||||
- existing = new InstanceIDWithSubtype(instanceID);
|
||||
}
|
||||
sSubtypeInstances.put(subtype, existing);
|
||||
}
|
||||
@@ -70,35 +57,30 @@ public class InstanceIDWithSubtype {
|
||||
}
|
||||
|
||||
public String getSubtype() {
|
||||
- return mInstanceID.getSubtype();
|
||||
+ return "";
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
- return mInstanceID.getId();
|
||||
+ return "";
|
||||
}
|
||||
|
||||
public long getCreationTime() {
|
||||
- return mInstanceID.getCreationTime();
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
public void deleteInstanceID() throws IOException {
|
||||
- synchronized (sSubtypeInstancesLock) {
|
||||
- sSubtypeInstances.remove(mInstanceID.getSubtype());
|
||||
- mInstanceID.deleteInstanceID();
|
||||
- }
|
||||
}
|
||||
|
||||
public void deleteToken(String authorizedEntity, String scope) throws IOException {
|
||||
- mInstanceID.deleteToken(authorizedEntity, scope);
|
||||
}
|
||||
|
||||
public String getToken(String authorizedEntity, String scope) throws IOException {
|
||||
- return mInstanceID.getToken(authorizedEntity, scope);
|
||||
+ return "";
|
||||
}
|
||||
|
||||
public String getToken(String authorizedEntity, String scope, Bundle extras)
|
||||
throws IOException {
|
||||
- return mInstanceID.getToken(authorizedEntity, scope, extras);
|
||||
+ return "";
|
||||
}
|
||||
|
||||
/** Fake subclasses can set {@link #sFakeFactoryForTesting} to an implementation of this. */
|
||||
diff --git a/device/BUILD.gn b/device/BUILD.gn
|
||||
--- a/device/BUILD.gn
|
||||
+++ b/device/BUILD.gn
|
||||
@@ -388,7 +388,6 @@ if (is_android) {
|
||||
deps = [
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_location_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//base:base_junit_test_support",
|
||||
diff --git a/services/device/geolocation/BUILD.gn b/services/device/geolocation/BUILD.gn
|
||||
--- a/services/device/geolocation/BUILD.gn
|
||||
+++ b/services/device/geolocation/BUILD.gn
|
||||
@@ -143,7 +143,6 @@ if (is_android) {
|
||||
":geolocation_jni_headers",
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_location_java",
|
||||
"//base:base_java",
|
||||
"//components/location/android:location_java",
|
||||
"//services/device/public/java:geolocation_java",
|
||||
diff --git a/services/device/geolocation/android/java/src/org/chromium/device/geolocation/LocationProviderGmsCore.java b/services/device/geolocation/android/java/src/org/chromium/device/geolocation/LocationProviderGmsCore.java
|
||||
--- a/services/device/geolocation/android/java/src/org/chromium/device/geolocation/LocationProviderGmsCore.java
|
||||
+++ b/services/device/geolocation/android/java/src/org/chromium/device/geolocation/LocationProviderGmsCore.java
|
||||
@@ -8,16 +8,6 @@ import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
|
||||
-import com.google.android.gms.common.ConnectionResult;
|
||||
-import com.google.android.gms.common.GoogleApiAvailability;
|
||||
-import com.google.android.gms.common.api.GoogleApiClient;
|
||||
-import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
|
||||
-import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener;
|
||||
-import com.google.android.gms.location.FusedLocationProviderApi;
|
||||
-import com.google.android.gms.location.LocationListener;
|
||||
-import com.google.android.gms.location.LocationRequest;
|
||||
-import com.google.android.gms.location.LocationServices;
|
||||
-
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.base.ThreadUtils;
|
||||
import org.chromium.components.location.LocationUtils;
|
||||
@@ -27,126 +17,39 @@ import org.chromium.components.location.LocationUtils;
|
||||
*
|
||||
* https://developers.google.com/android/reference/com/google/android/gms/location/package-summary
|
||||
*/
|
||||
-public class LocationProviderGmsCore implements ConnectionCallbacks, OnConnectionFailedListener,
|
||||
- LocationListener, LocationProvider {
|
||||
+public class LocationProviderGmsCore implements LocationProvider {
|
||||
private static final String TAG = "cr_LocationProvider";
|
||||
|
||||
// Values for the LocationRequest's setInterval for normal and high accuracy, respectively.
|
||||
private static final long UPDATE_INTERVAL_MS = 1000;
|
||||
private static final long UPDATE_INTERVAL_FAST_MS = 500;
|
||||
|
||||
- private final GoogleApiClient mGoogleApiClient;
|
||||
- private FusedLocationProviderApi mLocationProviderApi = LocationServices.FusedLocationApi;
|
||||
-
|
||||
private boolean mEnablehighAccuracy;
|
||||
- private LocationRequest mLocationRequest;
|
||||
|
||||
public static boolean isGooglePlayServicesAvailable(Context context) {
|
||||
- return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context)
|
||||
- == ConnectionResult.SUCCESS;
|
||||
+ return false;
|
||||
}
|
||||
|
||||
LocationProviderGmsCore(Context context) {
|
||||
Log.i(TAG, "Google Play Services");
|
||||
- mGoogleApiClient = new GoogleApiClient.Builder(context)
|
||||
- .addApi(LocationServices.API)
|
||||
- .addConnectionCallbacks(this)
|
||||
- .addOnConnectionFailedListener(this)
|
||||
- .build();
|
||||
- assert mGoogleApiClient != null;
|
||||
- }
|
||||
-
|
||||
- LocationProviderGmsCore(GoogleApiClient client, FusedLocationProviderApi locationApi) {
|
||||
- mGoogleApiClient = client;
|
||||
- mLocationProviderApi = locationApi;
|
||||
- }
|
||||
-
|
||||
- // ConnectionCallbacks implementation
|
||||
- @Override
|
||||
- public void onConnected(Bundle connectionHint) {
|
||||
- ThreadUtils.assertOnUiThread();
|
||||
-
|
||||
- mLocationRequest = LocationRequest.create();
|
||||
- if (mEnablehighAccuracy) {
|
||||
- // With enableHighAccuracy, request a faster update interval and configure the provider
|
||||
- // for high accuracy mode.
|
||||
- mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
|
||||
- .setInterval(UPDATE_INTERVAL_FAST_MS);
|
||||
- } else {
|
||||
- // Use balanced mode by default. In this mode, the API will prefer the network provider
|
||||
- // but may use sensor data (for instance, GPS) if high accuracy is requested by another
|
||||
- // app.
|
||||
- //
|
||||
- // If location is configured for sensors-only then elevate the priority to ensure GPS
|
||||
- // and other sensors are used.
|
||||
- if (LocationUtils.getInstance().isSystemLocationSettingSensorsOnly()) {
|
||||
- mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
|
||||
- } else {
|
||||
- mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
|
||||
- }
|
||||
- mLocationRequest.setInterval(UPDATE_INTERVAL_MS);
|
||||
- }
|
||||
-
|
||||
- final Location location = mLocationProviderApi.getLastLocation(mGoogleApiClient);
|
||||
- if (location != null) {
|
||||
- LocationProviderAdapter.onNewLocationAvailable(location);
|
||||
- }
|
||||
-
|
||||
- try {
|
||||
- // Request updates on UI Thread replicating LocationProviderAndroid's behaviour.
|
||||
- mLocationProviderApi.requestLocationUpdates(
|
||||
- mGoogleApiClient, mLocationRequest, this, ThreadUtils.getUiThreadLooper());
|
||||
- } catch (IllegalStateException | SecurityException e) {
|
||||
- // IllegalStateException is thrown "If this method is executed in a thread that has not
|
||||
- // called Looper.prepare()". SecurityException is thrown if there is no permission, see
|
||||
- // https://crbug.com/731271.
|
||||
- Log.e(TAG, " mLocationProviderApi.requestLocationUpdates() " + e);
|
||||
- LocationProviderAdapter.newErrorAvailable(
|
||||
- "Failed to request location updates: " + e.toString());
|
||||
- assert false;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void onConnectionSuspended(int cause) {}
|
||||
-
|
||||
- // OnConnectionFailedListener implementation
|
||||
- @Override
|
||||
- public void onConnectionFailed(ConnectionResult result) {
|
||||
- LocationProviderAdapter.newErrorAvailable(
|
||||
- "Failed to connect to Google Play Services: " + result.toString());
|
||||
}
|
||||
|
||||
// LocationProvider implementation
|
||||
@Override
|
||||
public void start(boolean enableHighAccuracy) {
|
||||
ThreadUtils.assertOnUiThread();
|
||||
- if (mGoogleApiClient.isConnected()) mGoogleApiClient.disconnect();
|
||||
|
||||
mEnablehighAccuracy = enableHighAccuracy;
|
||||
- mGoogleApiClient.connect(); // Should return via onConnected().
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
ThreadUtils.assertOnUiThread();
|
||||
- if (!mGoogleApiClient.isConnected()) return;
|
||||
-
|
||||
- mLocationProviderApi.removeLocationUpdates(mGoogleApiClient, this);
|
||||
-
|
||||
- mGoogleApiClient.disconnect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
assert ThreadUtils.runningOnUiThread();
|
||||
- if (mGoogleApiClient == null) return false;
|
||||
- return mGoogleApiClient.isConnecting() || mGoogleApiClient.isConnected();
|
||||
- }
|
||||
-
|
||||
- // LocationListener implementation
|
||||
- @Override
|
||||
- public void onLocationChanged(Location location) {
|
||||
- LocationProviderAdapter.onNewLocationAvailable(location);
|
||||
+ return false;
|
||||
}
|
||||
}
|
||||
diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn
|
||||
--- a/third_party/android_deps/BUILD.gn
|
||||
+++ b/third_party/android_deps/BUILD.gn
|
||||
@@ -830,64 +830,6 @@ android_aar_prebuilt("google_play_services_cast_framework_java") {
|
||||
}
|
||||
|
||||
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_fido_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_fido/play-services-fido-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_fido/com_google_android_gms_play_services_fido.info"
|
||||
- deps = [
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_tasks_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_iid_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_iid/play-services-iid-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_iid/com_google_android_gms_play_services_iid.info"
|
||||
- deps = [
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_stats_java",
|
||||
- ":google_play_services_tasks_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_instantapps_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_instantapps/play-services-instantapps-16.0.0.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_instantapps/com_google_android_gms_play_services_instantapps.info"
|
||||
- deps = [
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_tasks_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_location_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_location/play-services-location-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_location/com_google_android_gms_play_services_location.info"
|
||||
- deps = [
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_places_placereport_java",
|
||||
- ":google_play_services_tasks_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
android_aar_prebuilt("google_play_services_tasks_java") {
|
||||
aar_path = "libs/com_google_android_gms_play_services_tasks/play-services-tasks-15.0.1.aar"
|
||||
info_path = "libs/com_google_android_gms_play_services_tasks/com_google_android_gms_play_services_tasks.info"
|
||||
diff --git a/third_party/cacheinvalidation/BUILD.gn b/third_party/cacheinvalidation/BUILD.gn
|
||||
--- a/third_party/cacheinvalidation/BUILD.gn
|
||||
+++ b/third_party/cacheinvalidation/BUILD.gn
|
||||
@@ -137,7 +137,6 @@ if (is_android) {
|
||||
jacoco_never_instrument = true
|
||||
deps = [
|
||||
":cacheinvalidation_proto_java",
|
||||
- "$google_play_services_package:google_play_services_iid_java",
|
||||
"$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//third_party/android_protobuf:protobuf_nano_javalib",
|
||||
diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifestUpdatedGcm.xml b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifestUpdatedGcm.xml
|
||||
--- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifestUpdatedGcm.xml
|
||||
+++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifestUpdatedGcm.xml
|
||||
@@ -27,9 +27,6 @@
|
||||
<!-- InstanceID Listener Service -->
|
||||
<service android:exported="false"
|
||||
android:name="com.google.ipc.invalidation.ticl2.android2.channel.AndroidInstanceIDListenerService">
|
||||
- <intent-filter>
|
||||
- <action android:name="com.google.android.gms.iid.InstanceID"/>
|
||||
- </intent-filter>
|
||||
</service>
|
||||
</application>
|
||||
</manifest>
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
From: Wengling Chen <feiyu2817@gmail.com>
|
||||
Date: Sat, 2 Nov 2019 07:57:37 +0100
|
||||
Subject: Remove dependency on com.google.android.gms.flags,
|
||||
com.google.android.gms.location.places, com.google.android.gms.stats
|
||||
|
||||
---
|
||||
third_party/android_deps/BUILD.gn | 49 ---------------------------------------
|
||||
1 file changed, 49 deletions(-)
|
||||
|
||||
diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn
|
||||
--- a/third_party/android_deps/BUILD.gn
|
||||
+++ b/third_party/android_deps/BUILD.gn
|
||||
@@ -1499,55 +1499,6 @@ android_aar_prebuilt("com_android_support_versionedparcelable_java") {
|
||||
}
|
||||
|
||||
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_flags_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_flags/play-services-flags-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_flags/com_google_android_gms_play_services_flags.info"
|
||||
-
|
||||
- # To remove visibility constraint, add this dependency to
|
||||
- # //tools/android/roll/android_deps/build.gradle.
|
||||
- visibility = [ ":*" ]
|
||||
- deps = [
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_places_placereport_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_places_placereport/play-services-places-placereport-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_places_placereport/com_google_android_gms_play_services_places_placereport.info"
|
||||
-
|
||||
- # To remove visibility constraint, add this dependency to
|
||||
- # //tools/android/roll/android_deps/build.gradle.
|
||||
- visibility = [ ":*" ]
|
||||
- deps = [
|
||||
- ":google_play_services_basement_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_stats_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_stats/play-services-stats-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_stats/com_google_android_gms_play_services_stats.info"
|
||||
-
|
||||
- # To remove visibility constraint, add this dependency to
|
||||
- # //tools/android/roll/android_deps/build.gradle.
|
||||
- visibility = [ ":*" ]
|
||||
- deps = [
|
||||
- ":google_play_services_basement_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
java_prebuilt("com_google_code_findbugs_jsr305_java") {
|
||||
jar_path = "libs/com_google_code_findbugs_jsr305/jsr305-1.3.9.jar"
|
||||
output_name = "com_google_code_findbugs_jsr305"
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -0,0 +1,749 @@
|
|||
From: Wengling Chen <feiyu2817@gmail.com>
|
||||
Date: Sat, 2 Nov 2019 07:56:44 +0100
|
||||
Subject: Remove dependency on com.google.android.gms.gcm
|
||||
|
||||
It also disalbes Snippets, auto-update of offline pages and launching browser from background service.
|
||||
The snippets are already disabled in native codes, this will disable it on Java level.
|
||||
---
|
||||
chrome/android/BUILD.gn | 3 -
|
||||
.../chrome/browser/BackgroundSyncLauncher.java | 17 +----
|
||||
.../chrome/browser/ChromeBackgroundService.java | 79 +------------------
|
||||
.../invalidation/InvalidationController.java | 1 +
|
||||
.../browser/ntp/snippets/SnippetsLauncher.java | 2 +-
|
||||
.../services/gcm/ChromeGcmListenerService.java | 58 +-------------
|
||||
components/background_task_scheduler/BUILD.gn | 3 -
|
||||
.../BackgroundTaskGcmTaskService.java | 63 +--------------
|
||||
.../BackgroundTaskSchedulerFactory.java | 6 +-
|
||||
.../BackgroundTaskSchedulerGcmNetworkManager.java | 14 +---
|
||||
third_party/android_deps/BUILD.gn | 15 ----
|
||||
third_party/cacheinvalidation/BUILD.gn | 1 -
|
||||
.../client/android2/AndroidManifestUpdatedGcm.xml | 20 -----
|
||||
.../android2/channel/AndroidGcmController.java | 42 +---------
|
||||
.../channel/AndroidInstanceIDListenerService.java | 13 +---
|
||||
.../channel/GcmRegistrationTaskService.java | 89 +---------------------
|
||||
16 files changed, 14 insertions(+), 412 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
|
||||
--- a/chrome/android/BUILD.gn
|
||||
+++ b/chrome/android/BUILD.gn
|
||||
@@ -272,7 +272,6 @@ android_library("chrome_java") {
|
||||
"$google_play_services_package:google_play_services_cast_framework_java",
|
||||
"$google_play_services_package:google_play_services_cast_java",
|
||||
"$google_play_services_package:google_play_services_fido_java",
|
||||
- "$google_play_services_package:google_play_services_gcm_java",
|
||||
"$google_play_services_package:google_play_services_iid_java",
|
||||
"$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
@@ -798,7 +797,6 @@ android_library("chrome_test_java") {
|
||||
"$google_play_services_package:google_play_services_cast_framework_java",
|
||||
"$google_play_services_package:google_play_services_cast_java",
|
||||
"$google_play_services_package:google_play_services_fido_java",
|
||||
- "$google_play_services_package:google_play_services_gcm_java",
|
||||
"$google_play_services_package:google_play_services_iid_java",
|
||||
"$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
@@ -1543,7 +1541,6 @@ android_library("browser_java_test_support") {
|
||||
]
|
||||
deps = [
|
||||
":chrome_java",
|
||||
- "$google_play_services_package:google_play_services_gcm_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//chrome/android/public/profiles:java",
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/BackgroundSyncLauncher.java
|
||||
@@ -41,7 +41,7 @@ public class BackgroundSyncLauncher {
|
||||
* Automatic GCM use is disabled by tests, and also by this class if it is determined on
|
||||
* creation that the installed Play Services library is out of date.
|
||||
*/
|
||||
- private static boolean sGCMEnabled = true;
|
||||
+ private static boolean sGCMEnabled;
|
||||
|
||||
@VisibleForTesting
|
||||
protected AsyncTask<Void> mLaunchBrowserIfStoppedTask;
|
||||
@@ -140,20 +140,7 @@ public class BackgroundSyncLauncher {
|
||||
*/
|
||||
@CalledByNative
|
||||
private static boolean shouldDisableBackgroundSync() {
|
||||
- // Check to see if Play Services is up to date, and disable GCM if not.
|
||||
- // This will not automatically set {@link sGCMEnabled} to true, in case it has been
|
||||
- // disabled in tests.
|
||||
- if (sGCMEnabled) {
|
||||
- boolean isAvailable = true;
|
||||
- if (!ExternalAuthUtils.canUseGooglePlayServices()) {
|
||||
- setGCMEnabled(false);
|
||||
- Log.i(TAG, "Disabling Background Sync because Play Services is not up to date.");
|
||||
- isAvailable = false;
|
||||
- }
|
||||
- RecordHistogram.recordBooleanHistogram(
|
||||
- "BackgroundSync.LaunchTask.PlayServicesAvailable", isAvailable);
|
||||
- }
|
||||
- return !sGCMEnabled;
|
||||
+ return true;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java
|
||||
@@ -6,10 +6,6 @@ package org.chromium.chrome.browser;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
-import com.google.android.gms.gcm.GcmNetworkManager;
|
||||
-import com.google.android.gms.gcm.GcmTaskService;
|
||||
-import com.google.android.gms.gcm.TaskParams;
|
||||
-
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.base.VisibleForTesting;
|
||||
import org.chromium.base.library_loader.ProcessInitException;
|
||||
@@ -27,67 +23,9 @@ import org.chromium.content_public.browser.UiThreadTaskTraits;
|
||||
* browser needs to be launched for scheduled tasks, or in response to changing network or power
|
||||
* conditions.
|
||||
*/
|
||||
-public class ChromeBackgroundService extends GcmTaskService {
|
||||
+public class ChromeBackgroundService {
|
||||
private static final String TAG = "BackgroundService";
|
||||
|
||||
- @Override
|
||||
- @VisibleForTesting
|
||||
- public int onRunTask(final TaskParams params) {
|
||||
- final String taskTag = params.getTag();
|
||||
- final Context context = this;
|
||||
- PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> {
|
||||
- switch (taskTag) {
|
||||
- case BackgroundSyncLauncher.TASK_TAG:
|
||||
- handleBackgroundSyncEvent(context, taskTag);
|
||||
- break;
|
||||
-
|
||||
- case OfflinePageUtils.TASK_TAG:
|
||||
- // Offline pages are migrating to BackgroundTaskScheduler, therefore getting
|
||||
- // a task through ChromeBackgroundSerivce should cause a rescheduling using
|
||||
- // the new component.
|
||||
- rescheduleOfflinePages();
|
||||
- break;
|
||||
-
|
||||
- case SnippetsLauncher.TASK_TAG_WIFI:
|
||||
- case SnippetsLauncher.TASK_TAG_FALLBACK:
|
||||
- handleSnippetsOnPersistentSchedulerWakeUp(context, taskTag);
|
||||
- break;
|
||||
-
|
||||
- // This is only for tests.
|
||||
- case ServiceManagerStartupUtils.TASK_TAG:
|
||||
- handleServicificationStartupTask(context, taskTag);
|
||||
- break;
|
||||
-
|
||||
- default:
|
||||
- Log.i(TAG, "Unknown task tag " + taskTag);
|
||||
- break;
|
||||
- }
|
||||
- });
|
||||
-
|
||||
- return GcmNetworkManager.RESULT_SUCCESS;
|
||||
- }
|
||||
-
|
||||
- private void handleBackgroundSyncEvent(Context context, String tag) {
|
||||
- if (!BackgroundSyncLauncher.hasInstance()) {
|
||||
- // Start the browser. The browser's BackgroundSyncManager (for the active profile) will
|
||||
- // start, check the network, and run any necessary sync events. This task runs with a
|
||||
- // wake lock, but has a three minute timeout, so we need to start the browser in its
|
||||
- // own task.
|
||||
- // TODO(jkarlin): Protect the browser sync event with a wake lock.
|
||||
- // See crbug.com/486020.
|
||||
- launchBrowser(context, tag);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private void handleSnippetsOnPersistentSchedulerWakeUp(Context context, String tag) {
|
||||
- if (!SnippetsLauncher.hasInstance()) launchBrowser(context, tag);
|
||||
- snippetsOnPersistentSchedulerWakeUp();
|
||||
- }
|
||||
-
|
||||
- private void handleServicificationStartupTask(Context context, String tag) {
|
||||
- launchBrowser(context, tag);
|
||||
- }
|
||||
-
|
||||
@VisibleForTesting
|
||||
protected void snippetsOnPersistentSchedulerWakeUp() {
|
||||
SnippetsBridge.onPersistentSchedulerWakeUp();
|
||||
@@ -115,23 +53,8 @@ public class ChromeBackgroundService extends GcmTaskService {
|
||||
protected void rescheduleBackgroundSyncTasksOnUpgrade() {
|
||||
}
|
||||
|
||||
- private void handleSnippetsOnBrowserUpgraded() {
|
||||
- if (SnippetsLauncher.shouldNotifyOnBrowserUpgraded()) {
|
||||
- if (!SnippetsLauncher.hasInstance()) {
|
||||
- launchBrowser(this, /*tag=*/""); // The |tag| doesn't matter here.
|
||||
- }
|
||||
- snippetsOnBrowserUpgraded();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
/** Reschedules offline pages (using appropriate version of Background Task Scheduler). */
|
||||
protected void rescheduleOfflinePages() {
|
||||
BackgroundScheduler.getInstance().reschedule();
|
||||
}
|
||||
-
|
||||
- @Override
|
||||
- public void onInitializeTasks() {
|
||||
- rescheduleBackgroundSyncTasksOnUpgrade();
|
||||
- handleSnippetsOnBrowserUpgraded();
|
||||
- }
|
||||
}
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/invalidation/InvalidationController.java b/chrome/android/java/src/org/chromium/chrome/browser/invalidation/InvalidationController.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/invalidation/InvalidationController.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/invalidation/InvalidationController.java
|
||||
@@ -167,6 +167,7 @@ public class InvalidationController implements ApplicationStatus.ApplicationStat
|
||||
|
||||
// Ensure GCM has been initialized.
|
||||
ensureGcmIsInitialized();
|
||||
+ if (!mGcmInitialized) return;
|
||||
|
||||
// Do not apply changes to {@link #mSessionInvalidationsEnabled} yet because the timer task
|
||||
// may be scheduled far into the future.
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetsLauncher.java
|
||||
@@ -35,7 +35,7 @@ public class SnippetsLauncher {
|
||||
// If it is non-null then the browser is running.
|
||||
private static SnippetsLauncher sInstance;
|
||||
|
||||
- private boolean mGCMEnabled = true;
|
||||
+ private boolean mGCMEnabled;
|
||||
|
||||
/**
|
||||
* Create a SnippetsLauncher object, which is owned by C++.
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java b/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/ChromeGcmListenerService.java
|
||||
@@ -11,7 +11,6 @@ import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
|
||||
-import com.google.android.gms.gcm.GcmListenerService;
|
||||
import com.google.ipc.invalidation.ticl.android2.channel.AndroidGcmController;
|
||||
|
||||
import org.chromium.base.ContextUtils;
|
||||
@@ -35,62 +34,9 @@ import org.chromium.content_public.browser.UiThreadTaskTraits;
|
||||
/**
|
||||
* Receives Downstream messages and status of upstream messages from GCM.
|
||||
*/
|
||||
-public class ChromeGcmListenerService extends GcmListenerService {
|
||||
+public class ChromeGcmListenerService {
|
||||
private static final String TAG = "ChromeGcmListener";
|
||||
|
||||
- @Override
|
||||
- public void onCreate() {
|
||||
- ProcessInitializationHandler.getInstance().initializePreNative();
|
||||
- super.onCreate();
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void onMessageReceived(final String from, final Bundle data) {
|
||||
- boolean hasCollapseKey = !TextUtils.isEmpty(data.getString("collapse_key"));
|
||||
- GcmUma.recordDataMessageReceived(ContextUtils.getApplicationContext(), hasCollapseKey);
|
||||
-
|
||||
- String invalidationSenderId = AndroidGcmController.get(this).getSenderId();
|
||||
- if (from.equals(invalidationSenderId)) {
|
||||
- AndroidGcmController.get(this).onMessageReceived(data);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- // Dispatch the message to the GCM Driver for native features.
|
||||
- PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> {
|
||||
- GCMMessage message = null;
|
||||
- try {
|
||||
- message = new GCMMessage(from, data);
|
||||
- } catch (IllegalArgumentException e) {
|
||||
- Log.e(TAG, "Received an invalid GCM Message", e);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- scheduleOrDispatchMessageToDriver(message);
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void onMessageSent(String msgId) {
|
||||
- Log.d(TAG, "Message sent successfully. Message id: " + msgId);
|
||||
- GcmUma.recordGcmUpstreamHistogram(
|
||||
- ContextUtils.getApplicationContext(), GcmUma.UMA_UPSTREAM_SUCCESS);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void onSendError(String msgId, String error) {
|
||||
- Log.w(TAG, "Error in sending message. Message id: " + msgId + " Error: " + error);
|
||||
- GcmUma.recordGcmUpstreamHistogram(
|
||||
- ContextUtils.getApplicationContext(), GcmUma.UMA_UPSTREAM_SEND_FAILED);
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void onDeletedMessages() {
|
||||
- // TODO(johnme): Ask GCM to include the subtype in this event.
|
||||
- Log.w(TAG, "Push messages were deleted, but we can't tell the Service Worker as we don't"
|
||||
- + "know what subtype (app ID) it occurred for.");
|
||||
- GcmUma.recordDeletedMessages(ContextUtils.getApplicationContext());
|
||||
- }
|
||||
-
|
||||
/**
|
||||
* Returns if we deliver the GCMMessage with a background service by calling
|
||||
* Context#startService. This will only work if Android has put us in a whitelist to allow
|
||||
@@ -225,8 +171,6 @@ public class ChromeGcmListenerService extends GcmListenerService {
|
||||
|
||||
try {
|
||||
ChromeBrowserInitializer.getInstance(applicationContext).handleSynchronousStartup();
|
||||
- GCMDriver.dispatchMessage(message);
|
||||
-
|
||||
} catch (ProcessInitException e) {
|
||||
Log.e(TAG, "ProcessInitException while starting the browser process");
|
||||
|
||||
diff --git a/components/background_task_scheduler/BUILD.gn b/components/background_task_scheduler/BUILD.gn
|
||||
--- a/components/background_task_scheduler/BUILD.gn
|
||||
+++ b/components/background_task_scheduler/BUILD.gn
|
||||
@@ -54,7 +54,6 @@ if (is_android) {
|
||||
":scheduled_task_java",
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_gcm_java",
|
||||
"$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//content/public/android:content_java",
|
||||
@@ -78,7 +77,6 @@ if (is_android) {
|
||||
":background_task_scheduler_task_ids_java",
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_gcm_java",
|
||||
"$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
@@ -109,7 +107,6 @@ if (is_android) {
|
||||
"$google_play_services_package:google_play_services_auth_base_java",
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_gcm_java",
|
||||
"$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
diff --git a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskGcmTaskService.java b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskGcmTaskService.java
|
||||
--- a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskGcmTaskService.java
|
||||
+++ b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskGcmTaskService.java
|
||||
@@ -6,10 +6,6 @@ package org.chromium.components.background_task_scheduler;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
-import com.google.android.gms.gcm.GcmNetworkManager;
|
||||
-import com.google.android.gms.gcm.GcmTaskService;
|
||||
-import com.google.android.gms.gcm.TaskParams;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.base.ThreadUtils;
|
||||
@@ -20,7 +16,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/** Delegates calls out to various tasks that need to run in the background. */
|
||||
-public class BackgroundTaskGcmTaskService extends GcmTaskService {
|
||||
+public class BackgroundTaskGcmTaskService {
|
||||
private static final String TAG = "BkgrdTaskGcmTS";
|
||||
|
||||
private BackgroundTaskSchedulerGcmNetworkManager.Clock mClock = System::currentTimeMillis;
|
||||
@@ -90,63 +86,6 @@ public class BackgroundTaskGcmTaskService extends GcmTaskService {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public int onRunTask(TaskParams params) {
|
||||
- final TaskParameters taskParams =
|
||||
- BackgroundTaskSchedulerGcmNetworkManager.getTaskParametersFromTaskParams(params);
|
||||
-
|
||||
- final BackgroundTask backgroundTask =
|
||||
- BackgroundTaskSchedulerFactory.getBackgroundTaskFromTaskId(taskParams.getTaskId());
|
||||
- if (backgroundTask == null) {
|
||||
- Log.w(TAG, "Failed to start task. Could not instantiate BackgroundTask class.");
|
||||
- // Cancel task if the BackgroundTask class is not found anymore. We assume this means
|
||||
- // that the task has been deprecated.
|
||||
- BackgroundTaskSchedulerFactory.getScheduler().cancel(
|
||||
- ContextUtils.getApplicationContext(), taskParams.getTaskId());
|
||||
- return GcmNetworkManager.RESULT_FAILURE;
|
||||
- }
|
||||
-
|
||||
- if (BackgroundTaskSchedulerGcmNetworkManager.didTaskExpire(
|
||||
- params, mClock.currentTimeMillis())) {
|
||||
- BackgroundTaskSchedulerUma.getInstance().reportTaskExpired(taskParams.getTaskId());
|
||||
- return GcmNetworkManager.RESULT_FAILURE;
|
||||
- }
|
||||
-
|
||||
- final Waiter waiter = new Waiter(Waiter.MAX_TIMEOUT_SECONDS);
|
||||
-
|
||||
- final AtomicBoolean taskNeedsBackgroundProcessing = new AtomicBoolean();
|
||||
- ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
||||
- @Override
|
||||
- public void run() {
|
||||
- BackgroundTaskSchedulerUma.getInstance().reportTaskStarted(taskParams.getTaskId());
|
||||
- taskNeedsBackgroundProcessing.set(
|
||||
- backgroundTask.onStartTask(ContextUtils.getApplicationContext(), taskParams,
|
||||
- new TaskFinishedCallbackGcmTaskService(waiter)));
|
||||
- }
|
||||
- });
|
||||
-
|
||||
- if (!taskNeedsBackgroundProcessing.get()) return GcmNetworkManager.RESULT_SUCCESS;
|
||||
-
|
||||
- waiter.startWaiting();
|
||||
-
|
||||
- if (waiter.isRescheduleNeeded()) return GcmNetworkManager.RESULT_RESCHEDULE;
|
||||
- if (!waiter.hasTaskTimedOut()) return GcmNetworkManager.RESULT_SUCCESS;
|
||||
-
|
||||
- final AtomicBoolean taskNeedsRescheduling = new AtomicBoolean();
|
||||
- ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
||||
- @Override
|
||||
- public void run() {
|
||||
- BackgroundTaskSchedulerUma.getInstance().reportTaskStopped(taskParams.getTaskId());
|
||||
- taskNeedsRescheduling.set(backgroundTask.onStopTask(
|
||||
- ContextUtils.getApplicationContext(), taskParams));
|
||||
- }
|
||||
- });
|
||||
-
|
||||
- if (taskNeedsRescheduling.get()) return GcmNetworkManager.RESULT_RESCHEDULE;
|
||||
-
|
||||
- return GcmNetworkManager.RESULT_SUCCESS;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
public void onInitializeTasks() {
|
||||
// Ignore the event on OSs supporting JobScheduler.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) return;
|
||||
diff --git a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerFactory.java b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerFactory.java
|
||||
--- a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerFactory.java
|
||||
+++ b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerFactory.java
|
||||
@@ -17,11 +17,7 @@ public final class BackgroundTaskSchedulerFactory {
|
||||
private static BackgroundTaskFactory sBackgroundTaskFactory;
|
||||
|
||||
static BackgroundTaskSchedulerDelegate getSchedulerDelegateForSdk(int sdkInt) {
|
||||
- if (sdkInt >= Build.VERSION_CODES.M) {
|
||||
- return new BackgroundTaskSchedulerJobService();
|
||||
- } else {
|
||||
- return new BackgroundTaskSchedulerGcmNetworkManager();
|
||||
- }
|
||||
+ return new BackgroundTaskSchedulerJobService(); /* minSDK is 24 */
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerGcmNetworkManager.java b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerGcmNetworkManager.java
|
||||
--- a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerGcmNetworkManager.java
|
||||
+++ b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerGcmNetworkManager.java
|
||||
@@ -18,7 +18,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* An implementation of {@link BackgroundTaskSchedulerDelegate} that uses the Play Services
|
||||
* {@link GcmNetworkManager} to schedule jobs.
|
||||
*/
|
||||
-class BackgroundTaskSchedulerGcmNetworkManager implements BackgroundTaskSchedulerDelegate {
|
||||
+class BackgroundTaskSchedulerGcmNetworkManager {
|
||||
private static final String TAG = "BkgrdTaskSchedGcmNM";
|
||||
|
||||
/** Delta time for expiration checks, after the end time. */
|
||||
@@ -34,18 +34,6 @@ class BackgroundTaskSchedulerGcmNetworkManager implements BackgroundTaskSchedule
|
||||
sClock = clock;
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public boolean schedule(Context context, @NonNull TaskInfo taskInfo) {
|
||||
- ThreadUtils.assertOnUiThread();
|
||||
-
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void cancel(Context context, int taskId) {
|
||||
- ThreadUtils.assertOnUiThread();
|
||||
- }
|
||||
-
|
||||
private static String taskIdToTaskTag(int taskId) {
|
||||
return Integer.toString(taskId);
|
||||
}
|
||||
diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn
|
||||
--- a/third_party/android_deps/BUILD.gn
|
||||
+++ b/third_party/android_deps/BUILD.gn
|
||||
@@ -844,21 +844,6 @@ android_aar_prebuilt("google_play_services_fido_java") {
|
||||
}
|
||||
|
||||
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_gcm_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_gcm/play-services-gcm-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_gcm/com_google_android_gms_play_services_gcm.info"
|
||||
- deps = [
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_iid_java",
|
||||
- ":google_play_services_stats_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
android_aar_prebuilt("google_play_services_iid_java") {
|
||||
aar_path = "libs/com_google_android_gms_play_services_iid/play-services-iid-15.0.1.aar"
|
||||
info_path = "libs/com_google_android_gms_play_services_iid/com_google_android_gms_play_services_iid.info"
|
||||
diff --git a/third_party/cacheinvalidation/BUILD.gn b/third_party/cacheinvalidation/BUILD.gn
|
||||
--- a/third_party/cacheinvalidation/BUILD.gn
|
||||
+++ b/third_party/cacheinvalidation/BUILD.gn
|
||||
@@ -137,7 +137,6 @@ if (is_android) {
|
||||
jacoco_never_instrument = true
|
||||
deps = [
|
||||
":cacheinvalidation_proto_java",
|
||||
- "$google_play_services_package:google_play_services_gcm_java",
|
||||
"$google_play_services_package:google_play_services_iid_java",
|
||||
"$google_play_services_package:google_play_services_tasks_java",
|
||||
"//base:base_java",
|
||||
diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifestUpdatedGcm.xml b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifestUpdatedGcm.xml
|
||||
--- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifestUpdatedGcm.xml
|
||||
+++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/external/client/android2/AndroidManifestUpdatedGcm.xml
|
||||
@@ -24,17 +24,6 @@
|
||||
<receiver android:exported="false"
|
||||
android:name="com.google.ipc.invalidation.ticl2.android2.AndroidInternalScheduler$AlarmReceiver"/>
|
||||
|
||||
- <!-- GCM Broadcast Receiver -->
|
||||
- <receiver android:exported="true"
|
||||
- android:name="com.google.android.gms.gcm.GcmReceiver"
|
||||
- android:permission="com.google.android.c2dm.permission.SEND">
|
||||
- <intent-filter>
|
||||
- <action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||
- <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
||||
- <category android:name="com.google.ipc.invalidation.client2.android2"/>
|
||||
- </intent-filter>
|
||||
- </receiver>
|
||||
-
|
||||
<!-- InstanceID Listener Service -->
|
||||
<service android:exported="false"
|
||||
android:name="com.google.ipc.invalidation.ticl2.android2.channel.AndroidInstanceIDListenerService">
|
||||
@@ -42,14 +31,5 @@
|
||||
<action android:name="com.google.android.gms.iid.InstanceID"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
-
|
||||
- <!-- GcmTaskService for registration -->
|
||||
- <service android:name="com.google.ipc.invalidation.ticl2.android2.channel.GcmRegistrationTaskService"
|
||||
- android:exported="true"
|
||||
- android:permission="com.google.android.gms.permission.BIND_NETWORK_TASK_SERVICE" >
|
||||
- <intent-filter>
|
||||
- <action android:name="com.google.android.gms.gcm.ACTION_TASK_READY" />
|
||||
- </intent-filter>
|
||||
- </service>
|
||||
</application>
|
||||
</manifest>
|
||||
diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidGcmController.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidGcmController.java
|
||||
--- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidGcmController.java
|
||||
+++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidGcmController.java
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.google.ipc.invalidation.ticl.android2.channel;
|
||||
|
||||
-import com.google.android.gms.gcm.GcmNetworkManager;
|
||||
-import com.google.android.gms.gcm.OneoffTask;
|
||||
import com.google.ipc.invalidation.common.GcmSharedConstants;
|
||||
import com.google.ipc.invalidation.external.client.SystemResources.Logger;
|
||||
import com.google.ipc.invalidation.external.client.android.service.AndroidLogger;
|
||||
@@ -50,7 +48,7 @@ public class AndroidGcmController {
|
||||
|
||||
private static AndroidGcmController androidGcmController;
|
||||
|
||||
- private GcmNetworkManager gcmNetworkManager;
|
||||
+// private GcmNetworkManager gcmNetworkManager;
|
||||
|
||||
private Context context;
|
||||
|
||||
@@ -64,33 +62,13 @@ public class AndroidGcmController {
|
||||
public static AndroidGcmController get(Context context) {
|
||||
synchronized (lock) {
|
||||
if (androidGcmController == null) {
|
||||
- androidGcmController =
|
||||
- new AndroidGcmController(context, GcmNetworkManager.getInstance(context));
|
||||
+ androidGcmController = null;
|
||||
}
|
||||
}
|
||||
return androidGcmController;
|
||||
}
|
||||
|
||||
/**
|
||||
- * Override AndroidGcmController with a custom GcmNetworkManager in tests. This overrides the
|
||||
- * existing instance of AndroidGcmController if any.
|
||||
- *
|
||||
- * @param context the application context.
|
||||
- * @param gcmNetworkManager the custom GcmNetworkManager to use.
|
||||
- */
|
||||
- public static void overrideAndroidGcmControllerForTests(
|
||||
- Context context, GcmNetworkManager gcmNetworkManager) {
|
||||
- synchronized (lock) {
|
||||
- androidGcmController = new AndroidGcmController(context, gcmNetworkManager);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private AndroidGcmController(Context context, GcmNetworkManager gcmNetworkManager) {
|
||||
- this.context = context;
|
||||
- this.gcmNetworkManager = gcmNetworkManager;
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
* Returns true if no registration token is stored or the current application version is higher
|
||||
* than the version for the token stored.
|
||||
*/
|
||||
@@ -142,21 +120,7 @@ public class AndroidGcmController {
|
||||
return;
|
||||
}
|
||||
|
||||
- OneoffTask registrationTask =
|
||||
- new OneoffTask.Builder()
|
||||
- .setExecutionWindow(0, 1)
|
||||
- .setTag(AndroidChannelConstants.GCM_REGISTRATION_TASK_SERVICE_TAG)
|
||||
- .setService(GcmRegistrationTaskService.class)
|
||||
- .build();
|
||||
-
|
||||
- try {
|
||||
- gcmNetworkManager.schedule(registrationTask);
|
||||
- } catch (IllegalArgumentException exception) {
|
||||
- // Scheduling the service can throw an exception due to a framework error on Android when
|
||||
- // the the look up for the GCMTaskService being scheduled to be run fails.
|
||||
- // See crbug/548314.
|
||||
- logger.warning("Failed to schedule GCM registration task. Exception: %s", exception);
|
||||
- }
|
||||
+ logger.warning("Failed to schedule GCM registration task.");
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidInstanceIDListenerService.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidInstanceIDListenerService.java
|
||||
--- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidInstanceIDListenerService.java
|
||||
+++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/AndroidInstanceIDListenerService.java
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.google.ipc.invalidation.ticl.android2.channel;
|
||||
|
||||
-import com.google.android.gms.iid.InstanceIDListenerService;
|
||||
import com.google.ipc.invalidation.external.client.SystemResources.Logger;
|
||||
import com.google.ipc.invalidation.external.client.android.service.AndroidLogger;
|
||||
|
||||
@@ -23,16 +22,6 @@ import com.google.ipc.invalidation.external.client.android.service.AndroidLogger
|
||||
* Implementation of {@link InstanceIDListenerService} to receive notifications from GCM to
|
||||
* update the registration token.
|
||||
*/
|
||||
-public class AndroidInstanceIDListenerService extends InstanceIDListenerService {
|
||||
+public class AndroidInstanceIDListenerService {
|
||||
private static final Logger logger = AndroidLogger.forTag("InstanceIDListener");
|
||||
-
|
||||
- /**
|
||||
- * Called when the token needs to updated. {@link AndroidGcmController#fetchToken} clears the
|
||||
- * current token and schedules a task to fetch a new token.
|
||||
- */
|
||||
- @Override
|
||||
- public void onTokenRefresh() {
|
||||
- logger.info("Received token refresh request");
|
||||
- AndroidGcmController.get(this).fetchToken();
|
||||
- }
|
||||
}
|
||||
diff --git a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/GcmRegistrationTaskService.java b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/GcmRegistrationTaskService.java
|
||||
--- a/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/GcmRegistrationTaskService.java
|
||||
+++ b/third_party/cacheinvalidation/src/java/com/google/ipc/invalidation/ticl/android2/channel/GcmRegistrationTaskService.java
|
||||
@@ -15,11 +15,6 @@
|
||||
*/
|
||||
package com.google.ipc.invalidation.ticl.android2.channel;
|
||||
|
||||
-import com.google.android.gms.gcm.GcmNetworkManager;
|
||||
-import com.google.android.gms.gcm.GcmTaskService;
|
||||
-import com.google.android.gms.gcm.GoogleCloudMessaging;
|
||||
-import com.google.android.gms.gcm.TaskParams;
|
||||
-import com.google.android.gms.iid.InstanceID;
|
||||
import com.google.ipc.invalidation.common.GcmSharedConstants;
|
||||
import com.google.ipc.invalidation.external.client.SystemResources.Logger;
|
||||
import com.google.ipc.invalidation.external.client.android.service.AndroidLogger;
|
||||
@@ -42,88 +37,6 @@ import java.io.IOException;
|
||||
* failure to fetch the token, the task is rescheduled using the GcmNetworkManager which uses
|
||||
* exponential back-offs to control when the task is executed.
|
||||
*/
|
||||
-public class GcmRegistrationTaskService extends GcmTaskService {
|
||||
+public class GcmRegistrationTaskService {
|
||||
private static final Logger logger = AndroidLogger.forTag("RegistrationTaskService");
|
||||
-
|
||||
- public InstanceID getInstanceID(Context context) {
|
||||
- return InstanceID.getInstance(context);
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Called when the task is ready to be executed. Registers with GCM using
|
||||
- * {@link InstanceID#getToken} and stores the registration token.
|
||||
- *
|
||||
- * <p>Returns {@link GcmNetworkManager#RESULT_SUCCESS} when the token is successfully retrieved.
|
||||
- * On failure {@link GcmNetworkManager#RESULT_RESCHEDULE} is used which reschedules the service
|
||||
- * to be executed again using exponential back-off.
|
||||
- */
|
||||
- @Override
|
||||
- public int onRunTask(TaskParams params) {
|
||||
- if (!AndroidChannelConstants.GCM_REGISTRATION_TASK_SERVICE_TAG.equals(params.getTag())) {
|
||||
- logger.warning("Unknown task received with tag: %s", params.getTag());
|
||||
- return GcmNetworkManager.RESULT_FAILURE;
|
||||
- }
|
||||
-
|
||||
- String senderId = GcmSharedConstants.GCM_UPDATED_SENDER_ID;
|
||||
- try {
|
||||
- String token = getInstanceID(this).getToken(
|
||||
- senderId, GoogleCloudMessaging.INSTANCE_ID_SCOPE, null);
|
||||
- storeToken(token);
|
||||
- return GcmNetworkManager.RESULT_SUCCESS;
|
||||
- } catch (IOException exception) {
|
||||
- logger.warning("Failed to get token for sender: %s. Exception : %s", senderId, exception);
|
||||
- return GcmNetworkManager.RESULT_RESCHEDULE;
|
||||
- } catch (SecurityException exception) {
|
||||
- // InstanceID#getToken occasionally throws a security exception when trying send the
|
||||
- // registration intent to GMSCore. Catching the exception here to prevent crashes.
|
||||
- logger.warning("Security exception when fetching token: %s", exception);
|
||||
- return GcmNetworkManager.RESULT_RESCHEDULE;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /** Stores the registration token and the current application version in Shared Preferences. */
|
||||
- private void storeToken(String token) {
|
||||
- AndroidChannelPreferences.setRegistrationToken(token);
|
||||
- AndroidChannelPreferences.setAppVersion(
|
||||
- CommonUtils.getPackageVersion(this, getPackageName()));
|
||||
- // Send the updated token to the server.
|
||||
- updateServer();
|
||||
- }
|
||||
-
|
||||
- /** Sends a message to the server to update the GCM registration token. */
|
||||
- private void updateServer() {
|
||||
- // Inform the sender service that the registration token has changed. If the sender service
|
||||
- // had buffered a message because no registration token was previously available, this intent
|
||||
- // will cause it to send that message.
|
||||
- Intent sendBuffered = new Intent();
|
||||
- final String ignoredData = "";
|
||||
- sendBuffered.putExtra(AndroidChannelConstants.MESSAGE_SENDER_SVC_GCM_REGID_CHANGE, ignoredData);
|
||||
-
|
||||
- // Select the sender service to use for upstream message.
|
||||
- if (AndroidChannelPreferences.getGcmChannelType() == GcmChannelType.GCM_UPSTREAM) {
|
||||
- String upstreamServiceClass = new AndroidTiclManifest(this).getGcmUpstreamServiceClass();
|
||||
- if (upstreamServiceClass == null) {
|
||||
- logger.warning("GcmUpstreamSenderService class not found.");
|
||||
- return;
|
||||
- }
|
||||
- sendBuffered.setClassName(this, upstreamServiceClass);
|
||||
- } else {
|
||||
- sendBuffered.setClass(this, AndroidMessageSenderService.class);
|
||||
- }
|
||||
- try {
|
||||
- startService(sendBuffered);
|
||||
- } catch (IllegalStateException exception) {
|
||||
- logger.warning("Unable to send buffered message(s): %s", exception);
|
||||
- }
|
||||
-
|
||||
- // Inform the Ticl service that the registration id has changed. This will cause it to send
|
||||
- // a message to the data center and update the GCM registration id stored at the data center.
|
||||
- Intent updateServer = ProtocolIntents.InternalDowncalls.newNetworkAddrChangeIntent();
|
||||
- updateServer.setClassName(this, new AndroidTiclManifest(this).getTiclServiceClass());
|
||||
- try {
|
||||
- startService(updateServer);
|
||||
- } catch (IllegalStateException exception) {
|
||||
- logger.warning("Unable to inform server about new registration id: %s", exception);
|
||||
- }
|
||||
- }
|
||||
}
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -0,0 +1,575 @@
|
|||
From: Wengling Chen <feiyu2817@gmail.com>
|
||||
Date: Fri, 1 Nov 2019 23:10:47 +0100
|
||||
Subject: Remove dependency on com.google.android.gms.vision,
|
||||
com.google.android.gms.clearcut, com.google.android.gms.phenotype
|
||||
|
||||
---
|
||||
services/BUILD.gn | 4 -
|
||||
services/shape_detection/BUILD.gn | 2 -
|
||||
.../shape_detection/BarcodeDetectionImpl.java | 114 +------------------
|
||||
.../BarcodeDetectionProviderImpl.java | 18 +--
|
||||
.../shape_detection/FaceDetectionImplGmsCore.java | 122 +--------------------
|
||||
.../shape_detection/TextDetectionImpl.java | 60 +---------
|
||||
third_party/android_deps/BUILD.gn | 66 -----------
|
||||
7 files changed, 10 insertions(+), 376 deletions(-)
|
||||
|
||||
diff --git a/services/BUILD.gn b/services/BUILD.gn
|
||||
--- a/services/BUILD.gn
|
||||
+++ b/services/BUILD.gn
|
||||
@@ -109,8 +109,6 @@ if (is_android) {
|
||||
deps = [
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_vision_common_java",
|
||||
- "$google_play_services_package:google_play_services_vision_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//base:base_junit_test_support",
|
||||
@@ -140,8 +138,6 @@ if (is_android) {
|
||||
deps = [
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_vision_common_java",
|
||||
- "$google_play_services_package:google_play_services_vision_java",
|
||||
"//base:base_java",
|
||||
"//base:base_java_test_support",
|
||||
"//mojo/public/java:base_java",
|
||||
diff --git a/services/shape_detection/BUILD.gn b/services/shape_detection/BUILD.gn
|
||||
--- a/services/shape_detection/BUILD.gn
|
||||
+++ b/services/shape_detection/BUILD.gn
|
||||
@@ -91,8 +91,6 @@ if (is_android) {
|
||||
deps = [
|
||||
"$google_play_services_package:google_play_services_base_java",
|
||||
"$google_play_services_package:google_play_services_basement_java",
|
||||
- "$google_play_services_package:google_play_services_vision_common_java",
|
||||
- "$google_play_services_package:google_play_services_vision_java",
|
||||
"//base:base_java",
|
||||
"//mojo/public/java:base_java",
|
||||
"//mojo/public/java:bindings_java",
|
||||
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java
|
||||
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java
|
||||
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionImpl.java
|
||||
@@ -8,10 +8,6 @@ import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.util.SparseArray;
|
||||
|
||||
-import com.google.android.gms.vision.Frame;
|
||||
-import com.google.android.gms.vision.barcode.Barcode;
|
||||
-import com.google.android.gms.vision.barcode.BarcodeDetector;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.gfx.mojom.PointF;
|
||||
@@ -28,50 +24,7 @@ import org.chromium.shape_detection.mojom.BarcodeFormat;
|
||||
public class BarcodeDetectionImpl implements BarcodeDetection {
|
||||
private static final String TAG = "BarcodeDetectionImpl";
|
||||
|
||||
- private BarcodeDetector mBarcodeDetector;
|
||||
-
|
||||
public BarcodeDetectionImpl(BarcodeDetectorOptions options) {
|
||||
- int formats = Barcode.ALL_FORMATS;
|
||||
- if (options.formats != null && options.formats.length > 0) {
|
||||
- formats = 0;
|
||||
- // Keep this list in sync with the constants defined in
|
||||
- // com.google.android.gms.vision.barcode.Barcode and the list of
|
||||
- // supported formats in BarcodeDetectionProviderImpl.
|
||||
- for (int i = 0; i < options.formats.length; ++i) {
|
||||
- if (options.formats[i] == BarcodeFormat.AZTEC) {
|
||||
- formats |= Barcode.AZTEC;
|
||||
- } else if (options.formats[i] == BarcodeFormat.CODE_128) {
|
||||
- formats |= Barcode.CODE_128;
|
||||
- } else if (options.formats[i] == BarcodeFormat.CODE_39) {
|
||||
- formats |= Barcode.CODE_39;
|
||||
- } else if (options.formats[i] == BarcodeFormat.CODE_93) {
|
||||
- formats |= Barcode.CODE_93;
|
||||
- } else if (options.formats[i] == BarcodeFormat.CODABAR) {
|
||||
- formats |= Barcode.CODABAR;
|
||||
- } else if (options.formats[i] == BarcodeFormat.DATA_MATRIX) {
|
||||
- formats |= Barcode.DATA_MATRIX;
|
||||
- } else if (options.formats[i] == BarcodeFormat.EAN_13) {
|
||||
- formats |= Barcode.EAN_13;
|
||||
- } else if (options.formats[i] == BarcodeFormat.EAN_8) {
|
||||
- formats |= Barcode.EAN_8;
|
||||
- } else if (options.formats[i] == BarcodeFormat.ITF) {
|
||||
- formats |= Barcode.ITF;
|
||||
- } else if (options.formats[i] == BarcodeFormat.PDF417) {
|
||||
- formats |= Barcode.PDF417;
|
||||
- } else if (options.formats[i] == BarcodeFormat.QR_CODE) {
|
||||
- formats |= Barcode.QR_CODE;
|
||||
- } else if (options.formats[i] == BarcodeFormat.UPC_A) {
|
||||
- formats |= Barcode.UPC_A;
|
||||
- } else if (options.formats[i] == BarcodeFormat.UPC_E) {
|
||||
- formats |= Barcode.UPC_E;
|
||||
- } else {
|
||||
- Log.e(TAG, "Unsupported barcode format hint: " + options.formats[i]);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- mBarcodeDetector = new BarcodeDetector.Builder(ContextUtils.getApplicationContext())
|
||||
- .setBarcodeFormats(formats)
|
||||
- .build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,47 +33,12 @@ public class BarcodeDetectionImpl implements BarcodeDetection {
|
||||
// on the device; this happens "fast", but it might have not completed,
|
||||
// bail in this case. Also, the API was disabled between and v.9.0 and
|
||||
// v.9.2, see https://developers.google.com/android/guides/releases.
|
||||
- if (!mBarcodeDetector.isOperational()) {
|
||||
- Log.e(TAG, "BarcodeDetector is not operational");
|
||||
- callback.call(new BarcodeDetectionResult[0]);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- Frame frame = BitmapUtils.convertToFrame(bitmapData);
|
||||
- if (frame == null) {
|
||||
- Log.e(TAG, "Error converting Mojom Bitmap to Frame");
|
||||
- callback.call(new BarcodeDetectionResult[0]);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- final SparseArray<Barcode> barcodes = mBarcodeDetector.detect(frame);
|
||||
-
|
||||
- BarcodeDetectionResult[] barcodeArray = new BarcodeDetectionResult[barcodes.size()];
|
||||
- for (int i = 0; i < barcodes.size(); i++) {
|
||||
- barcodeArray[i] = new BarcodeDetectionResult();
|
||||
- final Barcode barcode = barcodes.valueAt(i);
|
||||
- barcodeArray[i].rawValue = barcode.rawValue;
|
||||
- final Rect rect = barcode.getBoundingBox();
|
||||
- barcodeArray[i].boundingBox = new RectF();
|
||||
- barcodeArray[i].boundingBox.x = rect.left;
|
||||
- barcodeArray[i].boundingBox.y = rect.top;
|
||||
- barcodeArray[i].boundingBox.width = rect.width();
|
||||
- barcodeArray[i].boundingBox.height = rect.height();
|
||||
- final Point[] corners = barcode.cornerPoints;
|
||||
- barcodeArray[i].cornerPoints = new PointF[corners.length];
|
||||
- for (int j = 0; j < corners.length; j++) {
|
||||
- barcodeArray[i].cornerPoints[j] = new PointF();
|
||||
- barcodeArray[i].cornerPoints[j].x = corners[j].x;
|
||||
- barcodeArray[i].cornerPoints[j].y = corners[j].y;
|
||||
- }
|
||||
- barcodeArray[i].format = toBarcodeFormat(barcode.format);
|
||||
- }
|
||||
- callback.call(barcodeArray);
|
||||
+ Log.e(TAG, "BarcodeDetector is not operational");
|
||||
+ callback.call(new BarcodeDetectionResult[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
- mBarcodeDetector.release();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,34 +47,6 @@ public class BarcodeDetectionImpl implements BarcodeDetection {
|
||||
}
|
||||
|
||||
private int toBarcodeFormat(int format) {
|
||||
- switch (format) {
|
||||
- case Barcode.CODE_128:
|
||||
- return BarcodeFormat.CODE_128;
|
||||
- case Barcode.CODE_39:
|
||||
- return BarcodeFormat.CODE_39;
|
||||
- case Barcode.CODE_93:
|
||||
- return BarcodeFormat.CODE_93;
|
||||
- case Barcode.CODABAR:
|
||||
- return BarcodeFormat.CODABAR;
|
||||
- case Barcode.DATA_MATRIX:
|
||||
- return BarcodeFormat.DATA_MATRIX;
|
||||
- case Barcode.EAN_13:
|
||||
- return BarcodeFormat.EAN_13;
|
||||
- case Barcode.EAN_8:
|
||||
- return BarcodeFormat.EAN_8;
|
||||
- case Barcode.ITF:
|
||||
- return BarcodeFormat.ITF;
|
||||
- case Barcode.QR_CODE:
|
||||
- return BarcodeFormat.QR_CODE;
|
||||
- case Barcode.UPC_A:
|
||||
- return BarcodeFormat.UPC_A;
|
||||
- case Barcode.UPC_E:
|
||||
- return BarcodeFormat.UPC_E;
|
||||
- case Barcode.PDF417:
|
||||
- return BarcodeFormat.PDF417;
|
||||
- case Barcode.AZTEC:
|
||||
- return BarcodeFormat.AZTEC;
|
||||
- }
|
||||
return BarcodeFormat.UNKNOWN;
|
||||
}
|
||||
}
|
||||
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java
|
||||
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java
|
||||
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/BarcodeDetectionProviderImpl.java
|
||||
@@ -4,9 +4,6 @@
|
||||
|
||||
package org.chromium.shape_detection;
|
||||
|
||||
-import com.google.android.gms.common.ConnectionResult;
|
||||
-import com.google.android.gms.common.GoogleApiAvailability;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.mojo.bindings.InterfaceRequest;
|
||||
@@ -35,12 +32,6 @@ public class BarcodeDetectionProviderImpl implements BarcodeDetectionProvider {
|
||||
// Keep this list in sync with the constants defined in
|
||||
// com.google.android.gms.vision.barcode.Barcode and the format hints
|
||||
// supported by BarcodeDetectionImpl.
|
||||
- int[] supportedFormats = {BarcodeFormat.AZTEC, BarcodeFormat.CODE_128,
|
||||
- BarcodeFormat.CODE_39, BarcodeFormat.CODE_93, BarcodeFormat.CODABAR,
|
||||
- BarcodeFormat.DATA_MATRIX, BarcodeFormat.EAN_13, BarcodeFormat.EAN_8,
|
||||
- BarcodeFormat.ITF, BarcodeFormat.PDF417, BarcodeFormat.QR_CODE, BarcodeFormat.UPC_A,
|
||||
- BarcodeFormat.UPC_E};
|
||||
- callback.call(supportedFormats);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,12 +41,7 @@ public class BarcodeDetectionProviderImpl implements BarcodeDetectionProvider {
|
||||
public void onConnectionError(MojoException e) {}
|
||||
|
||||
public static BarcodeDetectionProvider create() {
|
||||
- if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(
|
||||
- ContextUtils.getApplicationContext())
|
||||
- != ConnectionResult.SUCCESS) {
|
||||
- Log.e(TAG, "Google Play Services not available");
|
||||
- return null;
|
||||
- }
|
||||
- return new BarcodeDetectionProviderImpl();
|
||||
+ Log.e(TAG, "Google Play Services not available");
|
||||
+ return null;
|
||||
}
|
||||
}
|
||||
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java
|
||||
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java
|
||||
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/FaceDetectionImplGmsCore.java
|
||||
@@ -7,11 +7,6 @@ package org.chromium.shape_detection;
|
||||
import android.graphics.PointF;
|
||||
import android.util.SparseArray;
|
||||
|
||||
-import com.google.android.gms.vision.Frame;
|
||||
-import com.google.android.gms.vision.face.Face;
|
||||
-import com.google.android.gms.vision.face.FaceDetector;
|
||||
-import com.google.android.gms.vision.face.Landmark;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.gfx.mojom.RectF;
|
||||
@@ -36,133 +31,20 @@ public class FaceDetectionImplGmsCore implements FaceDetection {
|
||||
private static final int MAX_EULER_Z = 15;
|
||||
private final int mMaxFaces;
|
||||
private final boolean mFastMode;
|
||||
- private final FaceDetector mFaceDetector;
|
||||
|
||||
FaceDetectionImplGmsCore(FaceDetectorOptions options) {
|
||||
- FaceDetector.Builder builder =
|
||||
- new FaceDetector.Builder(ContextUtils.getApplicationContext());
|
||||
mMaxFaces = Math.min(options.maxDetectedFaces, MAX_FACES);
|
||||
mFastMode = options.fastMode;
|
||||
-
|
||||
- try {
|
||||
- builder.setMode(mFastMode ? FaceDetector.FAST_MODE : FaceDetector.ACCURATE_MODE);
|
||||
- builder.setLandmarkType(FaceDetector.ALL_LANDMARKS);
|
||||
- if (mMaxFaces == 1) {
|
||||
- builder.setProminentFaceOnly(true);
|
||||
- }
|
||||
- } catch (IllegalArgumentException e) {
|
||||
- Log.e(TAG, "Unexpected exception " + e);
|
||||
- assert false;
|
||||
- }
|
||||
-
|
||||
- mFaceDetector = builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detect(org.chromium.skia.mojom.Bitmap bitmapData, DetectResponse callback) {
|
||||
- // The vision library will be downloaded the first time the API is used
|
||||
- // on the device; this happens "fast", but it might have not completed,
|
||||
- // bail in this case.
|
||||
- if (!mFaceDetector.isOperational()) {
|
||||
- Log.e(TAG, "FaceDetector is not operational");
|
||||
-
|
||||
- // Fallback to Android's FaceDetectionImpl.
|
||||
- FaceDetectorOptions options = new FaceDetectorOptions();
|
||||
- options.fastMode = mFastMode;
|
||||
- options.maxDetectedFaces = mMaxFaces;
|
||||
- FaceDetectionImpl detector = new FaceDetectionImpl(options);
|
||||
- detector.detect(bitmapData, callback);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- Frame frame = BitmapUtils.convertToFrame(bitmapData);
|
||||
- if (frame == null) {
|
||||
- Log.e(TAG, "Error converting Mojom Bitmap to Frame");
|
||||
- callback.call(new FaceDetectionResult[0]);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- final SparseArray<Face> faces = mFaceDetector.detect(frame);
|
||||
-
|
||||
- FaceDetectionResult[] faceArray = new FaceDetectionResult[faces.size()];
|
||||
- for (int i = 0; i < faces.size(); i++) {
|
||||
- faceArray[i] = new FaceDetectionResult();
|
||||
- final Face face = faces.valueAt(i);
|
||||
-
|
||||
- final List<Landmark> landmarks = face.getLandmarks();
|
||||
- ArrayList<org.chromium.shape_detection.mojom.Landmark> mojoLandmarks =
|
||||
- new ArrayList<org.chromium.shape_detection.mojom.Landmark>(landmarks.size());
|
||||
-
|
||||
- int leftEyeIndex = -1;
|
||||
- int rightEyeIndex = -1;
|
||||
- int bottomMouthIndex = -1;
|
||||
- for (int j = 0; j < landmarks.size(); j++) {
|
||||
- final Landmark landmark = landmarks.get(j);
|
||||
- final int landmarkType = landmark.getType();
|
||||
- if (landmarkType != Landmark.LEFT_EYE && landmarkType != Landmark.RIGHT_EYE
|
||||
- && landmarkType != Landmark.BOTTOM_MOUTH
|
||||
- && landmarkType != Landmark.NOSE_BASE) {
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- org.chromium.shape_detection.mojom.Landmark mojoLandmark =
|
||||
- new org.chromium.shape_detection.mojom.Landmark();
|
||||
- mojoLandmark.locations = new org.chromium.gfx.mojom.PointF[1];
|
||||
- mojoLandmark.locations[0] = new org.chromium.gfx.mojom.PointF();
|
||||
- mojoLandmark.locations[0].x = landmark.getPosition().x;
|
||||
- mojoLandmark.locations[0].y = landmark.getPosition().y;
|
||||
-
|
||||
- if (landmarkType == Landmark.LEFT_EYE) {
|
||||
- mojoLandmark.type = LandmarkType.EYE;
|
||||
- leftEyeIndex = j;
|
||||
- } else if (landmarkType == Landmark.RIGHT_EYE) {
|
||||
- mojoLandmark.type = LandmarkType.EYE;
|
||||
- rightEyeIndex = j;
|
||||
- } else if (landmarkType == Landmark.BOTTOM_MOUTH) {
|
||||
- mojoLandmark.type = LandmarkType.MOUTH;
|
||||
- bottomMouthIndex = j;
|
||||
- } else {
|
||||
- assert landmarkType == Landmark.NOSE_BASE;
|
||||
- mojoLandmark.type = LandmarkType.NOSE;
|
||||
- }
|
||||
- mojoLandmarks.add(mojoLandmark);
|
||||
- }
|
||||
- faceArray[i].landmarks = mojoLandmarks.toArray(
|
||||
- new org.chromium.shape_detection.mojom.Landmark[mojoLandmarks.size()]);
|
||||
-
|
||||
- final PointF corner = face.getPosition();
|
||||
- faceArray[i].boundingBox = new RectF();
|
||||
- if (leftEyeIndex != -1 && rightEyeIndex != -1
|
||||
- && Math.abs(face.getEulerZ()) < MAX_EULER_Z) {
|
||||
- // Tighter calculation of the bounding box because the GMScore
|
||||
- // and Android Face APIs give different results.
|
||||
- final PointF leftEyePoint = landmarks.get(leftEyeIndex).getPosition();
|
||||
- final PointF rightEyePoint = landmarks.get(rightEyeIndex).getPosition();
|
||||
- final float eyesDistance = leftEyePoint.x - rightEyePoint.x;
|
||||
- final float eyeMouthDistance = bottomMouthIndex != -1
|
||||
- ? landmarks.get(bottomMouthIndex).getPosition().y - leftEyePoint.y
|
||||
- : -1;
|
||||
- final PointF midEyePoint =
|
||||
- new PointF(corner.x + face.getWidth() / 2, leftEyePoint.y);
|
||||
- faceArray[i].boundingBox.x = 2 * rightEyePoint.x - midEyePoint.x;
|
||||
- faceArray[i].boundingBox.y = midEyePoint.y - eyesDistance;
|
||||
- faceArray[i].boundingBox.width = 2 * eyesDistance;
|
||||
- faceArray[i].boundingBox.height = eyeMouthDistance > eyesDistance
|
||||
- ? eyeMouthDistance + eyesDistance
|
||||
- : 2 * eyesDistance;
|
||||
- } else {
|
||||
- faceArray[i].boundingBox.x = corner.x;
|
||||
- faceArray[i].boundingBox.y = corner.y;
|
||||
- faceArray[i].boundingBox.width = face.getWidth();
|
||||
- faceArray[i].boundingBox.height = face.getHeight();
|
||||
- }
|
||||
- }
|
||||
- callback.call(faceArray);
|
||||
+ Log.e(TAG, "FaceDetector is not operational");
|
||||
+ callback.call(new FaceDetectionResult[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
- mFaceDetector.release();
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/services/shape_detection/android/java/src/org/chromium/shape_detection/TextDetectionImpl.java b/services/shape_detection/android/java/src/org/chromium/shape_detection/TextDetectionImpl.java
|
||||
--- a/services/shape_detection/android/java/src/org/chromium/shape_detection/TextDetectionImpl.java
|
||||
+++ b/services/shape_detection/android/java/src/org/chromium/shape_detection/TextDetectionImpl.java
|
||||
@@ -8,12 +8,6 @@ import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.util.SparseArray;
|
||||
|
||||
-import com.google.android.gms.common.ConnectionResult;
|
||||
-import com.google.android.gms.common.GoogleApiAvailability;
|
||||
-import com.google.android.gms.vision.Frame;
|
||||
-import com.google.android.gms.vision.text.TextBlock;
|
||||
-import com.google.android.gms.vision.text.TextRecognizer;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.gfx.mojom.PointF;
|
||||
@@ -29,58 +23,17 @@ import org.chromium.shape_detection.mojom.TextDetectionResult;
|
||||
public class TextDetectionImpl implements TextDetection {
|
||||
private static final String TAG = "TextDetectionImpl";
|
||||
|
||||
- private TextRecognizer mTextRecognizer;
|
||||
-
|
||||
public TextDetectionImpl() {
|
||||
- mTextRecognizer = new TextRecognizer.Builder(ContextUtils.getApplicationContext()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detect(org.chromium.skia.mojom.Bitmap bitmapData, DetectResponse callback) {
|
||||
- // The vision library will be downloaded the first time the API is used
|
||||
- // on the device; this happens "fast", but it might have not completed,
|
||||
- // bail in this case. Also, the API was disabled between and v.9.0 and
|
||||
- // v.9.2, see https://developers.google.com/android/guides/releases.
|
||||
- if (!mTextRecognizer.isOperational()) {
|
||||
- Log.e(TAG, "TextDetector is not operational");
|
||||
- callback.call(new TextDetectionResult[0]);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- Frame frame = BitmapUtils.convertToFrame(bitmapData);
|
||||
- if (frame == null) {
|
||||
- Log.e(TAG, "Error converting Mojom Bitmap to Frame");
|
||||
- callback.call(new TextDetectionResult[0]);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- final SparseArray<TextBlock> textBlocks = mTextRecognizer.detect(frame);
|
||||
-
|
||||
- TextDetectionResult[] detectedTextArray = new TextDetectionResult[textBlocks.size()];
|
||||
- for (int i = 0; i < textBlocks.size(); i++) {
|
||||
- detectedTextArray[i] = new TextDetectionResult();
|
||||
- final TextBlock textBlock = textBlocks.valueAt(i);
|
||||
- detectedTextArray[i].rawValue = textBlock.getValue();
|
||||
- final Rect rect = textBlock.getBoundingBox();
|
||||
- detectedTextArray[i].boundingBox = new RectF();
|
||||
- detectedTextArray[i].boundingBox.x = rect.left;
|
||||
- detectedTextArray[i].boundingBox.y = rect.top;
|
||||
- detectedTextArray[i].boundingBox.width = rect.width();
|
||||
- detectedTextArray[i].boundingBox.height = rect.height();
|
||||
- final Point[] corners = textBlock.getCornerPoints();
|
||||
- detectedTextArray[i].cornerPoints = new PointF[corners.length];
|
||||
- for (int j = 0; j < corners.length; j++) {
|
||||
- detectedTextArray[i].cornerPoints[j] = new PointF();
|
||||
- detectedTextArray[i].cornerPoints[j].x = corners[j].x;
|
||||
- detectedTextArray[i].cornerPoints[j].y = corners[j].y;
|
||||
- }
|
||||
- }
|
||||
- callback.call(detectedTextArray);
|
||||
+ Log.e(TAG, "TextDetector is not operational");
|
||||
+ callback.call(new TextDetectionResult[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
- mTextRecognizer.release();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,12 +42,7 @@ public class TextDetectionImpl implements TextDetection {
|
||||
}
|
||||
|
||||
public static TextDetection create() {
|
||||
- if (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(
|
||||
- ContextUtils.getApplicationContext())
|
||||
- != ConnectionResult.SUCCESS) {
|
||||
- Log.e(TAG, "Google Play Services not available");
|
||||
- return null;
|
||||
- }
|
||||
- return new TextDetectionImpl();
|
||||
+ Log.e(TAG, "Google Play Services not available");
|
||||
+ return null;
|
||||
}
|
||||
}
|
||||
diff --git a/third_party/android_deps/BUILD.gn b/third_party/android_deps/BUILD.gn
|
||||
--- a/third_party/android_deps/BUILD.gn
|
||||
+++ b/third_party/android_deps/BUILD.gn
|
||||
@@ -900,35 +900,6 @@ android_aar_prebuilt("google_play_services_tasks_java") {
|
||||
}
|
||||
|
||||
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_vision_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_vision/play-services-vision-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_vision/com_google_android_gms_play_services_vision.info"
|
||||
- deps = [
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_vision_common_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_vision_common_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_vision_common/play-services-vision-common-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_vision_common/com_google_android_gms_play_services_vision_common.info"
|
||||
- deps = [
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_clearcut_java",
|
||||
- ":google_play_services_flags_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
android_aar_prebuilt("com_google_android_material_material_java") {
|
||||
aar_path = "libs/com_google_android_material_material/material-1.0.0-rc02.aar"
|
||||
info_path = "libs/com_google_android_material_material/com_google_android_material_material.info"
|
||||
@@ -1528,25 +1499,6 @@ android_aar_prebuilt("com_android_support_versionedparcelable_java") {
|
||||
}
|
||||
|
||||
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_clearcut_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_clearcut/play-services-clearcut-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_clearcut/com_google_android_gms_play_services_clearcut.info"
|
||||
-
|
||||
- # To remove visibility constraint, add this dependency to
|
||||
- # //tools/android/roll/android_deps/build.gradle.
|
||||
- visibility = [ ":*" ]
|
||||
- deps = [
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_phenotype_java",
|
||||
- ":google_play_services_tasks_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
android_aar_prebuilt("google_play_services_flags_java") {
|
||||
aar_path = "libs/com_google_android_gms_play_services_flags/play-services-flags-15.0.1.aar"
|
||||
info_path = "libs/com_google_android_gms_play_services_flags/com_google_android_gms_play_services_flags.info"
|
||||
@@ -1564,24 +1516,6 @@ android_aar_prebuilt("google_play_services_flags_java") {
|
||||
}
|
||||
|
||||
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
-android_aar_prebuilt("google_play_services_phenotype_java") {
|
||||
- aar_path = "libs/com_google_android_gms_play_services_phenotype/play-services-phenotype-15.0.1.aar"
|
||||
- info_path = "libs/com_google_android_gms_play_services_phenotype/com_google_android_gms_play_services_phenotype.info"
|
||||
-
|
||||
- # To remove visibility constraint, add this dependency to
|
||||
- # //tools/android/roll/android_deps/build.gradle.
|
||||
- visibility = [ ":*" ]
|
||||
- deps = [
|
||||
- ":google_play_services_base_java",
|
||||
- ":google_play_services_basement_java",
|
||||
- ":google_play_services_tasks_java",
|
||||
- ]
|
||||
-
|
||||
- # Removing drawables from GMS .aars as they are unused bloat.
|
||||
- strip_drawables = true
|
||||
-}
|
||||
-
|
||||
-# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
|
||||
android_aar_prebuilt("google_play_services_places_placereport_java") {
|
||||
aar_path = "libs/com_google_android_gms_play_services_places_placereport/play-services-places-placereport-15.0.1.aar"
|
||||
info_path = "libs/com_google_android_gms_play_services_places_placereport/com_google_android_gms_play_services_places_placereport.info"
|
||||
--
|
||||
2.11.0
|
||||
|
496
build/patches/Remove-dependency-on-com.google.android.play.patch
Normal file
496
build/patches/Remove-dependency-on-com.google.android.play.patch
Normal file
|
@ -0,0 +1,496 @@
|
|||
From: Wengling Chen <feiyu2817@gmail.com>
|
||||
Date: Fri, 1 Nov 2019 23:01:41 +0100
|
||||
Subject: Remove dependency on com.google.android.play
|
||||
|
||||
---
|
||||
chrome/android/BUILD.gn | 1 -
|
||||
.../omaha/inline/FakeAppUpdateManagerWrapper.java | 60 +-----
|
||||
.../inline/InlineUpdateControllerFactory.java | 16 --
|
||||
.../omaha/inline/PlayInlineUpdateController.java | 226 +--------------------
|
||||
components/module_installer/android/BUILD.gn | 1 -
|
||||
third_party/google_android_play_core/BUILD.gn | 5 -
|
||||
6 files changed, 3 insertions(+), 306 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
|
||||
--- a/chrome/android/BUILD.gn
|
||||
+++ b/chrome/android/BUILD.gn
|
||||
@@ -387,7 +387,6 @@ android_library("chrome_java") {
|
||||
"//third_party/cct_dynamic_module:cct_dynamic_module_java",
|
||||
"//third_party/feed:feed_lib_proto_java",
|
||||
"//third_party/gif_player:gif_player_java",
|
||||
- "//third_party/google_android_play_core:com_google_android_play_core_java",
|
||||
"//third_party/jsr-305:jsr_305_javalib",
|
||||
"//ui/android:ui_java",
|
||||
"//ui/base/mojom:mojom_java",
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/FakeAppUpdateManagerWrapper.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/FakeAppUpdateManagerWrapper.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/FakeAppUpdateManagerWrapper.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/FakeAppUpdateManagerWrapper.java
|
||||
@@ -10,11 +10,6 @@ import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.support.annotation.IntDef;
|
||||
|
||||
-import com.google.android.play.core.appupdate.AppUpdateInfo;
|
||||
-import com.google.android.play.core.appupdate.testing.FakeAppUpdateManager;
|
||||
-import com.google.android.play.core.install.model.AppUpdateType;
|
||||
-import com.google.android.play.core.tasks.Task;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.task.PostTask;
|
||||
import org.chromium.chrome.browser.ChromeActivity;
|
||||
@@ -30,7 +25,7 @@ import java.lang.ref.WeakReference;
|
||||
* wrapper isn't meant to be used for a full integration test, but simulating all of the possible
|
||||
* error cases is a bit easier to do here.
|
||||
*/
|
||||
-public class FakeAppUpdateManagerWrapper extends FakeAppUpdateManager {
|
||||
+public class FakeAppUpdateManagerWrapper {
|
||||
private static final int RESULT_IN_APP_UPDATE_FAILED = 1;
|
||||
private static final int STEP_DELAY_MS = 5000;
|
||||
private static final int TOAST_DURATION_MS = 2000;
|
||||
@@ -107,15 +102,12 @@ public class FakeAppUpdateManagerWrapper extends FakeAppUpdateManager {
|
||||
switch (event) {
|
||||
case Event.UPDATE_AVAILABLE:
|
||||
w.toast("Making app update available.");
|
||||
- w.setUpdateAvailable(10000 /* Figure out a better version? */);
|
||||
return;
|
||||
case Event.USER_ACCEPTS_UPDATE:
|
||||
w.toast("User accepts update.");
|
||||
- w.userAcceptsUpdate();
|
||||
return;
|
||||
case Event.USER_REJECTS_UPDATE:
|
||||
w.toast("User rejects update.");
|
||||
- w.userRejectsUpdate();
|
||||
return;
|
||||
case Event.TRIGGER_DOWNLOAD:
|
||||
w.toast("Triggering download.");
|
||||
@@ -123,27 +115,21 @@ public class FakeAppUpdateManagerWrapper extends FakeAppUpdateManager {
|
||||
return;
|
||||
case Event.DOWNLOAD_STARTS:
|
||||
w.toast("Download has started.");
|
||||
- w.downloadStarts();
|
||||
return;
|
||||
case Event.DOWNLOAD_FAILS:
|
||||
w.toast("Triggering download failure.");
|
||||
- w.downloadFails();
|
||||
return;
|
||||
case Event.USER_CANCELS_DOWNLOAD:
|
||||
w.toast("Triggering cancellation of download.");
|
||||
- w.userCancelsDownload();
|
||||
return;
|
||||
case Event.DOWNLOAD_COMPLETES:
|
||||
w.toast("Download completes.");
|
||||
- w.downloadCompletes();
|
||||
return;
|
||||
case Event.INSTALL_FAILS:
|
||||
w.toast("Triggering install failure.");
|
||||
- w.installFails();
|
||||
return;
|
||||
case Event.INSTALL_COMPLETES:
|
||||
w.toast("Triggering install completion.");
|
||||
- w.installCompletes();
|
||||
return;
|
||||
default:
|
||||
w.toast("Unknown event.");
|
||||
@@ -158,56 +144,12 @@ public class FakeAppUpdateManagerWrapper extends FakeAppUpdateManager {
|
||||
* @param endState at which point should the inline update flow end.
|
||||
*/
|
||||
FakeAppUpdateManagerWrapper(@Type int endState) {
|
||||
- super(ContextUtils.getApplicationContext());
|
||||
mType = endState;
|
||||
mEventHandler = new EventHandler(this);
|
||||
|
||||
if (mType != Type.NONE) execute(Event.UPDATE_AVAILABLE);
|
||||
}
|
||||
|
||||
- // FakeAppUpdateManager implementation.
|
||||
- @Override
|
||||
- public boolean startUpdateFlowForResult(AppUpdateInfo appUpdateInfo,
|
||||
- @AppUpdateType int appUpdateType, Activity activity, int requestCode) {
|
||||
- toast("Starting update flow.");
|
||||
- // TODO(dtrainor): Simulate exceptions being thrown or returning false from the super call.
|
||||
- boolean success =
|
||||
- super.startUpdateFlowForResult(appUpdateInfo, appUpdateType, activity, requestCode);
|
||||
- if (!success) return false;
|
||||
-
|
||||
- assert activity instanceof ChromeActivity : "Unexpected triggering activity.";
|
||||
-
|
||||
- final int resultCode;
|
||||
- if (mType == Type.FAIL_DIALOG_CANCEL) {
|
||||
- resultCode = Activity.RESULT_CANCELED;
|
||||
- } else if (mType == Type.FAIL_DIALOG_UPDATE_FAILED) {
|
||||
- resultCode = RESULT_IN_APP_UPDATE_FAILED;
|
||||
- } else {
|
||||
- resultCode = Activity.RESULT_OK;
|
||||
- }
|
||||
-
|
||||
- PostTask.postDelayedTask(UiThreadTaskTraits.DEFAULT, () -> {
|
||||
- triggerDialogResponse((ChromeActivity) activity, requestCode, resultCode);
|
||||
- }, STEP_DELAY_MS);
|
||||
-
|
||||
- return true;
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public Task<Void> completeUpdate() {
|
||||
- toast("Completing update.");
|
||||
- Task<Void> result = super.completeUpdate();
|
||||
-
|
||||
- if (mType == Type.FAIL_INSTALL) {
|
||||
- postDelayedEvent(Event.INSTALL_FAILS);
|
||||
- } else {
|
||||
- postDelayedEvent(Event.INSTALL_COMPLETES);
|
||||
- // This doesn't actually restart Chrome in this case.
|
||||
- }
|
||||
-
|
||||
- return result;
|
||||
- }
|
||||
-
|
||||
private void triggerDialogResponse(ChromeActivity activity, int requestCode, int resultCode) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
execute(Event.USER_ACCEPTS_UPDATE);
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateControllerFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateControllerFactory.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateControllerFactory.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateControllerFactory.java
|
||||
@@ -4,8 +4,6 @@
|
||||
|
||||
package org.chromium.chrome.browser.omaha.inline;
|
||||
|
||||
-import com.google.android.play.core.appupdate.AppUpdateManagerFactory;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.chrome.browser.ChromeFeatureList;
|
||||
import org.chromium.chrome.browser.omaha.UpdateConfigs;
|
||||
@@ -20,20 +18,6 @@ public class InlineUpdateControllerFactory {
|
||||
public static InlineUpdateController create(Runnable callback) {
|
||||
@FakeAppUpdateManagerWrapper.Type
|
||||
int mockInlineEndState = UpdateConfigs.getMockInlineScenarioEndState();
|
||||
- if (mockInlineEndState != FakeAppUpdateManagerWrapper.Type.NO_SIMULATION) {
|
||||
- // The config requires to run through a test controller, using the
|
||||
- // PlayInlineUpdateController, but with a fake Google Play backend that automatically
|
||||
- // goes through a scenario flow.
|
||||
- return new PlayInlineUpdateController(
|
||||
- callback, new FakeAppUpdateManagerWrapper(mockInlineEndState));
|
||||
- }
|
||||
-
|
||||
- if (ChromeFeatureList.isEnabled(ChromeFeatureList.INLINE_UPDATE_FLOW)) {
|
||||
- // The application configuration requires to use the real Google Play backend for inline
|
||||
- // updates.
|
||||
- return new PlayInlineUpdateController(
|
||||
- callback, AppUpdateManagerFactory.create(ContextUtils.getApplicationContext()));
|
||||
- }
|
||||
|
||||
// No test scenario was in place, and the inline flow has not been enabled, so use a
|
||||
// controller with no functionality.
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/PlayInlineUpdateController.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/PlayInlineUpdateController.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/PlayInlineUpdateController.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/PlayInlineUpdateController.java
|
||||
@@ -9,15 +9,6 @@ import android.content.IntentSender.SendIntentException;
|
||||
import android.support.annotation.IntDef;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
-import com.google.android.play.core.appupdate.AppUpdateInfo;
|
||||
-import com.google.android.play.core.appupdate.AppUpdateManager;
|
||||
-import com.google.android.play.core.install.InstallState;
|
||||
-import com.google.android.play.core.install.InstallStateUpdatedListener;
|
||||
-import com.google.android.play.core.install.model.AppUpdateType;
|
||||
-import com.google.android.play.core.install.model.InstallErrorCode;
|
||||
-import com.google.android.play.core.install.model.InstallStatus;
|
||||
-import com.google.android.play.core.install.model.UpdateAvailability;
|
||||
-
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.base.metrics.RecordHistogram;
|
||||
import org.chromium.chrome.browser.omaha.UpdateStatusProvider.UpdateState;
|
||||
@@ -31,7 +22,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
* in the foreground.
|
||||
*/
|
||||
public class PlayInlineUpdateController
|
||||
- implements InlineUpdateController, InstallStateUpdatedListener {
|
||||
+ implements InlineUpdateController {
|
||||
/**
|
||||
* Converts Play's InstallErrorCode enum to a stable monotomically incrementing Chrome enum.
|
||||
* This is used for metric stability.
|
||||
@@ -126,26 +117,9 @@ public class PlayInlineUpdateController
|
||||
private static final int RESULT_IN_APP_UPDATE_FAILED = 1;
|
||||
private static final int REQUEST_CODE = 8123;
|
||||
|
||||
- private final Runnable mCallback;
|
||||
- private final AppUpdateManager mAppUpdateManager;
|
||||
-
|
||||
private boolean mEnabled;
|
||||
private @Nullable @UpdateState Integer mUpdateState;
|
||||
|
||||
- private AppUpdateInfo mAppUpdateInfo;
|
||||
- private @Nullable @UpdateAvailability Integer mUpdateAvailability;
|
||||
- private @Nullable @InstallStatus Integer mInstallStatus;
|
||||
-
|
||||
- /**
|
||||
- * Builds an instance of {@link PlayInlineUpdateController}.
|
||||
- * @param callback The {@link Runnable} to notify when an inline update state change occurs.
|
||||
- */
|
||||
- PlayInlineUpdateController(Runnable callback, AppUpdateManager appUpdateManager) {
|
||||
- mCallback = callback;
|
||||
- mAppUpdateManager = appUpdateManager;
|
||||
- setEnabled(true);
|
||||
- }
|
||||
-
|
||||
// InlineUpdateController implementation.
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
@@ -154,10 +128,8 @@ public class PlayInlineUpdateController
|
||||
|
||||
if (mEnabled) {
|
||||
mUpdateState = UpdateState.NONE;
|
||||
- mAppUpdateManager.registerListener(this);
|
||||
pullCurrentState();
|
||||
} else {
|
||||
- mAppUpdateManager.unregisterListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,220 +140,26 @@ public class PlayInlineUpdateController
|
||||
|
||||
@Override
|
||||
public void startUpdate(Activity activity) {
|
||||
- try {
|
||||
- boolean success = mAppUpdateManager.startUpdateFlowForResult(
|
||||
- mAppUpdateInfo, AppUpdateType.FLEXIBLE, activity, REQUEST_CODE);
|
||||
- Log.i(TAG, "startUpdateFlowForResult() returned " + success);
|
||||
-
|
||||
- if (!success) recordCallFailure(CallFailure.START_FAILED);
|
||||
- } catch (SendIntentException exception) {
|
||||
- mInstallStatus = InstallStatus.FAILED;
|
||||
- Log.i(TAG, "startUpdateFlowForResult() threw an exception.");
|
||||
- recordCallFailure(CallFailure.START_EXCEPTION);
|
||||
- }
|
||||
- // TODO(dtrainor): Use success.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void completeUpdate() {
|
||||
- mAppUpdateManager.completeUpdate()
|
||||
- .addOnSuccessListener(unused -> {
|
||||
- Log.i(TAG, "completeUpdate() success.");
|
||||
- pushStatus();
|
||||
- })
|
||||
- .addOnFailureListener(exception -> {
|
||||
- Log.i(TAG, "completeUpdate() failed.");
|
||||
- recordCallFailure(CallFailure.COMPLETE_FAILED);
|
||||
- mInstallStatus = InstallStatus.FAILED;
|
||||
- pushStatus();
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- // InstallStateUpdatedListener implementation.
|
||||
- @Override
|
||||
- public void onStateUpdate(InstallState state) {
|
||||
- Log.i(TAG,
|
||||
- "onStateUpdate(" + state.installStatus() + ", " + state.installErrorCode() + ")");
|
||||
-
|
||||
- if (state.installStatus() != mInstallStatus) {
|
||||
- RecordHistogram.recordEnumeratedHistogram("GoogleUpdate.Inline.StateChange.Error."
|
||||
- + installStatusToEnumSuffix(state.installStatus()),
|
||||
- installErrorCodeToMetrics(state.installErrorCode()),
|
||||
- InstallErrorCodeMetrics.NUM_ENTRIES);
|
||||
- }
|
||||
-
|
||||
- mInstallStatus = state.installStatus();
|
||||
- pushStatus();
|
||||
}
|
||||
|
||||
private void pullCurrentState() {
|
||||
- mAppUpdateManager.getAppUpdateInfo()
|
||||
- .addOnSuccessListener(info -> {
|
||||
- mAppUpdateInfo = info;
|
||||
- mUpdateAvailability = info.updateAvailability();
|
||||
- mInstallStatus = info.installStatus();
|
||||
- Log.i(TAG,
|
||||
- "pullCurrentState(" + mUpdateAvailability + ", " + mInstallStatus
|
||||
- + ") success.");
|
||||
- recordOnAppUpdateInfo(info);
|
||||
- pushStatus();
|
||||
- })
|
||||
- .addOnFailureListener(exception -> {
|
||||
- mAppUpdateInfo = null;
|
||||
- mUpdateAvailability = UpdateAvailability.UNKNOWN;
|
||||
- mInstallStatus = InstallStatus.UNKNOWN;
|
||||
- Log.i(TAG, "pullCurrentState() failed.");
|
||||
- recordCallFailure(CallFailure.QUERY_FAILED);
|
||||
- pushStatus();
|
||||
- });
|
||||
}
|
||||
|
||||
private void pushStatus() {
|
||||
- if (!mEnabled || mUpdateAvailability == null || mInstallStatus == null) return;
|
||||
-
|
||||
- @UpdateState
|
||||
- int newState = toUpdateState(mUpdateAvailability, mInstallStatus);
|
||||
- if (mUpdateState != null && mUpdateState == newState) return;
|
||||
-
|
||||
- Log.i(TAG, "Pushing inline update state to " + newState);
|
||||
- mUpdateState = newState;
|
||||
- mCallback.run();
|
||||
}
|
||||
|
||||
private static @UpdateState int toUpdateState(
|
||||
- @UpdateAvailability int updateAvailability, @InstallStatus int installStatus) {
|
||||
+ int updateAvailability, int installStatus) {
|
||||
@UpdateState
|
||||
int newStatus = UpdateState.NONE;
|
||||
|
||||
- // Note, use InstallStatus first then UpdateAvailability if InstallStatus doesn't indicate
|
||||
- // a currently active install.
|
||||
- switch (installStatus) {
|
||||
- case InstallStatus.PENDING:
|
||||
- // Intentional fall through.
|
||||
- case InstallStatus.DOWNLOADING:
|
||||
- newStatus = UpdateState.INLINE_UPDATE_DOWNLOADING;
|
||||
- break;
|
||||
- case InstallStatus.DOWNLOADED:
|
||||
- newStatus = UpdateState.INLINE_UPDATE_READY;
|
||||
- break;
|
||||
- case InstallStatus.FAILED:
|
||||
- newStatus = UpdateState.INLINE_UPDATE_FAILED;
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- if (newStatus == UpdateState.NONE) {
|
||||
- switch (updateAvailability) {
|
||||
- case UpdateAvailability.UPDATE_AVAILABLE:
|
||||
- newStatus = UpdateState.INLINE_UPDATE_AVAILABLE;
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
return newStatus;
|
||||
}
|
||||
|
||||
- private static String installStatusToEnumSuffix(@InstallStatus int status) {
|
||||
- switch (status) {
|
||||
- case InstallStatus.UNKNOWN:
|
||||
- return "Unknown";
|
||||
- case InstallStatus.REQUIRES_UI_INTENT:
|
||||
- return "RequiresUiIntent";
|
||||
- case InstallStatus.PENDING:
|
||||
- return "Pending";
|
||||
- case InstallStatus.DOWNLOADING:
|
||||
- return "Downloading";
|
||||
- case InstallStatus.DOWNLOADED:
|
||||
- return "Downloaded";
|
||||
- case InstallStatus.INSTALLING:
|
||||
- return "Installing";
|
||||
- case InstallStatus.INSTALLED:
|
||||
- return "Installed";
|
||||
- case InstallStatus.FAILED:
|
||||
- return "Failed";
|
||||
- case InstallStatus.CANCELED:
|
||||
- return "Canceled";
|
||||
- default:
|
||||
- return "Untracked";
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private static @InstallErrorCodeMetrics int installErrorCodeToMetrics(
|
||||
- @InstallErrorCode int error) {
|
||||
- switch (error) {
|
||||
- case InstallErrorCode.NO_ERROR:
|
||||
- return InstallErrorCodeMetrics.NO_ERROR;
|
||||
- case InstallErrorCode.NO_ERROR_PARTIALLY_ALLOWED:
|
||||
- return InstallErrorCodeMetrics.NO_ERROR_PARTIALLY_ALLOWED;
|
||||
- case InstallErrorCode.ERROR_UNKNOWN:
|
||||
- return InstallErrorCodeMetrics.ERROR_UNKNOWN;
|
||||
- case InstallErrorCode.ERROR_API_NOT_AVAILABLE:
|
||||
- return InstallErrorCodeMetrics.ERROR_API_NOT_AVAILABLE;
|
||||
- case InstallErrorCode.ERROR_INVALID_REQUEST:
|
||||
- return InstallErrorCodeMetrics.ERROR_INVALID_REQUEST;
|
||||
- case InstallErrorCode.ERROR_INSTALL_UNAVAILABLE:
|
||||
- return InstallErrorCodeMetrics.ERROR_INSTALL_UNAVAILABLE;
|
||||
- case InstallErrorCode.ERROR_INSTALL_NOT_ALLOWED:
|
||||
- return InstallErrorCodeMetrics.ERROR_INSTALL_NOT_ALLOWED;
|
||||
- case InstallErrorCode.ERROR_DOWNLOAD_NOT_PRESENT:
|
||||
- return InstallErrorCodeMetrics.ERROR_DOWNLOAD_NOT_PRESENT;
|
||||
- case InstallErrorCode.ERROR_INTERNAL_ERROR:
|
||||
- return InstallErrorCodeMetrics.ERROR_INTERNAL_ERROR;
|
||||
- default:
|
||||
- return InstallErrorCodeMetrics.ERROR_UNTRACKED;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private static @UpdateAvailabilityMetric int updateAvailabilityToMetrics(
|
||||
- @UpdateAvailability int updateAvailability) {
|
||||
- switch (updateAvailability) {
|
||||
- case UpdateAvailability.UNKNOWN:
|
||||
- return UpdateAvailabilityMetric.UNKNOWN;
|
||||
- case UpdateAvailability.UPDATE_NOT_AVAILABLE:
|
||||
- return UpdateAvailabilityMetric.UPDATE_NOT_AVAILABLE;
|
||||
- case UpdateAvailability.UPDATE_AVAILABLE:
|
||||
- return UpdateAvailabilityMetric.UPDATE_AVAILABLE;
|
||||
- case UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS:
|
||||
- return UpdateAvailabilityMetric.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS;
|
||||
- default:
|
||||
- return UpdateAvailabilityMetric.UNTRACKED;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private static @InstallStatusMetric int installStatusToMetrics(
|
||||
- @InstallStatus int installStatus) {
|
||||
- switch (installStatus) {
|
||||
- case InstallStatus.UNKNOWN:
|
||||
- return InstallStatusMetric.UNKNOWN;
|
||||
- case InstallStatus.REQUIRES_UI_INTENT:
|
||||
- return InstallStatusMetric.REQUIRES_UI_INTENT;
|
||||
- case InstallStatus.PENDING:
|
||||
- return InstallStatusMetric.PENDING;
|
||||
- case InstallStatus.DOWNLOADING:
|
||||
- return InstallStatusMetric.DOWNLOADING;
|
||||
- case InstallStatus.DOWNLOADED:
|
||||
- return InstallStatusMetric.DOWNLOADED;
|
||||
- case InstallStatus.INSTALLING:
|
||||
- return InstallStatusMetric.INSTALLING;
|
||||
- case InstallStatus.INSTALLED:
|
||||
- return InstallStatusMetric.INSTALLED;
|
||||
- case InstallStatus.FAILED:
|
||||
- return InstallStatusMetric.FAILED;
|
||||
- case InstallStatus.CANCELED:
|
||||
- return InstallStatusMetric.CANCELED;
|
||||
- default:
|
||||
- return InstallStatusMetric.UNTRACKED;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private static void recordOnAppUpdateInfo(AppUpdateInfo info) {
|
||||
- RecordHistogram.recordEnumeratedHistogram(
|
||||
- "GoogleUpdate.Inline.AppUpdateInfo.UpdateAvailability",
|
||||
- updateAvailabilityToMetrics(info.updateAvailability()),
|
||||
- UpdateAvailabilityMetric.NUM_ENTRIES);
|
||||
- RecordHistogram.recordEnumeratedHistogram("GoogleUpdate.Inline.AppUpdateInfo.InstallStatus",
|
||||
- installStatusToMetrics(info.installStatus()), InstallStatusMetric.NUM_ENTRIES);
|
||||
- }
|
||||
-
|
||||
private static void recordCallFailure(@CallFailure int failure) {
|
||||
RecordHistogram.recordEnumeratedHistogram(
|
||||
"GoogleUpdate.Inline.CallFailure", failure, CallFailure.NUM_ENTRIES);
|
||||
diff --git a/components/module_installer/android/BUILD.gn b/components/module_installer/android/BUILD.gn
|
||||
--- a/components/module_installer/android/BUILD.gn
|
||||
+++ b/components/module_installer/android/BUILD.gn
|
||||
@@ -23,7 +23,6 @@ android_library("module_installer_java") {
|
||||
deps = [
|
||||
"//base:base_java",
|
||||
"//components/crash/android:java",
|
||||
- "//third_party/google_android_play_core:com_google_android_play_core_java",
|
||||
]
|
||||
|
||||
srcjar_deps = [ ":module_installer_build_config" ]
|
||||
diff --git a/third_party/google_android_play_core/BUILD.gn b/third_party/google_android_play_core/BUILD.gn
|
||||
--- a/third_party/google_android_play_core/BUILD.gn
|
||||
+++ b/third_party/google_android_play_core/BUILD.gn
|
||||
@@ -3,8 +3,3 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/android/rules.gni")
|
||||
-
|
||||
-android_aar_prebuilt("com_google_android_play_core_java") {
|
||||
- aar_path = "core-1.6.4.aar"
|
||||
- info_path = "com_google_android_play_core.info"
|
||||
-}
|
||||
--
|
||||
2.11.0
|
||||
|
481
build/patches/Remove-play-dependency-for-module-installer.patch
Normal file
481
build/patches/Remove-play-dependency-for-module-installer.patch
Normal file
|
@ -0,0 +1,481 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Sat, 2 Nov 2019 16:27:51 +0100
|
||||
Subject: Remove play dependency for module installer
|
||||
|
||||
---
|
||||
.../FakeModuleInstallerBackend.java | 16 +-
|
||||
.../module_installer/ModuleInstallerImpl.java | 150 ---------------
|
||||
.../PlayCoreModuleInstallerBackend.java | 210 +--------------------
|
||||
3 files changed, 10 insertions(+), 366 deletions(-)
|
||||
|
||||
diff --git a/components/module_installer/android/java/src/org/chromium/components/module_installer/FakeModuleInstallerBackend.java b/components/module_installer/android/java/src/org/chromium/components/module_installer/FakeModuleInstallerBackend.java
|
||||
--- a/components/module_installer/android/java/src/org/chromium/components/module_installer/FakeModuleInstallerBackend.java
|
||||
+++ b/components/module_installer/android/java/src/org/chromium/components/module_installer/FakeModuleInstallerBackend.java
|
||||
@@ -7,9 +7,6 @@ package org.chromium.components.module_installer;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
-import com.google.android.play.core.splitcompat.SplitCompat;
|
||||
-import com.google.android.play.core.splitcompat.ingestion.Verifier;
|
||||
-
|
||||
import org.chromium.base.BuildInfo;
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.Log;
|
||||
@@ -132,18 +129,7 @@ class FakeModuleInstallerBackend extends ModuleInstallerBackend {
|
||||
return false;
|
||||
}
|
||||
|
||||
- // Check that the module's signature matches Chrome's.
|
||||
- try {
|
||||
- Verifier verifier = new Verifier(context);
|
||||
- if (!verifier.verifySplits()) {
|
||||
- return false;
|
||||
- }
|
||||
- } catch (IOException | PackageManager.NameNotFoundException e) {
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- // Tell SplitCompat to do a full emulation of the module.
|
||||
- return SplitCompat.fullInstall(context);
|
||||
+ return false;
|
||||
}
|
||||
|
||||
private File joinPaths(String... paths) {
|
||||
diff --git a/components/module_installer/android/java/src/org/chromium/components/module_installer/ModuleInstallerImpl.java b/components/module_installer/android/java/src/org/chromium/components/module_installer/ModuleInstallerImpl.java
|
||||
--- a/components/module_installer/android/java/src/org/chromium/components/module_installer/ModuleInstallerImpl.java
|
||||
+++ b/components/module_installer/android/java/src/org/chromium/components/module_installer/ModuleInstallerImpl.java
|
||||
@@ -11,9 +11,6 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.os.Build;
|
||||
import android.text.TextUtils;
|
||||
|
||||
-import com.google.android.play.core.splitcompat.SplitCompat;
|
||||
-import com.google.android.play.core.splitinstall.SplitInstallManagerFactory;
|
||||
-
|
||||
import org.chromium.base.BuildInfo;
|
||||
import org.chromium.base.CommandLine;
|
||||
import org.chromium.base.ContextUtils;
|
||||
@@ -57,152 +54,5 @@ import java.util.TreeSet;
|
||||
sInstance = moduleInstaller;
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public void init() {
|
||||
- try (Timer ignored1 = new Timer()) {
|
||||
- if (sAppContextSplitCompatted) return;
|
||||
- // SplitCompat.install may copy modules into Chrome's internal folder or clean them up.
|
||||
- try (StrictModeContext ignored = StrictModeContext.allowDiskWrites()) {
|
||||
- SplitCompat.install(ContextUtils.getApplicationContext());
|
||||
- sAppContextSplitCompatted = true;
|
||||
- }
|
||||
- // SplitCompat.install may add emulated modules. Thus, update crash keys.
|
||||
- updateCrashKeys();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void initActivity(Activity activity) {
|
||||
- try (Timer ignored = new Timer()) {
|
||||
- // SplitCompat#install should always be run for the application first before it is run
|
||||
- // for any activities.
|
||||
- init();
|
||||
- SplitCompat.installActivity(activity);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void recordModuleAvailability() {
|
||||
- try (Timer ignored = new Timer()) {
|
||||
- getBackend().recordModuleAvailability();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void recordStartupTime() {
|
||||
- getBackend().recordStartupTime(Timer.getTotalTime());
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void updateCrashKeys() {
|
||||
- try (Timer ignored = new Timer()) {
|
||||
- Context context = ContextUtils.getApplicationContext();
|
||||
-
|
||||
- // Get modules that are fully installed as split APKs (excluding base which is always
|
||||
- // installed). Tree set to have ordered and, thus, deterministic results.
|
||||
- Set<String> fullyInstalledModules = new TreeSet<>();
|
||||
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
- // Split APKs are only supported on Android L+.
|
||||
- try {
|
||||
- PackageInfo packageInfo = context.getPackageManager().getPackageInfo(
|
||||
- BuildInfo.getInstance().packageName, 0);
|
||||
- if (packageInfo.splitNames != null) {
|
||||
- fullyInstalledModules.addAll(Arrays.asList(packageInfo.splitNames));
|
||||
- }
|
||||
- } catch (NameNotFoundException e) {
|
||||
- throw new RuntimeException(e);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- // Create temporary split install manager to retrieve both fully installed and emulated
|
||||
- // modules. Then remove fully installed ones to get emulated ones only. Querying the
|
||||
- // installed modules can only be done if splitcompat has already been called. Otherwise,
|
||||
- // emulation of later modules won't work. If splitcompat has not been called no modules
|
||||
- // are emulated. Therefore, use an empty set in that case.
|
||||
- Set<String> emulatedModules = new TreeSet<>();
|
||||
- if (sAppContextSplitCompatted) {
|
||||
- emulatedModules.addAll(
|
||||
- SplitInstallManagerFactory.create(context).getInstalledModules());
|
||||
- emulatedModules.removeAll(fullyInstalledModules);
|
||||
- }
|
||||
-
|
||||
- CrashKeys.getInstance().set(
|
||||
- CrashKeyIndex.INSTALLED_MODULES, encodeCrashKeyValue(fullyInstalledModules));
|
||||
- CrashKeys.getInstance().set(
|
||||
- CrashKeyIndex.EMULATED_MODULES, encodeCrashKeyValue(emulatedModules));
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void install(String moduleName, OnModuleInstallFinishedListener onFinishedListener) {
|
||||
- try (Timer ignored = new Timer()) {
|
||||
- ThreadUtils.assertOnUiThread();
|
||||
-
|
||||
- if (!mModuleNameListenerMap.containsKey(moduleName)) {
|
||||
- mModuleNameListenerMap.put(moduleName, new LinkedList<>());
|
||||
- }
|
||||
- List<OnModuleInstallFinishedListener> onFinishedListeners =
|
||||
- mModuleNameListenerMap.get(moduleName);
|
||||
- onFinishedListeners.add(onFinishedListener);
|
||||
- if (onFinishedListeners.size() > 1) {
|
||||
- // Request is already running.
|
||||
- return;
|
||||
- }
|
||||
- getBackend().install(moduleName);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- public void installDeferred(String moduleName) {
|
||||
- try (Timer ignored = new Timer()) {
|
||||
- ThreadUtils.assertOnUiThread();
|
||||
- getBackend().installDeferred(moduleName);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private void onFinished(boolean success, List<String> moduleNames) {
|
||||
- // Add timer to this private method since it is passed as a callback.
|
||||
- try (Timer ignored = new Timer()) {
|
||||
- ThreadUtils.assertOnUiThread();
|
||||
-
|
||||
- mActivityObserver.onModuleInstalled();
|
||||
-
|
||||
- for (String moduleName : moduleNames) {
|
||||
- List<OnModuleInstallFinishedListener> onFinishedListeners =
|
||||
- mModuleNameListenerMap.get(moduleName);
|
||||
- if (onFinishedListeners == null) continue;
|
||||
-
|
||||
- for (OnModuleInstallFinishedListener listener : onFinishedListeners) {
|
||||
- listener.onFinished(success);
|
||||
- }
|
||||
- mModuleNameListenerMap.remove(moduleName);
|
||||
- }
|
||||
-
|
||||
- if (mModuleNameListenerMap.isEmpty()) {
|
||||
- mBackend.close();
|
||||
- mBackend = null;
|
||||
- }
|
||||
-
|
||||
- updateCrashKeys();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private ModuleInstallerBackend getBackend() {
|
||||
- if (mBackend == null) {
|
||||
- ModuleInstallerBackend.OnFinishedListener listener = this::onFinished;
|
||||
- mBackend = CommandLine.getInstance().hasSwitch(FAKE_FEATURE_MODULE_INSTALL)
|
||||
- ? new FakeModuleInstallerBackend(listener)
|
||||
- : new PlayCoreModuleInstallerBackend(listener);
|
||||
- }
|
||||
- return mBackend;
|
||||
- }
|
||||
-
|
||||
- private String encodeCrashKeyValue(Set<String> moduleNames) {
|
||||
- if (moduleNames.isEmpty()) return "<none>";
|
||||
- // Values with dots are interpreted as URLs. Some module names have dots in them. Make sure
|
||||
- // they don't get sanitized.
|
||||
- return TextUtils.join(",", moduleNames).replace('.', '$');
|
||||
- }
|
||||
-
|
||||
private ModuleInstallerImpl() {}
|
||||
}
|
||||
diff --git a/components/module_installer/android/java/src/org/chromium/components/module_installer/PlayCoreModuleInstallerBackend.java b/components/module_installer/android/java/src/org/chromium/components/module_installer/PlayCoreModuleInstallerBackend.java
|
||||
--- a/components/module_installer/android/java/src/org/chromium/components/module_installer/PlayCoreModuleInstallerBackend.java
|
||||
+++ b/components/module_installer/android/java/src/org/chromium/components/module_installer/PlayCoreModuleInstallerBackend.java
|
||||
@@ -7,15 +7,6 @@ package org.chromium.components.module_installer;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.SparseLongArray;
|
||||
|
||||
-import com.google.android.play.core.splitinstall.SplitInstallException;
|
||||
-import com.google.android.play.core.splitinstall.SplitInstallManager;
|
||||
-import com.google.android.play.core.splitinstall.SplitInstallManagerFactory;
|
||||
-import com.google.android.play.core.splitinstall.SplitInstallRequest;
|
||||
-import com.google.android.play.core.splitinstall.SplitInstallSessionState;
|
||||
-import com.google.android.play.core.splitinstall.SplitInstallStateUpdatedListener;
|
||||
-import com.google.android.play.core.splitinstall.model.SplitInstallErrorCode;
|
||||
-import com.google.android.play.core.splitinstall.model.SplitInstallSessionStatus;
|
||||
-
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.base.metrics.CachedMetrics.EnumeratedHistogramSample;
|
||||
@@ -33,14 +24,13 @@ import java.util.Set;
|
||||
* Backend that uses the Play Core SDK to download a module from Play and install it subsequently.
|
||||
*/
|
||||
/* package */ class PlayCoreModuleInstallerBackend
|
||||
- extends ModuleInstallerBackend implements SplitInstallStateUpdatedListener {
|
||||
+ extends ModuleInstallerBackend {
|
||||
private static class InstallTimes {
|
||||
public final boolean mIsCached;
|
||||
public final SparseLongArray mInstallTimes = new SparseLongArray();
|
||||
|
||||
public InstallTimes(boolean isCached) {
|
||||
mIsCached = isCached;
|
||||
- mInstallTimes.put(SplitInstallSessionStatus.UNKNOWN, System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +40,6 @@ import java.util.Set;
|
||||
private static final String KEY_MODULES_DEFERRED_REQUESTED_PREVIOUSLY =
|
||||
"key_modules_deferred_requested_previously";
|
||||
private final Map<String, InstallTimes> mInstallTimesMap = new HashMap<>();
|
||||
- private final SplitInstallManager mManager;
|
||||
private boolean mIsClosed;
|
||||
|
||||
// FeatureModuleInstallStatus defined in //tools/metrics/histograms/enums.xml.
|
||||
@@ -90,183 +79,31 @@ import java.util.Set;
|
||||
// Keep this one at the end and increment appropriately when adding new status.
|
||||
private static final int AVAILABILITY_STATUS_COUNT = 3;
|
||||
|
||||
- /** Records via UMA all modules that have been requested and are currently installed. */
|
||||
- @Override
|
||||
- /* package */ void recordModuleAvailability() {
|
||||
- SharedPreferences prefs = ContextUtils.getAppSharedPreferences();
|
||||
- Set<String> requestedModules = new HashSet<>();
|
||||
- requestedModules.addAll(
|
||||
- prefs.getStringSet(KEY_MODULES_ONDEMAND_REQUESTED_PREVIOUSLY, new HashSet<>()));
|
||||
- requestedModules.addAll(
|
||||
- prefs.getStringSet(KEY_MODULES_DEFERRED_REQUESTED_PREVIOUSLY, new HashSet<>()));
|
||||
- Set<String> installedModules = mManager.getInstalledModules();
|
||||
-
|
||||
- for (String name : requestedModules) {
|
||||
- EnumeratedHistogramSample sample = new EnumeratedHistogramSample(
|
||||
- "Android.FeatureModules.AvailabilityStatus." + name, AVAILABILITY_STATUS_COUNT);
|
||||
- if (installedModules.contains(name)) {
|
||||
- sample.record(AVAILABILITY_STATUS_INSTALLED_REQUESTED);
|
||||
- } else {
|
||||
- sample.record(AVAILABILITY_STATUS_REQUESTED);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- for (String name : installedModules) {
|
||||
- if (!requestedModules.contains(name)) {
|
||||
- // Module appeared without being requested. Weird.
|
||||
- EnumeratedHistogramSample sample = new EnumeratedHistogramSample(
|
||||
- "Android.FeatureModules.AvailabilityStatus." + name,
|
||||
- AVAILABILITY_STATUS_COUNT);
|
||||
- sample.record(AVAILABILITY_STATUS_INSTALLED_UNREQUESTED);
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- @Override
|
||||
- /* package */ void recordStartupTime(long durationMs) {
|
||||
- TimesHistogramSample sample =
|
||||
- new TimesHistogramSample("Android.FeatureModules.StartupTime");
|
||||
- sample.record(durationMs);
|
||||
- }
|
||||
-
|
||||
/* package */ PlayCoreModuleInstallerBackend(OnFinishedListener listener) {
|
||||
super(listener);
|
||||
- // MUST call init before creating a SplitInstallManager.
|
||||
- ModuleInstaller.getInstance().init();
|
||||
- mManager = SplitInstallManagerFactory.create(ContextUtils.getApplicationContext());
|
||||
- mManager.registerListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void install(String moduleName) {
|
||||
+ public void close() {
|
||||
assert !mIsClosed;
|
||||
-
|
||||
- // Record start time in order to later report the install duration via UMA. We want to make
|
||||
- // a difference between modules that have been requested first before and after the last
|
||||
- // Chrome start. Modules that have been requested before may install quicker as they may be
|
||||
- // installed form cache. To do this, we use shared prefs to track modules previously
|
||||
- // requested. Additionally, storing requested modules helps us to record module install
|
||||
- // status at next Chrome start.
|
||||
- assert !mInstallTimesMap.containsKey(moduleName);
|
||||
- mInstallTimesMap.put(moduleName,
|
||||
- new InstallTimes(storeModuleRequested(
|
||||
- moduleName, KEY_MODULES_ONDEMAND_REQUESTED_PREVIOUSLY)));
|
||||
-
|
||||
- SplitInstallRequest request =
|
||||
- SplitInstallRequest.newBuilder().addModule(moduleName).build();
|
||||
-
|
||||
- mManager.startInstall(request).addOnFailureListener(exception -> {
|
||||
- int status = exception instanceof SplitInstallException
|
||||
- ? getHistogramCode(((SplitInstallException) exception).getErrorCode())
|
||||
- : INSTALL_STATUS_UNKNOWN_REQUEST_ERROR;
|
||||
- Log.e(TAG, "Failed to request module '%s': error code %s", moduleName, status);
|
||||
- // If we reach this error condition |onStateUpdate| won't be called. Thus, call
|
||||
- // |onFinished| here.
|
||||
- finish(false, Collections.singletonList(moduleName), status);
|
||||
- });
|
||||
+ mIsClosed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void installDeferred(String moduleName) {
|
||||
- assert !mIsClosed;
|
||||
- mManager.deferredInstall(Collections.singletonList(moduleName));
|
||||
- storeModuleRequested(moduleName, KEY_MODULES_DEFERRED_REQUESTED_PREVIOUSLY);
|
||||
+ /* package */ void recordModuleAvailability() {
|
||||
+ SharedPreferences prefs = ContextUtils.getAppSharedPreferences();
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void close() {
|
||||
- assert !mIsClosed;
|
||||
- mManager.unregisterListener(this);
|
||||
- mIsClosed = true;
|
||||
+ /* package */ void recordStartupTime(long durationMs) {
|
||||
}
|
||||
|
||||
@Override
|
||||
- public void onStateUpdate(SplitInstallSessionState state) {
|
||||
- assert !mIsClosed;
|
||||
- Log.i(TAG, "Status for modules '%s' updated to %d", state.moduleNames(), state.status());
|
||||
- switch (state.status()) {
|
||||
- case SplitInstallSessionStatus.DOWNLOADING:
|
||||
- case SplitInstallSessionStatus.INSTALLING:
|
||||
- case SplitInstallSessionStatus.INSTALLED:
|
||||
- for (String name : state.moduleNames()) {
|
||||
- mInstallTimesMap.get(name).mInstallTimes.put(
|
||||
- state.status(), System.currentTimeMillis());
|
||||
- }
|
||||
- if (state.status() == SplitInstallSessionStatus.INSTALLED) {
|
||||
- finish(true, state.moduleNames(), INSTALL_STATUS_SUCCESS);
|
||||
- }
|
||||
- break;
|
||||
- // DOWNLOADED only gets sent if SplitCompat is not enabled. That's an error.
|
||||
- // SplitCompat should always be enabled.
|
||||
- case SplitInstallSessionStatus.DOWNLOADED:
|
||||
- case SplitInstallSessionStatus.CANCELED:
|
||||
- case SplitInstallSessionStatus.FAILED:
|
||||
- int status;
|
||||
- if (state.status() == SplitInstallSessionStatus.DOWNLOADED) {
|
||||
- status = INSTALL_STATUS_NO_SPLITCOMPAT;
|
||||
- } else if (state.status() == SplitInstallSessionStatus.CANCELED) {
|
||||
- status = INSTALL_STATUS_CANCELLATION;
|
||||
- } else {
|
||||
- status = getHistogramCode(state.errorCode());
|
||||
- }
|
||||
- Log.e(TAG, "Failed to install modules '%s': error code %s", state.moduleNames(),
|
||||
- status);
|
||||
- finish(false, state.moduleNames(), status);
|
||||
- break;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- private void finish(boolean success, List<String> moduleNames, int eventId) {
|
||||
- for (String name : moduleNames) {
|
||||
- RecordHistogram.recordEnumeratedHistogram(
|
||||
- "Android.FeatureModules.InstallStatus." + name, eventId, INSTALL_STATUS_COUNT);
|
||||
- if (success) {
|
||||
- recordInstallTimes(name);
|
||||
- }
|
||||
- }
|
||||
- onFinished(success, moduleNames);
|
||||
+ public void install(String moduleName) {
|
||||
}
|
||||
|
||||
- /**
|
||||
- * Gets the UMA code based on a SplitInstall error code
|
||||
- * @param errorCode The error code
|
||||
- * @return int The User Metric Analysis code
|
||||
- */
|
||||
- private int getHistogramCode(@SplitInstallErrorCode int errorCode) {
|
||||
- switch (errorCode) {
|
||||
- case SplitInstallErrorCode.ACCESS_DENIED:
|
||||
- return INSTALL_STATUS_ACCESS_DENIED;
|
||||
- case SplitInstallErrorCode.ACTIVE_SESSIONS_LIMIT_EXCEEDED:
|
||||
- return INSTALL_STATUS_ACTIVE_SESSIONS_LIMIT_EXCEEDED;
|
||||
- case SplitInstallErrorCode.API_NOT_AVAILABLE:
|
||||
- return INSTALL_STATUS_API_NOT_AVAILABLE;
|
||||
- case SplitInstallErrorCode.INCOMPATIBLE_WITH_EXISTING_SESSION:
|
||||
- return INSTALL_STATUS_INCOMPATIBLE_WITH_EXISTING_SESSION;
|
||||
- case SplitInstallErrorCode.INSUFFICIENT_STORAGE:
|
||||
- return INSTALL_STATUS_INSUFFICIENT_STORAGE;
|
||||
- case SplitInstallErrorCode.INVALID_REQUEST:
|
||||
- return INSTALL_STATUS_INVALID_REQUEST;
|
||||
- case SplitInstallErrorCode.MODULE_UNAVAILABLE:
|
||||
- return INSTALL_STATUS_MODULE_UNAVAILABLE;
|
||||
- case SplitInstallErrorCode.NETWORK_ERROR:
|
||||
- return INSTALL_STATUS_NETWORK_ERROR;
|
||||
- case SplitInstallErrorCode.NO_ERROR:
|
||||
- return INSTALL_STATUS_NO_ERROR;
|
||||
- case SplitInstallErrorCode.SERVICE_DIED:
|
||||
- return INSTALL_STATUS_SERVICE_DIED;
|
||||
- case SplitInstallErrorCode.SESSION_NOT_FOUND:
|
||||
- return INSTALL_STATUS_SESSION_NOT_FOUND;
|
||||
- case SplitInstallErrorCode.SPLITCOMPAT_COPY_ERROR:
|
||||
- return INSTALL_STATUS_SPLITCOMPAT_COPY_ERROR;
|
||||
- case SplitInstallErrorCode.SPLITCOMPAT_EMULATION_ERROR:
|
||||
- return INSTALL_STATUS_SPLITCOMPAT_EMULATION_ERROR;
|
||||
- case SplitInstallErrorCode.SPLITCOMPAT_VERIFICATION_ERROR:
|
||||
- return INSTALL_STATUS_SPLITCOMPAT_VERIFICATION_ERROR;
|
||||
- case SplitInstallErrorCode.INTERNAL_ERROR:
|
||||
- return INSTALL_STATUS_INTERNAL_ERROR;
|
||||
- default:
|
||||
- return INSTALL_STATUS_UNKNOWN_SPLITINSTALL_ERROR;
|
||||
- }
|
||||
+ @Override
|
||||
+ public void installDeferred(String moduleName) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,33 +123,4 @@ import java.util.Set;
|
||||
editor.apply();
|
||||
return modulesRequestedPreviously.contains(moduleName);
|
||||
}
|
||||
-
|
||||
- /** Records via UMA module install times divided into install steps. */
|
||||
- private void recordInstallTimes(String moduleName) {
|
||||
- recordInstallTime(moduleName, "", SplitInstallSessionStatus.UNKNOWN,
|
||||
- SplitInstallSessionStatus.INSTALLED);
|
||||
- recordInstallTime(moduleName, ".PendingDownload", SplitInstallSessionStatus.UNKNOWN,
|
||||
- SplitInstallSessionStatus.DOWNLOADING);
|
||||
- recordInstallTime(moduleName, ".Download", SplitInstallSessionStatus.DOWNLOADING,
|
||||
- SplitInstallSessionStatus.INSTALLING);
|
||||
- recordInstallTime(moduleName, ".Installing", SplitInstallSessionStatus.INSTALLING,
|
||||
- SplitInstallSessionStatus.INSTALLED);
|
||||
- }
|
||||
-
|
||||
- private void recordInstallTime(
|
||||
- String moduleName, String histogramSubname, int startKey, int endKey) {
|
||||
- assert mInstallTimesMap.containsKey(moduleName);
|
||||
- InstallTimes installTimes = mInstallTimesMap.get(moduleName);
|
||||
- if (installTimes.mInstallTimes.get(startKey) == 0
|
||||
- || installTimes.mInstallTimes.get(endKey) == 0) {
|
||||
- // Time stamps for install times have not been stored. Don't record anything to not skew
|
||||
- // data.
|
||||
- return;
|
||||
- }
|
||||
- RecordHistogram.recordLongTimesHistogram(
|
||||
- String.format("Android.FeatureModules.%sInstallDuration%s.%s",
|
||||
- installTimes.mIsCached ? "Cached" : "Uncached", histogramSubname,
|
||||
- moduleName),
|
||||
- installTimes.mInstallTimes.get(endKey) - installTimes.mInstallTimes.get(startKey));
|
||||
- }
|
||||
}
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -1,196 +0,0 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Wed, 15 May 2019 17:08:35 +0200
|
||||
Subject: Remove recent tabs signin
|
||||
|
||||
---
|
||||
.../chrome/browser/signin/SigninManager.java | 73 ++--------------------
|
||||
.../android/signin/signin_manager_android.cc | 3 +-
|
||||
2 files changed, 7 insertions(+), 69 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java
|
||||
@@ -27,10 +27,7 @@ import org.chromium.base.metrics.RecordUserAction;
|
||||
import org.chromium.base.task.PostTask;
|
||||
import org.chromium.chrome.browser.externalauth.ExternalAuthUtils;
|
||||
import org.chromium.chrome.browser.externalauth.UserRecoverableErrorHandler;
|
||||
-import org.chromium.components.signin.AccountIdProvider;
|
||||
import org.chromium.components.signin.AccountManagerFacade;
|
||||
-import org.chromium.components.signin.AccountTrackerService;
|
||||
-import org.chromium.components.signin.ChromeSigninController;
|
||||
import org.chromium.components.sync.AndroidSyncSettings;
|
||||
import org.chromium.content_public.browser.UiThreadTaskTraits;
|
||||
|
||||
@@ -47,7 +44,7 @@ import java.util.List;
|
||||
* <p/>
|
||||
* See chrome/browser/signin/signin_manager_android.h for more details.
|
||||
*/
|
||||
-public class SigninManager implements AccountTrackerService.OnSystemAccountsSeededListener {
|
||||
+public class SigninManager {
|
||||
private static final String TAG = "SigninManager";
|
||||
|
||||
/**
|
||||
@@ -183,7 +180,6 @@ public class SigninManager implements AccountTrackerService.OnSystemAccountsSeed
|
||||
*/
|
||||
private long mNativeSigninManagerAndroid;
|
||||
private final Context mContext;
|
||||
- private final AccountTrackerService mAccountTrackerService;
|
||||
private final AndroidSyncSettings mAndroidSyncSettings;
|
||||
private final ObserverList<SignInStateObserver> mSignInStateObservers = new ObserverList<>();
|
||||
private final ObserverList<SignInAllowedObserver> mSignInAllowedObservers =
|
||||
@@ -219,28 +215,24 @@ public class SigninManager implements AccountTrackerService.OnSystemAccountsSeed
|
||||
*/
|
||||
@CalledByNative
|
||||
private static SigninManager create(
|
||||
- long nativeSigninManagerAndroid, AccountTrackerService accountTrackerService) {
|
||||
+ long nativeSigninManagerAndroid) {
|
||||
assert nativeSigninManagerAndroid != 0;
|
||||
- assert accountTrackerService != null;
|
||||
return new SigninManager(ContextUtils.getApplicationContext(), nativeSigninManagerAndroid,
|
||||
- accountTrackerService, AndroidSyncSettings.get());
|
||||
+ AndroidSyncSettings.get());
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
SigninManager(Context context, long nativeSigninManagerAndroid,
|
||||
- AccountTrackerService accountTrackerService, AndroidSyncSettings androidSyncSettings) {
|
||||
+ AndroidSyncSettings androidSyncSettings) {
|
||||
ThreadUtils.assertOnUiThread();
|
||||
assert context != null;
|
||||
assert androidSyncSettings != null;
|
||||
mContext = context;
|
||||
mNativeSigninManagerAndroid = nativeSigninManagerAndroid;
|
||||
- mAccountTrackerService = accountTrackerService;
|
||||
mAndroidSyncSettings = androidSyncSettings;
|
||||
|
||||
mSigninAllowedByPolicy =
|
||||
SigninManagerJni.get().isSigninAllowedByPolicy(mNativeSigninManagerAndroid);
|
||||
-
|
||||
- mAccountTrackerService.addSystemAccountsSeededListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -249,7 +241,6 @@ public class SigninManager implements AccountTrackerService.OnSystemAccountsSeed
|
||||
*/
|
||||
@CalledByNative
|
||||
public void destroy() {
|
||||
- mAccountTrackerService.removeSystemAccountsSeededListener(this);
|
||||
mNativeSigninManagerAndroid = 0;
|
||||
}
|
||||
|
||||
@@ -286,8 +277,7 @@ public class SigninManager implements AccountTrackerService.OnSystemAccountsSeed
|
||||
* Returns true if signin can be started now.
|
||||
*/
|
||||
public boolean isSignInAllowed() {
|
||||
- return !mFirstRunCheckIsPending && mSignInState == null && mSigninAllowedByPolicy
|
||||
- && ChromeSigninController.get().getSignedInUser() == null && isSigninSupported();
|
||||
+ return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -344,27 +334,6 @@ public class SigninManager implements AccountTrackerService.OnSystemAccountsSeed
|
||||
}
|
||||
|
||||
/**
|
||||
- * Continue pending sign in after system accounts have been seeded into AccountTrackerService.
|
||||
- */
|
||||
- @Override
|
||||
- public void onSystemAccountsSeedingComplete() {
|
||||
- if (mSignInState != null && mSignInState.mBlockedOnAccountSeeding) {
|
||||
- mSignInState.mBlockedOnAccountSeeding = false;
|
||||
- progressSignInFlowCheckPolicy();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
- * Clear pending sign in when system accounts in AccountTrackerService were refreshed.
|
||||
- */
|
||||
- @Override
|
||||
- public void onSystemAccountsChanged() {
|
||||
- if (mSignInState != null) {
|
||||
- abortSignIn();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- /**
|
||||
* Starts the sign-in flow, and executes the callback when finished.
|
||||
*
|
||||
* If an activity is provided, it is considered an "interactive" sign-in and the user can be
|
||||
@@ -419,16 +388,7 @@ public class SigninManager implements AccountTrackerService.OnSystemAccountsSeed
|
||||
}
|
||||
|
||||
private void progressSignInFlowSeedSystemAccounts() {
|
||||
- if (mAccountTrackerService.checkAndSeedSystemAccounts()) {
|
||||
- progressSignInFlowCheckPolicy();
|
||||
- } else if (AccountIdProvider.getInstance().canBeUsed()) {
|
||||
- mSignInState.mBlockedOnAccountSeeding = true;
|
||||
- } else {
|
||||
- Activity activity = mSignInState.mActivity;
|
||||
- handleGooglePlayServicesUnavailability(activity, !isForceSigninEnabled());
|
||||
- Log.w(TAG, "Cancelling the sign-in process as Google Play services is unavailable");
|
||||
- abortSignIn();
|
||||
- }
|
||||
+ mSignInState.mBlockedOnAccountSeeding = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -462,18 +422,6 @@ public class SigninManager implements AccountTrackerService.OnSystemAccountsSeed
|
||||
// This method should be called at most once per sign-in flow.
|
||||
assert mSignInState != null;
|
||||
|
||||
- if (!SigninManagerJni.get().setPrimaryAccount(
|
||||
- mNativeSigninManagerAndroid, mSignInState.mAccount.name)) {
|
||||
- Log.w(TAG, "Failed to set the PrimaryAccount in IdentityManager, aborting signin");
|
||||
- abortSignIn();
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- // Cache the signed-in account name. This must be done after the native call, otherwise
|
||||
- // sync tries to start without being signed in natively and crashes.
|
||||
- ChromeSigninController.get().setSignedInAccountName(mSignInState.mAccount.name);
|
||||
- enableSync(mSignInState.mAccount);
|
||||
-
|
||||
if (mSignInState.mCallback != null) {
|
||||
mSignInState.mCallback.onSignInComplete();
|
||||
}
|
||||
@@ -640,10 +588,8 @@ public class SigninManager implements AccountTrackerService.OnSystemAccountsSeed
|
||||
|
||||
// Native sign-out must happen before resetting the account so data is deleted correctly.
|
||||
// http://crbug.com/589028
|
||||
- ChromeSigninController.get().setSignedInAccountName(null);
|
||||
if (mSignOutState.mWipeDataHooks != null) mSignOutState.mWipeDataHooks.preWipeData();
|
||||
disableSyncAndWipeData(mSignOutState.mShouldWipeUserData, this::onProfileDataWiped);
|
||||
- mAccountTrackerService.invalidateAccountSeedStatus(true);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -719,13 +665,6 @@ public class SigninManager implements AccountTrackerService.OnSystemAccountsSeed
|
||||
SigninManagerJni.get().stopApplyingCloudPolicy(mNativeSigninManagerAndroid);
|
||||
}
|
||||
|
||||
- private void enableSync(Account account) {
|
||||
- // Cache the signed-in account name. This must be done after the native call, otherwise
|
||||
- // sync tries to start without being signed in the native code and crashes.
|
||||
- mAndroidSyncSettings.updateAccount(account);
|
||||
- mAndroidSyncSettings.enableChromeSync();
|
||||
- }
|
||||
-
|
||||
private void disableSyncAndWipeData(
|
||||
boolean shouldWipeUserData, final Runnable wipeDataCallback) {
|
||||
mAndroidSyncSettings.updateAccount(null);
|
||||
diff --git a/chrome/browser/android/signin/signin_manager_android.cc b/chrome/browser/android/signin/signin_manager_android.cc
|
||||
--- a/chrome/browser/android/signin/signin_manager_android.cc
|
||||
+++ b/chrome/browser/android/signin/signin_manager_android.cc
|
||||
@@ -145,8 +145,7 @@ SigninManagerAndroid::SigninManagerAndroid(
|
||||
g_browser_process->local_state());
|
||||
|
||||
java_signin_manager_ = Java_SigninManager_create(
|
||||
- base::android::AttachCurrentThread(), reinterpret_cast<intptr_t>(this),
|
||||
- identity_manager_->LegacyGetAccountTrackerServiceJavaObject());
|
||||
+ base::android::AttachCurrentThread(), reinterpret_cast<intptr_t>(this));
|
||||
}
|
||||
|
||||
base::android::ScopedJavaLocalRef<jobject>
|
||||
--
|
||||
2.11.0
|
||||
|
1113
build/patches/Remove-signin-and-data-saver-integrations.patch
Normal file
1113
build/patches/Remove-signin-and-data-saver-integrations.patch
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,23 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Sun, 27 Oct 2019 10:00:13 +0100
|
||||
Subject: Replace DoH probe domain with RIPE domain
|
||||
|
||||
---
|
||||
net/dns/dns_transaction.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc
|
||||
--- a/net/dns/dns_transaction.cc
|
||||
+++ b/net/dns/dns_transaction.cc
|
||||
@@ -816,7 +816,7 @@ class DnsTCPAttempt : public DnsAttempt {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
-const char kDoHProbeHostname[] = "www.gstatic.com";
|
||||
+const char kDoHProbeHostname[] = "www.ripe.net";
|
||||
|
||||
const net::BackoffEntry::Policy kProbeBackoffPolicy = {
|
||||
// Apply exponential backoff rules after the first error.
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -45,7 +45,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggest
|
|||
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||||
--- a/chrome/browser/about_flags.cc
|
||||
+++ b/chrome/browser/about_flags.cc
|
||||
@@ -1961,6 +1961,9 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
@@ -1974,6 +1974,9 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
{"enable-homepage-tile", flag_descriptions::kHomepageTileName,
|
||||
flag_descriptions::kHomepageTileDescription, kOsAndroid,
|
||||
FEATURE_VALUE_TYPE(chrome::android::kHomepageTile)},
|
||||
|
@ -96,7 +96,7 @@ diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.js
|
|||
{
|
||||
+ "name": "enable-search-ready-omnibox",
|
||||
+ "owners": [ "mdjones" ],
|
||||
+ "expiry_milestone": 75
|
||||
+ "expiry_milestone": -1
|
||||
+ },
|
||||
+ {
|
||||
"name": "enable-send-tab-to-self",
|
||||
|
|
|
@ -6,12 +6,13 @@ Subject: Revert "Remove pre unified consent code in sync and privacy
|
|||
This reverts commit c672a0683e89eba3554e2562156b3c8532136f21.
|
||||
|
||||
Restore translations
|
||||
Restore contextual search preference toggle
|
||||
---
|
||||
.../android/java/res/xml/privacy_preferences.xml | 35 +++++
|
||||
.../android/java/res/xml/privacy_preferences.xml | 30 ++++
|
||||
.../preferences/privacy/PrivacyPreferences.java | 157 +++++++++++++++++++--
|
||||
.../preferences/sync/SyncPreferenceUtils.java | 5 +-
|
||||
.../browser/sync/SyncNotificationController.java | 17 ++-
|
||||
.../java/strings/android_chrome_strings.grd | 21 +++
|
||||
.../java/strings/android_chrome_strings.grd | 15 ++
|
||||
.../translations/android_chrome_strings_am.xtb | 19 ++-
|
||||
.../translations/android_chrome_strings_ar.xtb | 19 ++-
|
||||
.../translations/android_chrome_strings_bg.xtb | 19 ++-
|
||||
|
@ -66,12 +67,12 @@ Restore translations
|
|||
.../translations/android_chrome_strings_zh-TW.xtb | 19 ++-
|
||||
.../chromium/chrome/browser/sync/SyncTestRule.java | 9 +-
|
||||
.../org/chromium/chrome/browser/sync/UkmTest.java | 50 ++++++-
|
||||
59 files changed, 1208 insertions(+), 74 deletions(-)
|
||||
59 files changed, 1198 insertions(+), 73 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
--- a/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
+++ b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
@@ -7,6 +7,29 @@
|
||||
@@ -7,6 +7,24 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
|
@ -92,16 +93,11 @@ diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/androi
|
|||
+ android:key="safe_browsing"
|
||||
+ android:title="@string/safe_browsing_title"
|
||||
+ android:summary="@string/safe_browsing_summary" />
|
||||
+ <org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
+ android:key="network_predictions"
|
||||
+ android:title="@string/network_predictions_title"
|
||||
+ android:summary="@string/network_predictions_summary"
|
||||
+ android:persistent="false" />
|
||||
+ <org.chromium.chrome.browser.preferences.ChromeBaseCheckBoxPreference
|
||||
android:key="can_make_payment"
|
||||
android:title="@string/can_make_payment_title"
|
||||
android:summary="@string/settings_can_make_payment_toggle_label" />
|
||||
@@ -19,15 +42,27 @@
|
||||
@@ -19,15 +37,27 @@
|
||||
android:key="usage_stats_reporting"
|
||||
android:title="@string/usage_stats_setting_title"
|
||||
android:persistent="false" />
|
||||
|
@ -158,10 +154,9 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
+ "safe_browsing_scout_reporting";
|
||||
+ private static final String PREF_SAFE_BROWSING = "safe_browsing";
|
||||
private static final String PREF_CAN_MAKE_PAYMENT = "can_make_payment";
|
||||
- private static final String PREF_NETWORK_PREDICTIONS = "preload_pages";
|
||||
- private static final String PREF_USAGE_STATS = "usage_stats_reporting";
|
||||
+ private static final String PREF_CONTEXTUAL_SEARCH = "contextual_search";
|
||||
+ private static final String PREF_NETWORK_PREDICTIONS = "network_predictions";
|
||||
private static final String PREF_NETWORK_PREDICTIONS = "preload_pages";
|
||||
- private static final String PREF_USAGE_STATS = "usage_stats_reporting";
|
||||
private static final String PREF_DO_NOT_TRACK = "do_not_track";
|
||||
+ private static final String PREF_USAGE_AND_CRASH_REPORTING = "usage_and_crash_reports";
|
||||
+ private static final String PREF_CLEAR_BROWSING_DATA = "clear_browsing_data";
|
||||
|
@ -180,7 +175,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
|
||||
mManagedPreferenceDelegate = createManagedPreferenceDelegate();
|
||||
|
||||
@@ -62,26 +76,88 @@ public class PrivacyPreferences
|
||||
@@ -62,26 +76,90 @@ public class PrivacyPreferences
|
||||
networkPredictionPref.setOnPreferenceChangeListener(this);
|
||||
networkPredictionPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
|
||||
|
||||
|
@ -275,13 +270,15 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
PrefServiceBridge.getInstance().setNetworkPredictionEnabled((boolean) newValue);
|
||||
+ } else if (PREF_NAVIGATION_ERROR.equals(key)) {
|
||||
+ PrefServiceBridge.getInstance().setResolveNavigationErrorEnabled((boolean) newValue);
|
||||
+ } else if (PREF_CONTEXTUAL_SEARCH.equals(key)) {
|
||||
+ PrefServiceBridge.getInstance().setContextualSearchPreference(((boolean) newValue) ? "true" : "false");
|
||||
+ } else if (PREF_CAN_MAKE_PAYMENT.equals(key)) {
|
||||
+ PrefServiceBridge.getInstance().setBoolean(
|
||||
+ Pref.CAN_MAKE_PAYMENT_ENABLED, (boolean) newValue);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -99,9 +175,37 @@ public class PrivacyPreferences
|
||||
@@ -99,9 +177,37 @@ public class PrivacyPreferences
|
||||
public void updateSummaries() {
|
||||
PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();
|
||||
|
||||
|
@ -319,7 +316,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
CheckBoxPreference canMakePaymentPref =
|
||||
(CheckBoxPreference) findPreference(PREF_CAN_MAKE_PAYMENT);
|
||||
if (canMakePaymentPref != null) {
|
||||
@@ -114,6 +218,19 @@ public class PrivacyPreferences
|
||||
@@ -114,6 +220,19 @@ public class PrivacyPreferences
|
||||
doNotTrackPref.setSummary(prefServiceBridge.isDoNotTrackEnabled() ? textOn : textOff);
|
||||
}
|
||||
|
||||
|
@ -339,7 +336,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/pri
|
|||
Preference usageStatsPref = findPreference(PREF_USAGE_STATS);
|
||||
if (usageStatsPref != null) {
|
||||
if (BuildInfo.isAtLeastQ() && prefServiceBridge.getBoolean(Pref.USAGE_STATS_ENABLED)) {
|
||||
@@ -138,6 +255,18 @@ public class PrivacyPreferences
|
||||
@@ -138,6 +257,18 @@ public class PrivacyPreferences
|
||||
return preference -> {
|
||||
String key = preference.getKey();
|
||||
PrefServiceBridge prefs = PrefServiceBridge.getInstance();
|
||||
|
@ -441,20 +438,7 @@ diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/and
|
|||
<message name="IDS_SAFE_BROWSING_SCOUT_REPORTING_TITLE" desc="Title for checkbox that controls reporting data to detect bad apps/sites. Please ensure ‘Safe Browsing’ in this message matches the ‘Safe Browsing’ settings title.">
|
||||
Help improve Chrome security
|
||||
</message>
|
||||
@@ -740,6 +752,12 @@ CHAR-LIMIT guidelines:
|
||||
<message name="IDS_SAFE_BROWSING_SUMMARY" desc="Summary for safe browsing.">
|
||||
Sends URLs of some pages you visit to Google, when your security is at risk
|
||||
</message>
|
||||
+ <message name="IDS_NETWORK_PREDICTIONS_TITLE" desc="Title of a setting in Chrome settings. Followed by a body that describes the setting. If setting is turned on, Chrome will download certain pages to the user’s phone automatically for offline reading. 'predictions' convey the idea that Chrome is using predictive models to figure out pages likely of interest to the user.">
|
||||
+ Use page predictions
|
||||
+ </message>
|
||||
+ <message name="IDS_NETWORK_PREDICTIONS_SUMMARY" desc="Body text for the “Use page predictions” setting in Chrome settings. Describes what happens if the setting is turned on. 'Preload' conveys the idea that Chrome is getting pages for the user without their explicit interaction or consent.">
|
||||
+ Preload pages for faster loading and offline reading
|
||||
+ </message>
|
||||
<message name="IDS_CONTEXTUAL_SEARCH_TITLE" desc="Name for the Contextual Search feature, which allows users to search for a term in a web page by tapping on it.">
|
||||
Tap to Search
|
||||
</message>
|
||||
@@ -1506,6 +1524,9 @@ Your Google account may have other forms of browsing history like searches and a
|
||||
@@ -1506,6 +1518,9 @@ Your Google account may have other forms of browsing history like searches and a
|
||||
<message name="IDS_ACCOUNT_MANAGEMENT_TITLE" desc="Header title for the account management screen. [CHAR-LIMIT=32]">
|
||||
Signed in to Google as
|
||||
</message>
|
||||
|
|
|
@ -17,8 +17,8 @@ diff --git a/components/version_info/version_info.cc b/components/version_info/v
|
|||
|
||||
std::string GetProductNameAndVersionForUserAgent() {
|
||||
- return "Chrome/" + GetVersionNumber();
|
||||
+ // a common version for Android 8.1.0
|
||||
+ return "Chrome/77.0.3865.92";
|
||||
+ // latest stable version
|
||||
+ return "Chrome/78.0.3904.96";
|
||||
}
|
||||
|
||||
std::string GetProductName() {
|
||||
|
@ -30,7 +30,7 @@ diff --git a/content/common/user_agent.cc b/content/common/user_agent.cc
|
|||
}
|
||||
#elif defined(OS_ANDROID)
|
||||
- std::string android_version_str = base::SysInfo::OperatingSystemVersion();
|
||||
+ std::string android_version_str = "8.1.0";
|
||||
+ std::string android_version_str = "9.0.0";
|
||||
std::string android_info_str = GetAndroidOSInfo(include_android_build_number);
|
||||
#elif defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
// Should work on any Posix system.
|
||||
|
@ -49,7 +49,7 @@ diff --git a/content/common/user_agent.cc b/content/common/user_agent.cc
|
|||
- semicolon_inserted = true;
|
||||
- }
|
||||
+ // Send spoofed information about the device.
|
||||
+ std::string android_info_str = "; Moto G (5S) Plus";
|
||||
+ std::string android_info_str = "; SM-G955U";
|
||||
+ bool semicolon_inserted = true;
|
||||
|
||||
// Append the build ID.
|
||||
|
|
|
@ -1,211 +0,0 @@
|
|||
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
||||
Date: Fri, 30 Mar 2018 10:09:03 +0200
|
||||
Subject: getClientRects, getBoundingClientRect, measureText: add
|
||||
fingerprinting mitigation
|
||||
|
||||
Scale the result of Range::getClientRects, Element::getBoundingClientRect and
|
||||
Canvas::measureText by a random +/-3/1000000th of the original value for each
|
||||
float in the returned Rect/Quad.
|
||||
|
||||
Rationale is that the returned values are within the same order of magnitude
|
||||
of the floating point precision being used for fingerprinting and sufficient
|
||||
to poison the well.
|
||||
|
||||
See also: http://www.gsd.inesc-id.pt/~mpc/pubs/fingerprinting-trustcom2016.pdf
|
||||
---
|
||||
third_party/blink/renderer/core/dom/document.cc | 12 ++++++++++++
|
||||
third_party/blink/renderer/core/dom/document.h | 5 +++++
|
||||
third_party/blink/renderer/core/dom/element.cc | 16 ++++++++++++++++
|
||||
third_party/blink/renderer/core/dom/range.cc | 18 +++++++++++++++++-
|
||||
.../blink/renderer/core/html/canvas/text_metrics.cc | 18 ++++++++++++++++++
|
||||
.../blink/renderer/core/html/canvas/text_metrics.h | 2 ++
|
||||
.../canvas/canvas2d/canvas_rendering_context_2d.cc | 9 ++++++++-
|
||||
7 files changed, 78 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc
|
||||
--- a/third_party/blink/renderer/core/dom/document.cc
|
||||
+++ b/third_party/blink/renderer/core/dom/document.cc
|
||||
@@ -1167,6 +1167,10 @@ Document::Document(const DocumentInit& initializer,
|
||||
// also depend on the url NOT getting immediately set in opened windows.
|
||||
// See fast/dom/early-frame-url.html
|
||||
// and fast/dom/location-new-window-no-crash.html, respectively.
|
||||
+ // add X/Y noise factors that will be used to mitigate fingerprinting
|
||||
+ shuffleFactorX_ = base::RandDouble();
|
||||
+ shuffleFactorY_ = base::RandDouble();
|
||||
+
|
||||
// FIXME: Can/should we unify this behavior?
|
||||
if (initializer.ShouldSetURL()) {
|
||||
SetURL(initializer.Url());
|
||||
@@ -1227,6 +1231,14 @@ Range* Document::CreateRangeAdjustedToTreeScope(const TreeScope& tree_scope,
|
||||
Position::BeforeNode(*shadow_host));
|
||||
}
|
||||
|
||||
+double Document::GetShuffleFactorX() {
|
||||
+ return shuffleFactorX_;
|
||||
+}
|
||||
+
|
||||
+double Document::GetShuffleFactorY() {
|
||||
+ return shuffleFactorY_;
|
||||
+}
|
||||
+
|
||||
SelectorQueryCache& Document::GetSelectorQueryCache() {
|
||||
if (!selector_query_cache_)
|
||||
selector_query_cache_ = std::make_unique<SelectorQueryCache>();
|
||||
diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h
|
||||
--- a/third_party/blink/renderer/core/dom/document.h
|
||||
+++ b/third_party/blink/renderer/core/dom/document.h
|
||||
@@ -408,6 +408,9 @@ class CORE_EXPORT Document : public ContainerNode,
|
||||
has_xml_declaration_ = has_xml_declaration ? 1 : 0;
|
||||
}
|
||||
|
||||
+ double GetShuffleFactorX();
|
||||
+ double GetShuffleFactorY();
|
||||
+
|
||||
String visibilityState() const;
|
||||
bool IsPageVisible() const;
|
||||
bool hidden() const;
|
||||
@@ -1890,6 +1893,8 @@ class CORE_EXPORT Document : public ContainerNode,
|
||||
Vector<AXContext*> ax_contexts_;
|
||||
Member<AXObjectCache> ax_object_cache_;
|
||||
Member<DocumentMarkerController> markers_;
|
||||
+ double shuffleFactorX_, shuffleFactorY_;
|
||||
+
|
||||
|
||||
bool update_focus_appearance_after_layout_ = false;
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc
|
||||
--- a/third_party/blink/renderer/core/dom/element.cc
|
||||
+++ b/third_party/blink/renderer/core/dom/element.cc
|
||||
@@ -1630,6 +1630,15 @@ DOMRectList* Element::getClientRects() {
|
||||
DCHECK(element_layout_object);
|
||||
GetDocument().AdjustFloatQuadsForScrollAndAbsoluteZoom(
|
||||
quads, *element_layout_object);
|
||||
+
|
||||
+ // scale all quads
|
||||
+ auto shuffleX = 1 + (GetDocument().GetShuffleFactorX() - 0.5) * 0.000003;
|
||||
+ auto shuffleY = 1 + (GetDocument().GetShuffleFactorY() - 0.5) * 0.000003;
|
||||
+
|
||||
+ for (FloatQuad& quad : quads) {
|
||||
+ quad.Scale(shuffleX, shuffleY);
|
||||
+ }
|
||||
+
|
||||
return DOMRectList::Create(quads);
|
||||
}
|
||||
|
||||
@@ -1647,6 +1656,13 @@ DOMRect* Element::getBoundingClientRect() {
|
||||
DCHECK(element_layout_object);
|
||||
GetDocument().AdjustFloatRectForScrollAndAbsoluteZoom(result,
|
||||
*element_layout_object);
|
||||
+
|
||||
+ // scale rect by 3/1000000th
|
||||
+ auto shuffleX = 1 + (GetDocument().GetShuffleFactorX() - 0.5) * 0.000003;
|
||||
+ auto shuffleY = 1 + (GetDocument().GetShuffleFactorY() - 0.5) * 0.000003;
|
||||
+
|
||||
+ result.Scale(shuffleX, shuffleY);
|
||||
+
|
||||
return DOMRect::FromFloatRect(result);
|
||||
}
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/dom/range.cc b/third_party/blink/renderer/core/dom/range.cc
|
||||
--- a/third_party/blink/renderer/core/dom/range.cc
|
||||
+++ b/third_party/blink/renderer/core/dom/range.cc
|
||||
@@ -1631,11 +1631,27 @@ DOMRectList* Range::getClientRects() const {
|
||||
Vector<FloatQuad> quads;
|
||||
GetBorderAndTextQuads(quads);
|
||||
|
||||
+ // scale all quads by 3/1000000th
|
||||
+ auto shuffleX = 1 + (owner_document_->GetShuffleFactorX() - 0.5) * 0.000003;
|
||||
+ auto shuffleY = 1 + (owner_document_->GetShuffleFactorY() - 0.5) * 0.000003;
|
||||
+
|
||||
+ for (FloatQuad& quad : quads) {
|
||||
+ quad.Scale(shuffleX, shuffleY);
|
||||
+ }
|
||||
+
|
||||
return DOMRectList::Create(quads);
|
||||
}
|
||||
|
||||
DOMRect* Range::getBoundingClientRect() const {
|
||||
- return DOMRect::FromFloatRect(BoundingRect());
|
||||
+ auto rect = BoundingRect();
|
||||
+
|
||||
+ // scale rect by 3/1000000th
|
||||
+ auto shuffleX = 1 + (owner_document_->GetShuffleFactorX() - 0.5) * 0.000003;
|
||||
+ auto shuffleY = 1 + (owner_document_->GetShuffleFactorY() - 0.5) * 0.000003;
|
||||
+
|
||||
+ rect.Scale(shuffleX, shuffleY);
|
||||
+
|
||||
+ return DOMRect::FromFloatRect(rect);
|
||||
}
|
||||
|
||||
// TODO(editing-dev): We should make
|
||||
diff --git a/third_party/blink/renderer/core/html/canvas/text_metrics.cc b/third_party/blink/renderer/core/html/canvas/text_metrics.cc
|
||||
--- a/third_party/blink/renderer/core/html/canvas/text_metrics.cc
|
||||
+++ b/third_party/blink/renderer/core/html/canvas/text_metrics.cc
|
||||
@@ -54,6 +54,24 @@ TextMetrics::TextMetrics(const Font& font,
|
||||
Update(font, direction, baseline, align, text);
|
||||
}
|
||||
|
||||
+void TextMetrics::Shuffle(const double factor) {
|
||||
+ // x-direction
|
||||
+ width_ *= factor;
|
||||
+ actual_bounding_box_left_ *= factor;
|
||||
+ actual_bounding_box_right_ *= factor;
|
||||
+
|
||||
+ // y-direction
|
||||
+ font_bounding_box_ascent_ *= factor;
|
||||
+ font_bounding_box_descent_ *= factor;
|
||||
+ actual_bounding_box_ascent_ *= factor;
|
||||
+ actual_bounding_box_descent_ *= factor;
|
||||
+ em_height_ascent_ *= factor;
|
||||
+ em_height_descent_ *= factor;
|
||||
+ baselines_->setAlphabetic(baselines_->alphabetic() * factor);
|
||||
+ baselines_->setHanging(baselines_->hanging() * factor);
|
||||
+ baselines_->setIdeographic(baselines_->ideographic() * factor);
|
||||
+}
|
||||
+
|
||||
void TextMetrics::Update(const Font& font,
|
||||
const TextDirection& direction,
|
||||
const TextBaseline& baseline,
|
||||
diff --git a/third_party/blink/renderer/core/html/canvas/text_metrics.h b/third_party/blink/renderer/core/html/canvas/text_metrics.h
|
||||
--- a/third_party/blink/renderer/core/html/canvas/text_metrics.h
|
||||
+++ b/third_party/blink/renderer/core/html/canvas/text_metrics.h
|
||||
@@ -64,6 +64,8 @@ class CORE_EXPORT TextMetrics final : public ScriptWrappable {
|
||||
|
||||
void Trace(Visitor*) override;
|
||||
|
||||
+ void Shuffle(const double factor);
|
||||
+
|
||||
private:
|
||||
void Update(const Font&,
|
||||
const TextDirection&,
|
||||
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc
|
||||
--- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc
|
||||
+++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.cc
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d.h"
|
||||
|
||||
+#include "base/rand_util.h"
|
||||
#include "base/metrics/histogram_functions.h"
|
||||
#include "base/rand_util.h"
|
||||
#include "third_party/blink/public/common/features.h"
|
||||
@@ -811,9 +812,15 @@ TextMetrics* CanvasRenderingContext2D::measureText(const String& text) {
|
||||
else
|
||||
direction = ToTextDirection(GetState().GetDirection(), canvas());
|
||||
|
||||
- return MakeGarbageCollected<TextMetrics>(font, direction,
|
||||
+ auto *text_metrics = MakeGarbageCollected<TextMetrics>(font, direction,
|
||||
GetState().GetTextBaseline(),
|
||||
GetState().GetTextAlign(), text);
|
||||
+
|
||||
+ // scale text metrics by 3/1000000th
|
||||
+ auto shuffleFactor = 1 + (base::RandDouble() - 0.5) * 0.000003;
|
||||
+ text_metrics->Shuffle(shuffleFactor);
|
||||
+
|
||||
+ return text_metrics;
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::DrawTextInternal(
|
||||
--
|
||||
2.11.0
|
||||
|
|
@ -12,7 +12,7 @@ Subject: kill GCM
|
|||
.../invalidation/InvalidationController.java | 8 -
|
||||
.../browser/ntp/snippets/SnippetsLauncher.java | 44 -----
|
||||
.../browser/services/gcm/GCMBackgroundTask.java | 2 +-
|
||||
.../gcm/InvalidationGcmUpstreamSender.java | 15 --
|
||||
.../gcm/InvalidationGcmUpstreamSender.java | 18 --
|
||||
components/background_task_scheduler/BUILD.gn | 1 -
|
||||
.../BackgroundTaskSchedulerGcmNetworkManager.java | 206 +--------------------
|
||||
components/gcm_driver/android/BUILD.gn | 1 -
|
||||
|
@ -22,12 +22,12 @@ Subject: kill GCM
|
|||
third_party/cacheinvalidation/BUILD.gn | 6 -
|
||||
.../client/contrib/MultiplexingGcmListener.java | 91 +--------
|
||||
.../android2/channel/AndroidNetworkChannel.java | 6 +-
|
||||
19 files changed, 9 insertions(+), 594 deletions(-)
|
||||
19 files changed, 9 insertions(+), 597 deletions(-)
|
||||
|
||||
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
|
||||
--- a/chrome/android/BUILD.gn
|
||||
+++ b/chrome/android/BUILD.gn
|
||||
@@ -379,7 +379,6 @@ android_library("chrome_java") {
|
||||
@@ -378,7 +378,6 @@ android_library("chrome_java") {
|
||||
"//third_party/android_deps:com_google_protobuf_protobuf_lite_java",
|
||||
"//third_party/android_deps:javax_inject_javax_inject_java",
|
||||
"//third_party/android_media:android_media_java",
|
||||
|
@ -467,7 +467,17 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/services/gcm/In
|
|||
import com.google.ipc.invalidation.ticl.android2.channel.GcmUpstreamSenderService;
|
||||
|
||||
import org.chromium.base.ContextUtils;
|
||||
@@ -87,20 +86,6 @@ public class InvalidationGcmUpstreamSender extends GcmUpstreamSenderService {
|
||||
@@ -26,9 +25,6 @@ import org.chromium.components.signin.OAuth2TokenService;
|
||||
import org.chromium.components.sync.SyncConstants;
|
||||
import org.chromium.content_public.browser.UiThreadTaskTraits;
|
||||
|
||||
-import java.io.IOException;
|
||||
-import java.util.UUID;
|
||||
-
|
||||
/**
|
||||
* Sends Upstream messages for Invalidations using GCM.
|
||||
*/
|
||||
@@ -87,20 +83,6 @@ public class InvalidationGcmUpstreamSender extends GcmUpstreamSenderService {
|
||||
* This function runs on a thread pool executor thread.
|
||||
*/
|
||||
private void sendUpstreamMessage(String to, Bundle data, String token, Context context) {
|
||||
|
|
|
@ -66,7 +66,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/lan
|
|||
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
--- a/chrome/android/java/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/android/java/strings/android_chrome_strings.grd
|
||||
@@ -1217,9 +1217,6 @@ Your Google account may have other forms of browsing history like searches and a
|
||||
@@ -1211,9 +1211,6 @@ Your Google account may have other forms of browsing history like searches and a
|
||||
<message name="IDS_LANGUAGES_LIST_PREFS_DESCRIPTION" desc="Description on the Languages settings screen. Appears above a list of one or more languages that the user selects, to tell Chrome which languages they prefer to use to read website content.">
|
||||
Websites will show text in your preferred language, when possible.
|
||||
</message>
|
||||
|
|
Loading…
Add table
Reference in a new issue