summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornyquist@chromium.org <nyquist@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-13 19:24:32 +0000
committernyquist@chromium.org <nyquist@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-13 19:24:32 +0000
commit052f0983c534482292715f256fc99df4996ae6e7 (patch)
tree4a4c4ce16df61032e055330a7cbac3f9d31df22f
parent045fcdf74ef9856b6545d8759a7a898d6264fc1b (diff)
downloadchromium_src-052f0983c534482292715f256fc99df4996ae6e7.zip
chromium_src-052f0983c534482292715f256fc99df4996ae6e7.tar.gz
chromium_src-052f0983c534482292715f256fc99df4996ae6e7.tar.bz2
[sync] Add Android-specific machine tags for session sync.
This changes the session machine tag to be based on the Android ID for the Android port, with a fallback to use the same GUID generation as other platforms. BUG=None TEST=Inspect chrome://sync for an account that syncs tabs on an Android device. Review URL: https://chromiumcodereview.appspot.com/10758017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146615 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/glue/session_model_associator.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc
index e89980a..feef2cc 100644
--- a/chrome/browser/sync/glue/session_model_associator.cc
+++ b/chrome/browser/sync/glue/session_model_associator.cc
@@ -844,7 +844,16 @@ void SessionModelAssociator::InitializeCurrentMachineTag(
syncer::syncable::Directory* dir =
trans->GetWrappedWriteTrans()->directory();
current_machine_tag_ = "session_sync";
+#if defined(OS_ANDROID)
+ const std::string android_id = syncer::internal::GetAndroidId();
+ // There are reports that sometimes the android_id can't be read. Those
+ // are supposed to be fixed as of Gingerbread, but if it happens we fall
+ // back to use the same GUID generation as on other platforms.
+ current_machine_tag_.append(android_id.empty() ?
+ dir->cache_guid() : android_id);
+#else
current_machine_tag_.append(dir->cache_guid());
+#endif
DVLOG(1) << "Creating session sync guid: " << current_machine_tag_;
if (pref_service_)
pref_service_->SetString(kSyncSessionsGUID, current_machine_tag_);