diff --git a/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java b/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java index b630782cd321..9cbde239f7c5 100644 --- a/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java +++ b/android/java/org/chromium/chrome/browser/settings/BraveSyncScreensPreference.java @@ -606,6 +606,7 @@ public boolean shouldLoadDevices() { //mainActivity.mBraveSyncWorker.InitV2(mSyncScreensObserver); mainActivity.mBraveSyncWorker.InitScreensObserver(mSyncScreensObserver); + // TODO, AB: need to split sync state observer and devices observer mainActivity.mBraveSyncWorker.HandleShowSetupUI(); } // TODO(sergz): Uncomment sync service impl when we fully migrate on sync v2 diff --git a/browser/android/brave_sync_worker.cc b/browser/android/brave_sync_worker.cc index dcbd9531cedd..4894e0db8dd4 100644 --- a/browser/android/brave_sync_worker.cc +++ b/browser/android/brave_sync_worker.cc @@ -121,7 +121,7 @@ DLOG(ERROR) << "[BraveSync] " << __func__ << " ProfileSyncServiceFactory::GetFor // See PeopleHandler::HandleShowSetupUI void BraveSyncWorker::HandleShowSetupUI(JNIEnv* env, const base::android::JavaParamRef& jcaller) { - +DLOG(ERROR) << "[BraveSync] " << __func__ << " 000"; syncer::SyncService* service = ProfileSyncServiceFactory::GetForProfile(profile_); @@ -133,10 +133,13 @@ void BraveSyncWorker::HandleShowSetupUI(JNIEnv* env, DeviceInfoSyncServiceFactory::GetForProfile(profile_) ->GetDeviceInfoTracker(); DCHECK(tracker); - if (tracker) { + if (tracker && !device_info_tracker_observer_.IsObserving(tracker) ) { device_info_tracker_observer_.Add(tracker); } + // TODO, AB: call SetSyncRequested(true) and sync_service_observer_ must be set and only if sync is not enabled + // The point when it is invoked when sync is enabled is above on the stack + // Mark Sync as requested by the user. It might already be requested, but // it's not if this is either the first time the user is setting up Sync, or // Sync was set up but then was reset via the dashboard. This also pokes the