Remove-signin-and-data-saver-integrations.patch 56 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070
  1. From: csagan5 <32685696+csagan5@users.noreply.github.com>
  2. Date: Tue, 12 Jun 2018 14:23:07 +0200
  3. Subject: Remove signin and data saver integrations
  4. Prevents authorization prompt for Play services on reboot
  5. Remove recent tabs signin
  6. Disable data saver
  7. Never show the data saver promo snackbar
  8. Disable unused permissions from manifest
  9. Disable sync adaptive and invalidation services from manifest
  10. More permissions removal from manifest
  11. Fix building with debug symbols:
  12. ld.lld: error: undefined symbol: notifier::NotifierOptions::NotifierOptions()
  13. >>> referenced by invalidation_service_util.cc:17 (../../components/invalidation/impl/invalidation_service_util.cc:17)
  14. >>> impl/invalidation_service_util.o:(invalidation::ParseNotifierOptions(base::CommandLine const&)) in archive obj/components/invalidation/impl/libimpl.a
  15. ---
  16. chrome/android/BUILD.gn | 3 +-
  17. chrome/android/java/AndroidManifest.xml | 18 --
  18. .../android/java/res/xml/main_preferences.xml | 9 -
  19. .../chrome/browser/app/ChromeActivity.java | 34 ----
  20. .../DataReductionPreferenceFragment.java | 24 +--
  21. .../privacy/settings/PrivacySettings.java | 44 +----
  22. .../chrome/browser/settings/MainSettings.java | 166 +-----------------
  23. .../chrome/browser/signin/SigninManager.java | 78 +-------
  24. .../browser/sync/AndroidSyncSettings.java | 28 +--
  25. .../settings/SyncAndServicesSettings.java | 8 -
  26. .../android/signin/signin_manager_android.cc | 1 -
  27. .../strings/android_chrome_strings.grd | 18 --
  28. .../signin/SystemAccountManagerDelegate.java | 38 +---
  29. .../net/HttpNegotiateAuthenticator.java | 88 +---------
  30. .../chromoting/base/OAuthTokenFetcher.java | 2 -
  31. 15 files changed, 26 insertions(+), 533 deletions(-)
  32. diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
  33. --- a/chrome/android/BUILD.gn
  34. +++ b/chrome/android/BUILD.gn
  35. @@ -1504,8 +1504,7 @@ jinja_template_resources("chrome_public_apk_template_resources") {
  36. resources = [
  37. "java/res_template/xml/file_paths.xml",
  38. "java/res_template/xml/launchershortcuts.xml",
  39. - "java/res_template/xml/searchable.xml",
  40. - "java/res_template/xml/syncadapter.xml",
  41. + "java/res_template/xml/searchable.xml"
  42. ]
  43. res_dir = "java/res_template"
  44. variables = [ "manifest_package=$chrome_public_manifest_package" ]
  45. diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
  46. --- a/chrome/android/java/AndroidManifest.xml
  47. +++ b/chrome/android/java/AndroidManifest.xml
  48. @@ -48,24 +48,18 @@ by a child template that "extends" this file.
  49. {% if target_sdk_version|int > 27 or target_sdk_version == "Q" %}
  50. <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
  51. {% endif %}
  52. - <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
  53. <uses-permission android:name="android.permission.INTERNET"/>
  54. - <uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
  55. <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
  56. <uses-permission android:name="android.permission.NFC"/>
  57. <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
  58. <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  59. - <uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
  60. - <uses-permission android:name="android.permission.READ_SYNC_STATS"/>
  61. <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
  62. <uses-permission android:name="android.permission.RECORD_AUDIO"/>
  63. - <uses-permission android:name="android.permission.USE_CREDENTIALS"/>
  64. <uses-permission-sdk-23 android:name="android.permission.USE_BIOMETRIC"/>
  65. <uses-permission-sdk-23 android:name="android.permission.USE_FINGERPRINT"/>
  66. <uses-permission android:name="android.permission.VIBRATE"/>
  67. <uses-permission android:name="android.permission.WAKE_LOCK"/>
  68. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  69. - <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
  70. {% set enable_vr = enable_vr|default(0) %}
  71. {% if enable_vr == "true" %}
  72. <!-- Indicates use of Android's VR-mode, available only on Android N+. -->
  73. @@ -107,8 +101,6 @@ by a child template that "extends" this file.
  74. <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
  75. <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
  76. - <uses-permission android:name="com.google.android.apps.now.CURRENT_ACCOUNT_ACCESS" />
  77. -
  78. {% block extra_uses_permissions %}
  79. {% endblock %}
  80. @@ -898,16 +890,6 @@ by a child template that "extends" this file.
  81. android:resource="@xml/file_paths" />
  82. </provider>
  83. - <!-- Sync adapter for browser invalidation. -->
  84. - <service android:name="org.chromium.chrome.browser.invalidation.ChromeBrowserSyncAdapterService"
  85. - android:exported="false">
  86. - <intent-filter>
  87. - <action android:name="android.content.SyncAdapter" />
  88. - </intent-filter>
  89. - <meta-data android:name="android.content.SyncAdapter"
  90. - android:resource="@xml/syncadapter" />
  91. - </service>
  92. -
  93. <!-- Broadcast receiver that will be notified of account changes -->
  94. <receiver android:name="org.chromium.chrome.browser.services.AccountsChangedReceiver"
  95. android:exported="true">
  96. diff --git a/chrome/android/java/res/xml/main_preferences.xml b/chrome/android/java/res/xml/main_preferences.xml
  97. --- a/chrome/android/java/res/xml/main_preferences.xml
  98. +++ b/chrome/android/java/res/xml/main_preferences.xml
  99. @@ -20,10 +20,6 @@
  100. android:order="2"
  101. android:title="@string/prefs_section_account_and_google_services"
  102. app:isPreferenceVisible="false"/>
  103. - <org.chromium.chrome.browser.sync.settings.SignInPreference
  104. - android:key="sign_in"
  105. - android:order="3"
  106. - android:title="@string/sign_in_to_chrome"/>
  107. <org.chromium.components.browser_ui.settings.ChromeBasePreference
  108. android:key="manage_sync"
  109. android:order="5"
  110. @@ -108,11 +104,6 @@
  111. android:key="languages"
  112. android:order="20"
  113. android:title="@string/language_settings"/>
  114. - <org.chromium.components.browser_ui.settings.ChromeBasePreference
  115. - android:fragment="org.chromium.chrome.browser.datareduction.settings.DataReductionPreferenceFragment"
  116. - android:key="data_reduction"
  117. - android:order="21"
  118. - android:title="@string/data_reduction_title_lite_mode"/>
  119. <org.chromium.components.browser_ui.settings.ChromeBasePreference
  120. android:fragment="org.chromium.chrome.browser.download.settings.DownloadSettings"
  121. android:key="downloads"
  122. diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java
  123. --- a/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java
  124. +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java
  125. @@ -133,8 +133,6 @@ import org.chromium.chrome.browser.settings.SettingsLauncher;
  126. import org.chromium.chrome.browser.settings.SettingsLauncherImpl;
  127. import org.chromium.chrome.browser.share.ShareDelegate;
  128. import org.chromium.chrome.browser.share.ShareDelegateImpl;
  129. -import org.chromium.chrome.browser.sync.ProfileSyncService;
  130. -import org.chromium.chrome.browser.sync.SyncController;
  131. import org.chromium.chrome.browser.tab.AccessibilityVisibilityHandler;
  132. import org.chromium.chrome.browser.tab.Tab;
  133. import org.chromium.chrome.browser.tab.TabHidingType;
  134. @@ -265,9 +263,6 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
  135. private boolean mRemoveWindowBackgroundDone;
  136. protected AccessibilityVisibilityHandler mAccessibilityVisibilityHandler;
  137. - // Observes when sync becomes ready to create the mContextReporter.
  138. - private ProfileSyncService.SyncStateChangedListener mSyncStateChangedListener;
  139. -
  140. // The PictureInPictureController is initialized lazily https://crbug.com/729738.
  141. private PictureInPictureController mPictureInPictureController;
  142. @@ -888,28 +883,6 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
  143. private void createContextReporterIfNeeded() {
  144. if (!mStarted) return; // Sync state reporting should work only in started state.
  145. if (mContextReporter != null || getActivityTab() == null) return;
  146. -
  147. - final SyncController syncController = SyncController.get();
  148. - final ProfileSyncService syncService = ProfileSyncService.get();
  149. -
  150. - if (syncController != null && syncController.isSyncingUrlsWithKeystorePassphrase()) {
  151. - assert syncService != null;
  152. - mContextReporter = AppHooks.get().createGsaHelper().getContextReporter(this);
  153. -
  154. - if (mSyncStateChangedListener != null) {
  155. - syncService.removeSyncStateChangedListener(mSyncStateChangedListener);
  156. - mSyncStateChangedListener = null;
  157. - }
  158. -
  159. - return;
  160. - } else {
  161. - ContextReporter.reportSyncStatus(syncService);
  162. - }
  163. -
  164. - if (mSyncStateChangedListener == null && syncService != null) {
  165. - mSyncStateChangedListener = () -> createContextReporterIfNeeded();
  166. - syncService.addSyncStateChangedListener(mSyncStateChangedListener);
  167. - }
  168. }
  169. @Override
  170. @@ -971,13 +944,6 @@ public abstract class ChromeActivity<C extends ChromeActivityComponent>
  171. if (GSAState.getInstance(this).isGsaAvailable() && !SysUtils.isLowEndDevice()) {
  172. GSAAccountChangeListener.getInstance().disconnect();
  173. }
  174. - if (mSyncStateChangedListener != null) {
  175. - ProfileSyncService syncService = ProfileSyncService.get();
  176. - if (syncService != null) {
  177. - syncService.removeSyncStateChangedListener(mSyncStateChangedListener);
  178. - }
  179. - mSyncStateChangedListener = null;
  180. - }
  181. if (mContextReporter != null) mContextReporter.disable();
  182. super.onStopWithNative();
  183. diff --git a/chrome/android/java/src/org/chromium/chrome/browser/datareduction/settings/DataReductionPreferenceFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/datareduction/settings/DataReductionPreferenceFragment.java
  184. --- a/chrome/android/java/src/org/chromium/chrome/browser/datareduction/settings/DataReductionPreferenceFragment.java
  185. +++ b/chrome/android/java/src/org/chromium/chrome/browser/datareduction/settings/DataReductionPreferenceFragment.java
  186. @@ -56,10 +56,10 @@ public class DataReductionPreferenceFragment extends PreferenceFragmentCompat {
  187. public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
  188. SettingsUtils.addPreferencesFromResource(this, R.xml.data_reduction_preferences);
  189. getActivity().setTitle(R.string.data_reduction_title_lite_mode);
  190. - boolean isEnabled = DataReductionProxySettings.getInstance().isDataReductionProxyEnabled();
  191. - mIsEnabled = !isEnabled;
  192. - mWasEnabledAtCreation = isEnabled;
  193. - updatePreferences(isEnabled);
  194. +
  195. + mIsEnabled = false;
  196. + mWasEnabledAtCreation = false;
  197. + updatePreferences(false);
  198. setHasOptionsMenu(true);
  199. @@ -175,21 +175,7 @@ public class DataReductionPreferenceFragment extends PreferenceFragmentCompat {
  200. * Returns summary string.
  201. */
  202. public static String generateSummary(Resources resources) {
  203. - if (DataReductionProxySettings.getInstance().isDataReductionProxyEnabled()) {
  204. - ContentLengths length = DataReductionProxySettings.getInstance().getContentLengths();
  205. -
  206. - // If received is less than show chart threshold than don't show summary.
  207. - if (ConversionUtils.bytesToKilobytes(length.getReceived())
  208. - < DataReductionProxySettings.DATA_REDUCTION_SHOW_CHART_KB_THRESHOLD) {
  209. - return "";
  210. - }
  211. -
  212. - String percent = generatePercentSavings(length);
  213. - return resources.getString(
  214. - R.string.data_reduction_menu_item_summary_lite_mode, percent);
  215. - } else {
  216. - return (String) resources.getText(R.string.text_off);
  217. - }
  218. + return (String) resources.getText(R.string.text_off);
  219. }
  220. /**
  221. diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
  222. --- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
  223. +++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
  224. @@ -27,9 +27,6 @@ import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate;
  225. import org.chromium.chrome.browser.settings.SettingsLauncher;
  226. import org.chromium.chrome.browser.settings.SettingsLauncherImpl;
  227. import org.chromium.chrome.browser.signin.IdentityServicesProvider;
  228. -import org.chromium.chrome.browser.sync.settings.GoogleServicesSettings;
  229. -import org.chromium.chrome.browser.sync.settings.ManageSyncSettings;
  230. -import org.chromium.chrome.browser.sync.settings.SyncAndServicesSettings;
  231. import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
  232. import org.chromium.components.browser_ui.settings.ManagedPreferenceDelegate;
  233. import org.chromium.components.browser_ui.settings.SettingsUtils;
  234. @@ -48,11 +45,10 @@ public class PrivacySettings
  235. private static final String PREF_NETWORK_PREDICTIONS = "preload_pages";
  236. private static final String PREF_SECURE_DNS = "secure_dns";
  237. private static final String PREF_DO_NOT_TRACK = "do_not_track";
  238. - private static final String PREF_SYNC_AND_SERVICES_LINK = "sync_and_services_link";
  239. private static final String PREF_CLEAR_BROWSING_DATA = "clear_browsing_data";
  240. private static final String[] NEW_PRIVACY_PREFERENCE_ORDER = {PREF_CLEAR_BROWSING_DATA,
  241. PREF_CAN_MAKE_PAYMENT, PREF_NETWORK_PREDICTIONS,
  242. - PREF_SECURE_DNS, PREF_DO_NOT_TRACK, PREF_SYNC_AND_SERVICES_LINK
  243. + PREF_SECURE_DNS, PREF_DO_NOT_TRACK
  244. };
  245. private ManagedPreferenceDelegate mManagedPreferenceDelegate;
  246. @@ -92,47 +88,9 @@ public class PrivacySettings
  247. Preference secureDnsPref = findPreference(PREF_SECURE_DNS);
  248. secureDnsPref.setVisible(SecureDnsSettings.isUiEnabled());
  249. - Preference syncAndServicesLink = findPreference(PREF_SYNC_AND_SERVICES_LINK);
  250. - syncAndServicesLink.setSummary(buildSyncAndServicesLink());
  251. -
  252. updateSummaries();
  253. }
  254. - private SpannableString buildSyncAndServicesLink() {
  255. - SettingsLauncher settingsLauncher = new SettingsLauncherImpl();
  256. - if (!ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)) {
  257. - NoUnderlineClickableSpan syncAndServicesLink =
  258. - new NoUnderlineClickableSpan(getResources(), v -> {
  259. - settingsLauncher.launchSettingsActivity(getActivity(),
  260. - SyncAndServicesSettings.class,
  261. - SyncAndServicesSettings.createArguments(false));
  262. - });
  263. - return SpanApplier.applySpans(getString(R.string.privacy_sync_and_services_link_legacy),
  264. - new SpanApplier.SpanInfo("<link>", "</link>", syncAndServicesLink));
  265. - }
  266. -
  267. - NoUnderlineClickableSpan servicesLink = new NoUnderlineClickableSpan(getResources(), v -> {
  268. - settingsLauncher.launchSettingsActivity(getActivity(), GoogleServicesSettings.class);
  269. - });
  270. - if (IdentityServicesProvider.get()
  271. - .getIdentityManager(Profile.getLastUsedRegularProfile())
  272. - .getPrimaryAccountInfo(ConsentLevel.SYNC)
  273. - == null) {
  274. - // Sync is off, show the string with one link to "Google Services".
  275. - return SpanApplier.applySpans(
  276. - getString(R.string.privacy_sync_and_services_link_sync_off),
  277. - new SpanApplier.SpanInfo("<link>", "</link>", servicesLink));
  278. - }
  279. - // Otherwise, show the string with both links to "Sync" and "Google Services".
  280. - NoUnderlineClickableSpan syncLink = new NoUnderlineClickableSpan(getResources(), v -> {
  281. - settingsLauncher.launchSettingsActivity(getActivity(), ManageSyncSettings.class,
  282. - ManageSyncSettings.createArguments(false));
  283. - });
  284. - return SpanApplier.applySpans(getString(R.string.privacy_sync_and_services_link_sync_on),
  285. - new SpanApplier.SpanInfo("<link1>", "</link1>", syncLink),
  286. - new SpanApplier.SpanInfo("<link2>", "</link2>", servicesLink));
  287. - }
  288. -
  289. @Override
  290. public boolean onPreferenceChange(Preference preference, Object newValue) {
  291. String key = preference.getKey();
  292. diff --git a/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java
  293. --- a/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java
  294. +++ b/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java
  295. @@ -19,10 +19,8 @@ import androidx.preference.PreferenceFragmentCompat;
  296. import org.chromium.base.ContextUtils;
  297. import org.chromium.chrome.R;
  298. -import org.chromium.chrome.browser.datareduction.settings.DataReductionPreferenceFragment;
  299. import org.chromium.chrome.browser.flags.ChromeFeatureList;
  300. import org.chromium.chrome.browser.homepage.HomepageManager;
  301. -import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
  302. import org.chromium.chrome.browser.night_mode.NightModeUtils;
  303. import org.chromium.chrome.browser.offlinepages.prefetch.PrefetchConfiguration;
  304. import org.chromium.chrome.browser.password_check.PasswordCheck;
  305. @@ -32,14 +30,7 @@ import org.chromium.chrome.browser.password_manager.PasswordManagerLauncher;
  306. import org.chromium.chrome.browser.profiles.Profile;
  307. import org.chromium.chrome.browser.safety_check.SafetyCheckSettingsFragment;
  308. import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
  309. -import org.chromium.chrome.browser.signin.IdentityServicesProvider;
  310. import org.chromium.chrome.browser.signin.SigninActivityLauncherImpl;
  311. -import org.chromium.chrome.browser.signin.SigninManager;
  312. -import org.chromium.chrome.browser.sync.ProfileSyncService;
  313. -import org.chromium.chrome.browser.sync.settings.ManageSyncSettings;
  314. -import org.chromium.chrome.browser.sync.settings.SignInPreference;
  315. -import org.chromium.chrome.browser.sync.settings.SyncPromoPreference;
  316. -import org.chromium.chrome.browser.sync.settings.SyncSettingsUtils;
  317. import org.chromium.chrome.browser.tracing.settings.DeveloperSettings;
  318. import org.chromium.components.browser_ui.settings.ChromeBasePreference;
  319. import org.chromium.components.browser_ui.settings.ManagedPreferenceDelegate;
  320. @@ -57,23 +48,17 @@ import java.util.Map;
  321. * The main settings screen, shown when the user first opens Settings.
  322. */
  323. public class MainSettings extends PreferenceFragmentCompat
  324. - implements TemplateUrlService.LoadListener, ProfileSyncService.SyncStateChangedListener,
  325. - SigninManager.SignInStateObserver {
  326. - public static final String PREF_SYNC_PROMO = "sync_promo";
  327. + implements TemplateUrlService.LoadListener {
  328. public static final String PREF_ACCOUNT_SECTION = "account_section";
  329. public static final String PREF_ACCOUNT_AND_GOOGLE_SERVICES_SECTION =
  330. "account_and_google_services_section";
  331. public static final String PREF_SIGN_IN = "sign_in";
  332. - public static final String PREF_SYNC_AND_SERVICES = "sync_and_services";
  333. - public static final String PREF_MANAGE_SYNC = "manage_sync";
  334. - public static final String PREF_GOOGLE_SERVICES = "google_services";
  335. public static final String PREF_SEARCH_ENGINE = "search_engine";
  336. public static final String PREF_PASSWORDS = "passwords";
  337. public static final String PREF_HOMEPAGE = "homepage";
  338. public static final String PREF_UI_THEME = "ui_theme";
  339. public static final String PREF_PRIVACY = "privacy";
  340. public static final String PREF_SAFETY_CHECK = "safety_check";
  341. - public static final String PREF_DATA_REDUCTION = "data_reduction";
  342. public static final String PREF_NOTIFICATIONS = "notifications";
  343. public static final String PREF_DOWNLOADS = "downloads";
  344. public static final String PREF_DEVELOPER = "developer";
  345. @@ -84,9 +69,6 @@ public class MainSettings extends PreferenceFragmentCompat
  346. private final ManagedPreferenceDelegate mManagedPreferenceDelegate;
  347. private final Map<String, Preference> mAllPreferences = new HashMap<>();
  348. - private SyncPromoPreference mSyncPromoPreference;
  349. - private SignInPreference mSignInPreference;
  350. - private ChromeBasePreference mManageSync;
  351. private @Nullable PasswordCheck mPasswordCheck;
  352. public MainSettings() {
  353. @@ -116,42 +98,12 @@ public class MainSettings extends PreferenceFragmentCompat
  354. @Override
  355. public void onDestroy() {
  356. super.onDestroy();
  357. - mSyncPromoPreference.onPreferenceFragmentDestroyed();
  358. - mSignInPreference.onPreferenceFragmentDestroyed();
  359. // The component should only be destroyed when the activity has been closed by the user
  360. // (e.g. by pressing on the back button) and not when the activity is temporarily destroyed
  361. // by the system.
  362. if (getActivity().isFinishing() && mPasswordCheck != null) PasswordCheckFactory.destroy();
  363. }
  364. - @Override
  365. - public void onStart() {
  366. - super.onStart();
  367. - SigninManager signinManager = IdentityServicesProvider.get().getSigninManager(
  368. - Profile.getLastUsedRegularProfile());
  369. - if (signinManager.isSigninSupported()) {
  370. - signinManager.addSignInStateObserver(this);
  371. - }
  372. - ProfileSyncService syncService = ProfileSyncService.get();
  373. - if (syncService != null) {
  374. - syncService.addSyncStateChangedListener(this);
  375. - }
  376. - }
  377. -
  378. - @Override
  379. - public void onStop() {
  380. - super.onStop();
  381. - SigninManager signinManager = IdentityServicesProvider.get().getSigninManager(
  382. - Profile.getLastUsedRegularProfile());
  383. - if (signinManager.isSigninSupported()) {
  384. - signinManager.removeSignInStateObserver(this);
  385. - }
  386. - ProfileSyncService syncService = ProfileSyncService.get();
  387. - if (syncService != null) {
  388. - syncService.removeSyncStateChangedListener(this);
  389. - }
  390. - }
  391. -
  392. @Override
  393. public void onResume() {
  394. super.onResume();
  395. @@ -170,12 +122,9 @@ public class MainSettings extends PreferenceFragmentCompat
  396. cachePreferences();
  397. - mSignInPreference.setOnStateChangedCallback(this::onSignInPreferenceStateChanged);
  398. -
  399. updatePasswordsPreference();
  400. setManagedPreferenceDelegateForPreference(PREF_SEARCH_ENGINE);
  401. - setManagedPreferenceDelegateForPreference(PREF_DATA_REDUCTION);
  402. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  403. // If we are on Android O+ the Notifications preference should lead to the Android
  404. @@ -214,17 +163,6 @@ public class MainSettings extends PreferenceFragmentCompat
  405. .setTitle(SafetyCheckSettingsFragment.getSafetyCheckSettingsElementTitle(
  406. getContext()));
  407. }
  408. -
  409. - // Replace the account section header, replace SyncAndServicesSettings with
  410. - // ManageSyncSettings and add GoogleServicesSettings row if this flag is enabled.
  411. - if (ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)) {
  412. - getPreferenceScreen().removePreference(findPreference(PREF_ACCOUNT_SECTION));
  413. - getPreferenceScreen().removePreference(findPreference(PREF_SYNC_AND_SERVICES));
  414. -
  415. - findPreference(PREF_ACCOUNT_AND_GOOGLE_SERVICES_SECTION).setVisible(true);
  416. - mManageSync.setVisible(true);
  417. - findPreference(PREF_GOOGLE_SERVICES).setVisible(true);
  418. - }
  419. }
  420. /**
  421. @@ -237,9 +175,6 @@ public class MainSettings extends PreferenceFragmentCompat
  422. Preference preference = getPreferenceScreen().getPreference(index);
  423. mAllPreferences.put(preference.getKey(), preference);
  424. }
  425. - mSyncPromoPreference = (SyncPromoPreference) mAllPreferences.get(PREF_SYNC_PROMO);
  426. - mSignInPreference = (SignInPreference) mAllPreferences.get(PREF_SIGN_IN);
  427. - mManageSync = (ChromeBasePreference) findPreference(PREF_MANAGE_SYNC);
  428. }
  429. private void setManagedPreferenceDelegateForPreference(String key) {
  430. @@ -248,15 +183,6 @@ public class MainSettings extends PreferenceFragmentCompat
  431. }
  432. private void updatePreferences() {
  433. - if (IdentityServicesProvider.get()
  434. - .getSigninManager(Profile.getLastUsedRegularProfile())
  435. - .isSigninSupported()) {
  436. - addPreferenceIfAbsent(PREF_SIGN_IN);
  437. - } else {
  438. - removePreferenceIfPresent(PREF_SIGN_IN);
  439. - }
  440. -
  441. - updateSyncPreference();
  442. updateSearchEnginePreference();
  443. Preference homepagePref = addPreferenceIfAbsent(PREF_HOMEPAGE);
  444. @@ -273,10 +199,6 @@ public class MainSettings extends PreferenceFragmentCompat
  445. } else {
  446. removePreferenceIfPresent(PREF_DEVELOPER);
  447. }
  448. -
  449. - ChromeBasePreference dataReduction =
  450. - (ChromeBasePreference) findPreference(PREF_DATA_REDUCTION);
  451. - dataReduction.setSummary(DataReductionPreferenceFragment.generateSummary(getResources()));
  452. }
  453. private Preference addPreferenceIfAbsent(String key) {
  454. @@ -290,55 +212,6 @@ public class MainSettings extends PreferenceFragmentCompat
  455. if (preference != null) getPreferenceScreen().removePreference(preference);
  456. }
  457. - private void updateSyncPreference() {
  458. - if (ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)) {
  459. - updateManageSyncPreference();
  460. - } else {
  461. - updateSyncAndServicesPreference();
  462. - }
  463. - }
  464. -
  465. - private void updateSyncAndServicesPreference() {
  466. - ChromeBasePreference preference = findPreference(PREF_SYNC_AND_SERVICES);
  467. - preference.setIcon(SyncSettingsUtils.getSyncStatusIcon(getActivity()));
  468. - preference.setSummary(SyncSettingsUtils.getSyncStatusSummary(getActivity()));
  469. - }
  470. -
  471. - private void updateManageSyncPreference() {
  472. - String primaryAccountName = CoreAccountInfo.getEmailFrom(
  473. - IdentityServicesProvider.get()
  474. - .getIdentityManager(Profile.getLastUsedRegularProfile())
  475. - .getPrimaryAccountInfo(ConsentLevel.NOT_REQUIRED));
  476. - boolean showManageSync =
  477. - ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)
  478. - && primaryAccountName != null;
  479. - mManageSync.setVisible(showManageSync);
  480. - if (!showManageSync) {
  481. - return;
  482. - }
  483. -
  484. - boolean isSyncConsentAvailable =
  485. - IdentityServicesProvider.get()
  486. - .getIdentityManager(Profile.getLastUsedRegularProfile())
  487. - .getPrimaryAccountInfo(ConsentLevel.SYNC)
  488. - != null;
  489. - mManageSync.setIcon(SyncSettingsUtils.getSyncStatusIcon(getActivity()));
  490. - mManageSync.setSummary(SyncSettingsUtils.getSyncStatusSummary(getActivity()));
  491. - mManageSync.setOnPreferenceClickListener(pref -> {
  492. - Context context = getContext();
  493. - if (ProfileSyncService.get().isSyncDisabledByEnterprisePolicy()) {
  494. - SyncSettingsUtils.showSyncDisabledByAdministratorToast(context);
  495. - } else if (isSyncConsentAvailable) {
  496. - SettingsLauncher settingsLauncher = new SettingsLauncherImpl();
  497. - settingsLauncher.launchSettingsActivity(context, ManageSyncSettings.class);
  498. - } else {
  499. - SigninActivityLauncherImpl.get().launchActivityForPromoDefaultFlow(
  500. - context, SigninAccessPoint.SETTINGS, primaryAccountName);
  501. - }
  502. - return true;
  503. - });
  504. - }
  505. -
  506. private void updateSearchEnginePreference() {
  507. if (!TemplateUrlServiceFactory.get().isLoaded()) {
  508. ChromeBasePreference searchEnginePref =
  509. @@ -370,30 +243,6 @@ public class MainSettings extends PreferenceFragmentCompat
  510. pref.setSummary(isOn ? R.string.text_on : R.string.text_off);
  511. }
  512. - // SigninManager.SignInStateObserver implementation.
  513. - @Override
  514. - public void onSignedIn() {
  515. - // After signing in or out of a managed account, preferences may change or become enabled
  516. - // or disabled.
  517. - new Handler().post(() -> updatePreferences());
  518. - }
  519. -
  520. - @Override
  521. - public void onSignedOut() {
  522. - updatePreferences();
  523. - }
  524. -
  525. - private void onSignInPreferenceStateChanged() {
  526. - // Remove "Account" section header if the personalized sign-in promo is shown. Remove
  527. - // "You and Google" section header if the personalized sync promo is shown.
  528. - boolean isShowingPersonalizedPromo =
  529. - mSignInPreference.getState() == SignInPreference.State.PERSONALIZED_PROMO;
  530. - String prefName = ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)
  531. - ? PREF_ACCOUNT_AND_GOOGLE_SERVICES_SECTION
  532. - : PREF_ACCOUNT_SECTION;
  533. - findPreference(prefName).setVisible(!isShowingPersonalizedPromo);
  534. - }
  535. -
  536. // TemplateUrlService.LoadListener implementation.
  537. @Override
  538. public void onTemplateUrlServiceLoaded() {
  539. @@ -401,11 +250,6 @@ public class MainSettings extends PreferenceFragmentCompat
  540. updateSearchEnginePreference();
  541. }
  542. - @Override
  543. - public void syncStateChanged() {
  544. - updateSyncPreference();
  545. - }
  546. -
  547. @VisibleForTesting
  548. public ManagedPreferenceDelegate getManagedPreferenceDelegateForTest() {
  549. return mManagedPreferenceDelegate;
  550. @@ -415,9 +259,6 @@ public class MainSettings extends PreferenceFragmentCompat
  551. return new ChromeManagedPreferenceDelegate() {
  552. @Override
  553. public boolean isPreferenceControlledByPolicy(Preference preference) {
  554. - if (PREF_DATA_REDUCTION.equals(preference.getKey())) {
  555. - return DataReductionProxySettings.getInstance().isDataReductionProxyManaged();
  556. - }
  557. if (PREF_SEARCH_ENGINE.equals(preference.getKey())) {
  558. return TemplateUrlServiceFactory.get().isDefaultSearchManaged();
  559. }
  560. @@ -426,11 +267,6 @@ public class MainSettings extends PreferenceFragmentCompat
  561. @Override
  562. public boolean isPreferenceClickDisabledByPolicy(Preference preference) {
  563. - if (PREF_DATA_REDUCTION.equals(preference.getKey())) {
  564. - DataReductionProxySettings settings = DataReductionProxySettings.getInstance();
  565. - return settings.isDataReductionProxyManaged()
  566. - && !settings.isDataReductionProxyEnabled();
  567. - }
  568. if (PREF_SEARCH_ENGINE.equals(preference.getKey())) {
  569. return TemplateUrlServiceFactory.get().isDefaultSearchManaged();
  570. }
  571. 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
  572. --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java
  573. +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java
  574. @@ -53,7 +53,7 @@ import java.util.List;
  575. * See chrome/browser/signin/signin_manager_android.h for more details.
  576. */
  577. public class SigninManager
  578. - implements AccountTrackerService.OnSystemAccountsSeededListener, IdentityManager.Observer {
  579. + implements IdentityManager.Observer {
  580. private static final String TAG = "SigninManager";
  581. /**
  582. @@ -205,7 +205,6 @@ public class SigninManager
  583. * This is not final, as destroy() updates this.
  584. */
  585. private long mNativeSigninManagerAndroid;
  586. - private final AccountTrackerService mAccountTrackerService;
  587. private final IdentityManager mIdentityManager;
  588. private final IdentityMutator mIdentityMutator;
  589. private final AndroidSyncSettings mAndroidSyncSettings;
  590. @@ -243,24 +242,22 @@ public class SigninManager
  591. */
  592. @CalledByNative
  593. private static SigninManager create(long nativeSigninManagerAndroid,
  594. - AccountTrackerService accountTrackerService, IdentityManager identityManager,
  595. + IdentityManager identityManager,
  596. IdentityMutator identityMutator) {
  597. assert nativeSigninManagerAndroid != 0;
  598. - assert accountTrackerService != null;
  599. assert identityManager != null;
  600. assert identityMutator != null;
  601. - return new SigninManager(nativeSigninManagerAndroid, accountTrackerService, identityManager,
  602. + return new SigninManager(nativeSigninManagerAndroid, identityManager,
  603. identityMutator, AndroidSyncSettings.get(), AppHooks.get().getExternalAuthUtils());
  604. }
  605. @VisibleForTesting
  606. - SigninManager(long nativeSigninManagerAndroid, AccountTrackerService accountTrackerService,
  607. + SigninManager(long nativeSigninManagerAndroid,
  608. IdentityManager identityManager, IdentityMutator identityMutator,
  609. AndroidSyncSettings androidSyncSettings, ExternalAuthUtils externalAuthUtils) {
  610. ThreadUtils.assertOnUiThread();
  611. assert androidSyncSettings != null;
  612. mNativeSigninManagerAndroid = nativeSigninManagerAndroid;
  613. - mAccountTrackerService = accountTrackerService;
  614. mIdentityManager = identityManager;
  615. mIdentityMutator = identityMutator;
  616. mAndroidSyncSettings = androidSyncSettings;
  617. @@ -269,7 +266,6 @@ public class SigninManager
  618. mSigninAllowedByPolicy =
  619. SigninManagerJni.get().isSigninAllowedByPolicy(mNativeSigninManagerAndroid);
  620. - mAccountTrackerService.addSystemAccountsSeededListener(this);
  621. mIdentityManager.addObserver(this);
  622. reloadAllAccountsFromSystem();
  623. @@ -303,7 +299,6 @@ public class SigninManager
  624. @CalledByNative
  625. public void destroy() {
  626. mIdentityManager.removeObserver(this);
  627. - mAccountTrackerService.removeSystemAccountsSeededListener(this);
  628. mNativeSigninManagerAndroid = 0;
  629. }
  630. @@ -342,9 +337,7 @@ public class SigninManager
  631. * Returns true if signin can be started now.
  632. */
  633. public boolean isSignInAllowed() {
  634. - return !mFirstRunCheckIsPending && mSignInState == null && mSigninAllowedByPolicy
  635. - && mIdentityManager.getPrimaryAccountInfo(ConsentLevel.SYNC) == null
  636. - && isSigninSupported();
  637. + return false;
  638. }
  639. /**
  640. @@ -399,17 +392,6 @@ public class SigninManager
  641. });
  642. }
  643. - /**
  644. - * Continue pending sign in after system accounts have been seeded into AccountTrackerService.
  645. - */
  646. - @Override
  647. - public void onSystemAccountsSeedingComplete() {
  648. - if (mSignInState != null && mSignInState.mBlockedOnAccountSeeding) {
  649. - mSignInState.mBlockedOnAccountSeeding = false;
  650. - progressSignInFlowCheckPolicy();
  651. - }
  652. - }
  653. -
  654. /**
  655. * Starts the sign-in flow, and executes the callback when finished.
  656. *
  657. @@ -499,11 +481,8 @@ public class SigninManager
  658. mSignInState = signinState;
  659. notifySignInAllowedChanged();
  660. - if (mAccountTrackerService.checkAndSeedSystemAccounts()) {
  661. - progressSignInFlowCheckPolicy();
  662. - } else {
  663. - mSignInState.mBlockedOnAccountSeeding = true;
  664. - }
  665. + abortSignIn();
  666. + //mSignInState.mBlockedOnAccountSeeding = true;
  667. }
  668. /**
  669. @@ -550,44 +529,6 @@ public class SigninManager
  670. mIdentityMutator.reloadAllAccountsFromSystemWithPrimaryAccount(
  671. mSignInState.mCoreAccountInfo.getId());
  672. - @ConsentLevel
  673. - int consentLevel =
  674. - mSignInState.shouldTurnSyncOn() ? ConsentLevel.SYNC : ConsentLevel.NOT_REQUIRED;
  675. - if (!mIdentityMutator.setPrimaryAccount(
  676. - mSignInState.mCoreAccountInfo.getId(), consentLevel)) {
  677. - Log.w(TAG, "Failed to set the PrimaryAccount in IdentityManager, aborting signin");
  678. - abortSignIn();
  679. - return;
  680. - }
  681. -
  682. - if (mSignInState.shouldTurnSyncOn()) {
  683. - // TODO(https://crbug.com/1091858): Remove this after migrating the legacy code that
  684. - // uses the sync account before the native is loaded.
  685. - SigninPreferencesManager.getInstance().setLegacySyncAccountEmail(
  686. - mSignInState.mCoreAccountInfo.getEmail());
  687. -
  688. - // Cache the signed-in account name. This must be done after the native call, otherwise
  689. - // sync tries to start without being signed in the native code and crashes.
  690. - mAndroidSyncSettings.updateAccount(
  691. - AccountUtils.createAccountFromName(mSignInState.mCoreAccountInfo.getEmail()));
  692. - boolean atLeastOneDataTypeSynced =
  693. - !ProfileSyncService.get().getChosenDataTypes().isEmpty();
  694. - if (!ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)
  695. - || atLeastOneDataTypeSynced) {
  696. - // Turn on sync only when user has at least one data type to sync, this is
  697. - // consistent with {@link ManageSyncSettings#updataSyncStateFromSelectedModelTypes},
  698. - // in which we turn off sync we stop sync service when the user toggles off all the
  699. - // sync types.
  700. - mAndroidSyncSettings.enableChromeSync();
  701. - }
  702. -
  703. - RecordUserAction.record("Signin_Signin_Succeed");
  704. - RecordHistogram.recordEnumeratedHistogram("Signin.SigninCompletedAccessPoint",
  705. - mSignInState.getAccessPoint(), SigninAccessPoint.MAX);
  706. - RecordHistogram.recordEnumeratedHistogram(
  707. - "Signin.SigninReason", SigninReason.SIGNIN_PRIMARY_ACCOUNT, SigninReason.MAX);
  708. - }
  709. -
  710. if (mSignInState.mCallback != null) {
  711. mSignInState.mCallback.onSignInComplete();
  712. }
  713. @@ -732,13 +673,8 @@ public class SigninManager
  714. Log.d(TAG, "On native signout, wipe user data: " + mSignOutState.mShouldWipeUserData);
  715. - // TODO(https://crbug.com/1091858): Remove this after migrating the legacy code that uses
  716. - // the sync account before the native is loaded.
  717. - SigninPreferencesManager.getInstance().setLegacySyncAccountEmail(null);
  718. -
  719. if (mSignOutState.mSignOutCallback != null) mSignOutState.mSignOutCallback.preWipeData();
  720. disableSyncAndWipeData(mSignOutState.mShouldWipeUserData, this::finishSignOut);
  721. - mAccountTrackerService.invalidateAccountSeedStatus(true);
  722. }
  723. void finishSignOut() {
  724. diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/AndroidSyncSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/AndroidSyncSettings.java
  725. --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/AndroidSyncSettings.java
  726. +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/AndroidSyncSettings.java
  727. @@ -223,10 +223,8 @@ public class AndroidSyncSettings {
  728. private void setChromeSyncEnabled(boolean value) {
  729. updateSyncability();
  730. - if (value == mChromeSyncEnabled || mAccount == null) return;
  731. + if (value == mChromeSyncEnabled) return;
  732. mChromeSyncEnabled = value;
  733. -
  734. - mSyncContentResolverDelegate.setSyncAutomatically(mAccount, mContractAuthority, value);
  735. notifyObservers();
  736. }
  737. @@ -275,27 +273,9 @@ public class AndroidSyncSettings {
  738. boolean oldChromeSyncEnabled = mChromeSyncEnabled;
  739. boolean oldMasterSyncEnabled = mMasterSyncEnabled;
  740. - if (mAccount != null) {
  741. - mIsSyncable =
  742. - mSyncContentResolverDelegate.getIsSyncable(mAccount, mContractAuthority) > 0;
  743. - mChromeSyncEnabled =
  744. - mSyncContentResolverDelegate.getSyncAutomatically(mAccount, mContractAuthority);
  745. - } else {
  746. - mIsSyncable = false;
  747. - mChromeSyncEnabled = false;
  748. - }
  749. - mMasterSyncEnabled = mSyncContentResolverDelegate.getMasterSyncAutomatically();
  750. -
  751. - if (mAccount != null && ProfileSyncService.get() != null
  752. - && ChromeFeatureList.isEnabled(
  753. - ChromeFeatureList.DECOUPLE_SYNC_FROM_ANDROID_MASTER_SYNC)
  754. - && mMasterSyncEnabled && !mShouldDecoupleSyncFromMasterSync) {
  755. - // Re-enabling master sync at least once should cause Sync to no longer care whether
  756. - // the former is enabled or not. This fact should be persisted via ProfileSyncService
  757. - // so it's known on the next startup.
  758. - mShouldDecoupleSyncFromMasterSync = true;
  759. - ProfileSyncService.get().setDecoupledFromAndroidMasterSync();
  760. - }
  761. + mIsSyncable = false;
  762. + mChromeSyncEnabled = false;
  763. + mMasterSyncEnabled = false;
  764. return oldChromeSyncEnabled != mChromeSyncEnabled
  765. || oldMasterSyncEnabled != mMasterSyncEnabled;
  766. diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SyncAndServicesSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SyncAndServicesSettings.java
  767. --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SyncAndServicesSettings.java
  768. +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SyncAndServicesSettings.java
  769. @@ -172,15 +172,7 @@ public class SyncAndServicesSettings extends PreferenceFragmentCompat
  770. mPrivacyPrefManager.migrateNetworkPredictionPreferences();
  771. - getActivity().setTitle(R.string.prefs_sync_and_services);
  772. setHasOptionsMenu(true);
  773. - if (mIsFromSigninScreen) {
  774. - ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
  775. - assert actionBar != null;
  776. - actionBar.setHomeActionContentDescription(
  777. - R.string.prefs_sync_and_services_content_description);
  778. - RecordUserAction.record("Signin_Signin_ShowAdvancedSyncSettings");
  779. - }
  780. SettingsUtils.addPreferencesFromResource(this, R.xml.sync_and_services_preferences);
  781. diff --git a/chrome/browser/android/signin/signin_manager_android.cc b/chrome/browser/android/signin/signin_manager_android.cc
  782. --- a/chrome/browser/android/signin/signin_manager_android.cc
  783. +++ b/chrome/browser/android/signin/signin_manager_android.cc
  784. @@ -141,7 +141,6 @@ SigninManagerAndroid::SigninManagerAndroid(
  785. java_signin_manager_ = Java_SigninManager_create(
  786. base::android::AttachCurrentThread(), reinterpret_cast<intptr_t>(this),
  787. - identity_manager_->LegacyGetAccountTrackerServiceJavaObject(),
  788. identity_manager_->GetJavaObject(),
  789. identity_manager_->GetIdentityMutatorJavaObject());
  790. }
  791. diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd
  792. --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd
  793. +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
  794. @@ -269,21 +269,12 @@ CHAR-LIMIT guidelines:
  795. <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]">
  796. Sign in to Chrome
  797. </message>
  798. - <message name="IDS_PREFS_SYNC_AND_SERVICES" desc="Title for Settings section to manage data collection for Sync and Google services. [CHAR-LIMIT=40]">
  799. - Sync and Google services
  800. - </message>
  801. - <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.">
  802. - 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
  803. - </message>
  804. <message name="IDS_SIGNIN_PREF_DISALLOWED_TITLE" desc="Title for the signin entry in Settings when signin is disallowed.">
  805. Not signed in
  806. </message>
  807. <message name="IDS_SIGNIN_PREF_SUMMARY" desc="Summary for the entry in Settings to sign in to Chrome, explaining benefits of signing in.">
  808. Sync and personalize across devices
  809. </message>
  810. - <message name="IDS_SYNC_AND_SERVICES_SUMMARY_SYNC_ON" desc="Summary for 'Sync and Google services' preference row when sync is enabled.">
  811. - Sync is on
  812. - </message>
  813. <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.">
  814. Disabled by the administrator of this device
  815. </message>
  816. @@ -345,15 +336,6 @@ CHAR-LIMIT guidelines:
  817. <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.">
  818. Sends URLs of pages you visit to Google
  819. </message>
  820. - <message name="IDS_PRIVACY_SYNC_AND_SERVICES_LINK_LEGACY" desc="The text for Privacy preferences that is shown after all preference rows.">
  821. - For more settings that relate to privacy, security, and data collection, see <ph name="BEGIN_LINK">&lt;link&gt;</ph>Sync and Google services<ph name="END_LINK">&lt;/link&gt;</ph>
  822. - </message>
  823. - <message name="IDS_PRIVACY_SYNC_AND_SERVICES_LINK_SYNC_ON" desc="The text for Privacy preferences that is shown after all preference rows. This version of the text is shown if Sync has been turned on.">
  824. - For more settings that relate to privacy, security, and data collection, see <ph name="BEGIN_LINK1">&lt;link1&gt;</ph>Sync<ph name="END_LINK1">&lt;/link1&gt;</ph> and <ph name="BEGIN_LINK2">&lt;link2&gt;</ph>Google services<ph name="END_LINK2">&lt;/link2&gt;</ph>
  825. - </message>
  826. - <message name="IDS_PRIVACY_SYNC_AND_SERVICES_LINK_SYNC_OFF" desc="The text for Privacy preferences that is shown after all preference rows. This version of the text is shown if Sync hasn't been turned on.">
  827. - For more settings that relate to privacy, security, and data collection, see <ph name="BEGIN_LINK">&lt;link&gt;</ph>Google services<ph name="END_LINK">&lt;/link&gt;</ph>
  828. - </message>
  829. <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.">
  830. Cancel sync?
  831. </message>
  832. 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
  833. --- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
  834. +++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
  835. @@ -172,16 +172,6 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
  836. @Override
  837. public boolean hasFeatures(Account account, String[] features) {
  838. - if (!hasGetAccountsPermission()) {
  839. - return false;
  840. - }
  841. - try {
  842. - return mAccountManager.hasFeatures(account, features, null, null).getResult();
  843. - } catch (AuthenticatorException | IOException e) {
  844. - Log.e(TAG, "Error while checking features: ", e);
  845. - } catch (OperationCanceledException e) {
  846. - Log.e(TAG, "Checking features was cancelled. This should not happen.");
  847. - }
  848. return false;
  849. }
  850. @@ -221,32 +211,10 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
  851. public void updateCredentials(
  852. Account account, Activity activity, final Callback<Boolean> callback) {
  853. ThreadUtils.assertOnUiThread();
  854. - if (!hasManageAccountsPermission()) {
  855. - if (callback != null) {
  856. - ThreadUtils.postOnUiThread(callback.bind(false));
  857. - }
  858. - return;
  859. + if (callback != null) {
  860. + ThreadUtils.postOnUiThread(callback.bind(false));
  861. }
  862. -
  863. - AccountManagerCallback<Bundle> realCallback = future -> {
  864. - Bundle bundle = null;
  865. - try {
  866. - bundle = future.getResult();
  867. - } catch (AuthenticatorException | IOException e) {
  868. - Log.e(TAG, "Error while update credentials: ", e);
  869. - } catch (OperationCanceledException e) {
  870. - Log.w(TAG, "Updating credentials was cancelled.");
  871. - }
  872. - boolean success =
  873. - bundle != null && bundle.getString(AccountManager.KEY_ACCOUNT_TYPE) != null;
  874. - if (callback != null) {
  875. - callback.onResult(success);
  876. - }
  877. - };
  878. - // Android 4.4 throws NullPointerException if null is passed
  879. - Bundle emptyOptions = new Bundle();
  880. - mAccountManager.updateCredentials(
  881. - account, "android", emptyOptions, activity, realCallback, null);
  882. + return;
  883. }
  884. @Nullable
  885. diff --git a/net/android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java b/net/android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java
  886. --- a/net/android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java
  887. +++ b/net/android/java/src/org/chromium/net/HttpNegotiateAuthenticator.java
  888. @@ -98,54 +98,8 @@ public class HttpNegotiateAuthenticator {
  889. @Override
  890. public void run(AccountManagerFuture<Account[]> future) {
  891. - Account[] accounts;
  892. - try {
  893. - accounts = future.getResult();
  894. - } catch (OperationCanceledException | AuthenticatorException | IOException e) {
  895. - Log.w(TAG, "ERR_UNEXPECTED: Error while attempting to retrieve accounts.", e);
  896. - HttpNegotiateAuthenticatorJni.get().setResult(mRequestData.nativeResultObject,
  897. - HttpNegotiateAuthenticator.this, NetError.ERR_UNEXPECTED, null);
  898. - return;
  899. - }
  900. -
  901. - if (accounts.length == 0) {
  902. - Log.w(TAG, "ERR_MISSING_AUTH_CREDENTIALS: No account provided for the kerberos "
  903. - + "authentication. Please verify the configuration policies and "
  904. - + "that the CONTACTS runtime permission is granted. ");
  905. - HttpNegotiateAuthenticatorJni.get().setResult(mRequestData.nativeResultObject,
  906. - HttpNegotiateAuthenticator.this, NetError.ERR_MISSING_AUTH_CREDENTIALS,
  907. - null);
  908. - return;
  909. - }
  910. -
  911. - if (accounts.length > 1) {
  912. - Log.w(TAG, "ERR_MISSING_AUTH_CREDENTIALS: Found %d accounts eligible for the "
  913. - + "kerberos authentication. Please fix the configuration by "
  914. - + "providing a single account.",
  915. - accounts.length);
  916. - HttpNegotiateAuthenticatorJni.get().setResult(mRequestData.nativeResultObject,
  917. - HttpNegotiateAuthenticator.this, NetError.ERR_MISSING_AUTH_CREDENTIALS,
  918. - null);
  919. - return;
  920. - }
  921. -
  922. - if (lacksPermission(ContextUtils.getApplicationContext(),
  923. - "android.permission.USE_CREDENTIALS", true)) {
  924. - // Protecting the AccountManager#getAuthToken call.
  925. - // API < 23 Requires the USE_CREDENTIALS permission or throws an exception.
  926. - // API >= 23 USE_CREDENTIALS permission is removed
  927. - Log.e(TAG, "ERR_MISCONFIGURED_AUTH_ENVIRONMENT: USE_CREDENTIALS permission not "
  928. - + "granted. Aborting authentication.");
  929. - HttpNegotiateAuthenticatorJni.get().setResult(mRequestData.nativeResultObject,
  930. - HttpNegotiateAuthenticator.this,
  931. - NetError.ERR_MISCONFIGURED_AUTH_ENVIRONMENT, null);
  932. - return;
  933. - }
  934. - mRequestData.account = accounts[0];
  935. - mRequestData.accountManager.getAuthToken(mRequestData.account,
  936. - mRequestData.authTokenType, mRequestData.options, true /* notifyAuthFailure */,
  937. - new GetTokenCallback(mRequestData),
  938. - new Handler(ThreadUtils.getUiThreadLooper()));
  939. + // account-based authentication removed for privacy-violations concerns
  940. + return;
  941. }
  942. }
  943. @@ -158,42 +112,8 @@ public class HttpNegotiateAuthenticator {
  944. @Override
  945. public void run(AccountManagerFuture<Bundle> future) {
  946. - Bundle result;
  947. - try {
  948. - result = future.getResult();
  949. - } catch (OperationCanceledException | AuthenticatorException | IOException e) {
  950. - Log.w(TAG, "ERR_UNEXPECTED: Error while attempting to obtain a token.", e);
  951. - HttpNegotiateAuthenticatorJni.get().setResult(mRequestData.nativeResultObject,
  952. - HttpNegotiateAuthenticator.this, NetError.ERR_UNEXPECTED, null);
  953. - return;
  954. - }
  955. -
  956. - if (result.containsKey(AccountManager.KEY_INTENT)) {
  957. - final Context appContext = ContextUtils.getApplicationContext();
  958. -
  959. - // We wait for a broadcast that should be sent once the user is done interacting
  960. - // with the notification
  961. - // TODO(dgn) We currently hang around if the notification is swiped away, until
  962. - // a LOGIN_ACCOUNTS_CHANGED_ACTION filter is received. It might be for something
  963. - // unrelated then we would wait again here. Maybe we should limit the number of
  964. - // retries in some way?
  965. - BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
  966. -
  967. - @Override
  968. - public void onReceive(Context context, Intent intent) {
  969. - appContext.unregisterReceiver(this);
  970. - mRequestData.accountManager.getAuthToken(mRequestData.account,
  971. - mRequestData.authTokenType, mRequestData.options,
  972. - true /* notifyAuthFailure */, new GetTokenCallback(mRequestData),
  973. - null);
  974. - }
  975. -
  976. - };
  977. - appContext.registerReceiver(broadcastReceiver,
  978. - new IntentFilter(AccountManager.LOGIN_ACCOUNTS_CHANGED_ACTION));
  979. - } else {
  980. - processResult(result, mRequestData);
  981. - }
  982. + // account-based authentication removed for privacy-violations concerns
  983. + return;
  984. }
  985. }
  986. diff --git a/remoting/android/java/src/org/chromium/chromoting/base/OAuthTokenFetcher.java b/remoting/android/java/src/org/chromium/chromoting/base/OAuthTokenFetcher.java
  987. --- a/remoting/android/java/src/org/chromium/chromoting/base/OAuthTokenFetcher.java
  988. +++ b/remoting/android/java/src/org/chromium/chromoting/base/OAuthTokenFetcher.java
  989. @@ -93,7 +93,6 @@ public class OAuthTokenFetcher {
  990. /** Begins fetching a token. Should be called on the main thread. */
  991. public void fetch() {
  992. - fetchImpl(null);
  993. }
  994. /**
  995. @@ -102,7 +101,6 @@ public class OAuthTokenFetcher {
  996. * @param expiredToken A previously-fetched token which has expired.
  997. */
  998. public void clearAndFetch(String expiredToken) {
  999. - fetchImpl(expiredToken);
  1000. }
  1001. private void fetchImpl(final String expiredToken) {
  1002. --
  1003. 2.17.1