Skip to content

Commit

Permalink
Fixes for C83 rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyBarabash committed Jun 3, 2020
1 parent 9134067 commit f64ec2a
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
import org.chromium.chrome.browser.settings.BravePreferenceFragment;
import org.chromium.chrome.browser.settings.SettingsActivity;
import org.chromium.chrome.browser.settings.SettingsLauncher;
import org.chromium.chrome.browser.settings.sync.ManageSyncSettings;
import org.chromium.chrome.browser.sync.settings.ManageSyncSettings;
import org.chromium.chrome.browser.sync.BraveSyncService;
import org.chromium.ui.KeyboardVisibilityDelegate;
import org.chromium.ui.base.DeviceFormFactor;
Expand Down
43 changes: 31 additions & 12 deletions android/java/res/xml/manage_sync_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,59 +5,78 @@
You can obtain one at http://mozilla.org/MPL/2.0/. -->

<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<org.chromium.chrome.browser.settings.ChromeSwitchPreference
<!-- This category is only shown for advanced sync consent flow. -->
<PreferenceCategory
android:key="syncing_category"
android:title="@string/syncing_category"
app:isPreferenceVisible="false"/>

<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="sync_everything"
android:title="@string/sync_everything_pref"
android:persistent="false"/>

<org.chromium.chrome.browser.settings.ChromeSwitchPreference
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="sync_autofill"
android:title="@string/sync_autofill"
android:persistent="false"/>

<org.chromium.chrome.browser.settings.ChromeSwitchPreference
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="sync_bookmarks"
android:title="@string/sync_bookmarks"
android:persistent="false"/>

<org.chromium.chrome.browser.settings.ChromeSwitchPreference
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="sync_payments_integration"
android:title="@string/sync_payments_integration"
android:persistent="false"/>

<org.chromium.chrome.browser.settings.ChromeSwitchPreference
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="sync_history"
android:title="@string/sync_history"
android:persistent="false"/>

<org.chromium.chrome.browser.settings.ChromeSwitchPreference
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="sync_recent_tabs"
android:title="@string/sync_recent_tabs"
android:persistent="false"/>

<org.chromium.chrome.browser.settings.ChromeSwitchPreference
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="sync_passwords"
android:title="@string/sync_passwords"
android:persistent="false"/>

<org.chromium.chrome.browser.settings.ChromeSwitchPreference
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="sync_settings"
android:title="@string/sync_settings"
android:persistent="false"/>

<org.chromium.chrome.browser.settings.ChromeBasePreference
<org.chromium.components.browser_ui.settings.ChromeBasePreference
android:key="google_activity_controls"
android:title="@string/sign_in_google_activity_controls_title"
android:summary="@string/sign_in_google_activity_controls_summary"/>

<org.chromium.chrome.browser.settings.ChromeBasePreference
<org.chromium.components.browser_ui.settings.ChromeBasePreference
android:key="encryption"
android:title="@string/sync_encryption"/>

<org.chromium.chrome.browser.settings.ChromeBasePreference
<org.chromium.components.browser_ui.settings.ChromeBasePreference
android:key="sync_manage_data"
android:title="@string/sync_manage_data"/>

<!-- This category is only shown for advanced sync consent flow. -->
<PreferenceCategory
android:key="search_and_browse_category"
android:title="@string/search_and_browse_category"
app:isPreferenceVisible="false">

<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="url_keyed_anonymized_data"
android:title="@string/url_keyed_anonymized_data_title"
android:summary="@string/url_keyed_anonymized_data_summary"/>
</PreferenceCategory>

</PreferenceScreen>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/base/android/java/src/org/chromium/base/CommandLine.java b/base/android/java/src/org/chromium/base/CommandLine.java
index 7a8dfd6b001e98660134d4480d5d42e96b9fac30..43c706b6760fb9bfdc4697a3475bb1650dfce848 100644
index 646a4f6dd560c44237f0e661c21e28df3f559777..c792e2d843810d739d35641b0b7cec1ff823e5eb 100644
--- a/base/android/java/src/org/chromium/base/CommandLine.java
+++ b/base/android/java/src/org/chromium/base/CommandLine.java
@@ -142,7 +142,11 @@ public abstract class CommandLine {
@@ -148,7 +148,11 @@ public abstract class CommandLine {
* @param file The fully qualified command line file.
*/
public static void initFromFile(String file) {
Expand Down
14 changes: 7 additions & 7 deletions patches/chrome-android-java-AndroidManifest.xml.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
index 6f50b67787561c523330b2eaa6522c517cb13eee..b5248da5b084206b6f15687abf89316c9333bc2c 100644
index 6f50b67787561c523330b2eaa6522c517cb13eee..7ae754ae2b13b349c2b667b42402d1a7a10a928d 100644
--- a/chrome/android/java/AndroidManifest.xml
+++ b/chrome/android/java/AndroidManifest.xml
@@ -34,7 +34,9 @@ by a child template that "extends" this file.
Expand All @@ -11,7 +11,7 @@ index 6f50b67787561c523330b2eaa6522c517cb13eee..b5248da5b084206b6f15687abf89316c
+-->
<uses-permission-sdk-23 android:name="android.permission.REORDER_TASKS"/>
<uses-permission-sdk-23 android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>

@@ -43,23 +45,33 @@ 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" />
Expand Down Expand Up @@ -49,11 +49,11 @@ index 6f50b67787561c523330b2eaa6522c517cb13eee..b5248da5b084206b6f15687abf89316c
@@ -100,7 +112,9 @@ 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 %}
@@ -126,6 +140,7 @@ by a child template that "extends" this file.
Expand All @@ -70,13 +70,13 @@ index 6f50b67787561c523330b2eaa6522c517cb13eee..b5248da5b084206b6f15687abf89316c
<meta-data android:name="com.google.ar.core" android:value="optional" />
+ <meta-data android:name="com.google.ar.core.min_apk_version" android:value="190603076"/><activity android:name="com.google.ar.core.InstallActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:excludeFromRecents="true" android:exported="false" android:launchMode="singleTop" android:theme="@android:style/Theme.Material.Light.Dialog.Alert" />
{% endif %}

<!-- Cast support -->
@@ -1295,6 +1311,7 @@ android:value="true" />
</activity>
{% endif %}

+ {% include "//brave/android/java/AndroidManifest.xml" %}
{% block extra_application_definitions %}

<!-- Media route controllers to use for remote playback (cast).

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/ManageSyncSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/ManageSyncSettings.java
index 4a7c610cec562ed067a86629b8a6f5d0b8758ddf..e5b2f7a726b7efe4d3f5dfe2322a1d375e49f631 100644
index 4a7c610cec562ed067a86629b8a6f5d0b8758ddf..12365d1cfdc23943dd6e0e3e224dccd2c107b178 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/ManageSyncSettings.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/ManageSyncSettings.java
@@ -64,7 +64,7 @@ import java.util.Set;
* Settings fragment to customize Sync options (data types, encryption). Can be accessed from
* {@link SyncAndServicesSettings}.
*/
-public class ManageSyncSettings extends PreferenceFragmentCompat
+public class ManageSyncSettings extends org.chromium.chrome.browser.settings.BravePreferenceFragment
implements PassphraseDialogFragment.Listener, PassphraseCreationDialogFragment.Listener,
PassphraseTypeDialogFragment.Listener, Preference.OnPreferenceChangeListener,
ProfileSyncService.SyncStateChangedListener {
@@ -88,15 +88,15 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
private final ProfileSyncService mProfileSyncService = ProfileSyncService.get();

@@ -116,15 +116,15 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
private PreferenceCategory mSyncingCategory;

private ChromeSwitchPreference mSyncEverything;
- private CheckBoxPreference mSyncAutofill;
- private CheckBoxPreference mSyncBookmarks;
Expand All @@ -32,13 +23,13 @@ index 4a7c610cec562ed067a86629b8a6f5d0b8758ddf..e5b2f7a726b7efe4d3f5dfe2322a1d37
// Contains preferences for all sync data types.
- private CheckBoxPreference[] mSyncTypePreferences;
+ private ChromeSwitchPreference[] mSyncTypePreferences;

private Preference mGoogleActivityControls;
private Preference mSyncEncryption;
@@ -114,14 +114,14 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
@@ -161,14 +161,14 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
mSyncEverything = (ChromeSwitchPreference) findPreference(PREF_SYNC_EVERYTHING);
mSyncEverything.setOnPreferenceChangeListener(this);

- mSyncAutofill = (CheckBoxPreference) findPreference(PREF_SYNC_AUTOFILL);
- mSyncBookmarks = (CheckBoxPreference) findPreference(PREF_SYNC_BOOKMARKS);
+ mSyncAutofill = (ChromeSwitchPreference) findPreference(PREF_SYNC_AUTOFILL);
Expand All @@ -54,12 +45,12 @@ index 4a7c610cec562ed067a86629b8a6f5d0b8758ddf..e5b2f7a726b7efe4d3f5dfe2322a1d37
+ mSyncPasswords = (ChromeSwitchPreference) findPreference(PREF_SYNC_PASSWORDS);
+ mSyncRecentTabs = (ChromeSwitchPreference) findPreference(PREF_SYNC_RECENT_TABS);
+ mSyncSettings = (ChromeSwitchPreference) findPreference(PREF_SYNC_SETTINGS);

mGoogleActivityControls = findPreference(PREF_GOOGLE_ACTIVITY_CONTROLS);
mSyncEncryption = findPreference(PREF_ENCRYPTION);
@@ -132,9 +132,9 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
@@ -179,9 +179,9 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
this, () -> SyncSettingsUtils.openSyncDashboard(getActivity())));

mSyncTypePreferences =
- new CheckBoxPreference[] {mSyncAutofill, mSyncBookmarks, mSyncPaymentsIntegration,
+ new ChromeSwitchPreference[] {mSyncAutofill, mSyncBookmarks, mSyncPaymentsIntegration,
Expand All @@ -68,30 +59,31 @@ index 4a7c610cec562ed067a86629b8a6f5d0b8758ddf..e5b2f7a726b7efe4d3f5dfe2322a1d37
+ for (ChromeSwitchPreference type : mSyncTypePreferences) {
type.setOnPreferenceChangeListener(this);
}

@@ -145,6 +145,11 @@ public class ManageSyncSettings extends PreferenceFragmentCompat

// Prevent sync settings changes from taking effect until the user leaves this screen.
mSyncSetupInProgressHandle = mProfileSyncService.getSetupInProgressHandle();
@@ -208,6 +208,11 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
mUrlKeyedAnonymizedData.setManagedPreferenceDelegate((
ChromeManagedPreferenceDelegate) (preference
-> UnifiedConsentServiceBridge.isUrlKeyedAnonymizedDataCollectionManaged()));
+
+ // TODO(alexey): subclass and pull out to avoid patch
+ getPreferenceScreen().removePreference(mGoogleActivityControls);
+ getPreferenceScreen().removePreference(mSyncEncryption);
+ getPreferenceScreen().removePreference(mManageSyncData);
}

@Override
@@ -218,7 +223,8 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
@@ -307,8 +312,8 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
* from this state.
*/
private void updateSyncPreferences() {
// TODO(crbug.com/1041815): Migrate away from ChromeSigninController and use IdentityManager
// instead.
- String signedInAccountName = ChromeSigninController.get().getSignedInAccountName();
- String signedInAccountName = CoreAccountInfo.getEmailFrom(
- IdentityServicesProvider.get().getIdentityManager().getPrimaryAccountInfo());
+ // TODO(alexey): subclass ChromeSigninController and override getSignedInAccountName to avoid patch: String signedInAccountName = ChromeSigninController.get().getSignedInAccountName();
+ String signedInAccountName = "BRAVE-STUB-ACCOUNT-NAME";
if (signedInAccountName == null) {
// May happen if account is removed from the device while this screen is shown.
getActivity().finish();
@@ -435,7 +441,7 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
@@ -525,7 +530,7 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
boolean syncEverything = mProfileSyncService.hasKeepEverythingSynced();
mSyncEverything.setChecked(syncEverything);
if (syncEverything) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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
index 0916e619f58d9146367a62c101ef9fdec0f5c0ad..75a77fca11887887e205c19ababab33b326a09d9 100644
index 0916e619f58d9146367a62c101ef9fdec0f5c0ad..4d31c93df65d805fe8e690f8ff9efd1ba22ea1ba 100644
--- a/components/sync/android/java/src/org/chromium/components/sync/AndroidSyncSettings.java
+++ b/components/sync/android/java/src/org/chromium/components/sync/AndroidSyncSettings.java
@@ -77,6 +77,7 @@ public class AndroidSyncSettings {
Expand Down

0 comments on commit f64ec2a

Please sign in to comment.