/* * meta/global callbacks. */ public void processMetaGlobal(MetaGlobal global) { config.metaGlobal = global; Long storageVersion = global.getStorageVersion(); if (storageVersion == null) { Logger.warn( LOG_TAG, "Malformed remote meta/global: could not retrieve remote storage version."); freshStart(); return; } if (storageVersion < STORAGE_VERSION) { Logger.warn( LOG_TAG, "Outdated server: reported " + "remote storage version " + storageVersion + " < " + "local storage version " + STORAGE_VERSION); freshStart(); return; } if (storageVersion > STORAGE_VERSION) { Logger.warn( LOG_TAG, "Outdated client: reported " + "remote storage version " + storageVersion + " > " + "local storage version " + STORAGE_VERSION); requiresUpgrade(); return; } String remoteSyncID = global.getSyncID(); if (remoteSyncID == null) { Logger.warn(LOG_TAG, "Malformed remote meta/global: could not retrieve remote syncID."); freshStart(); return; } String localSyncID = config.syncID; if (!remoteSyncID.equals(localSyncID)) { Logger.warn( LOG_TAG, "Remote syncID different from local syncID: resetting client and assuming remote syncID."); resetAllStages(); config.purgeCryptoKeys(); config.syncID = remoteSyncID; } // Compare lastModified timestamps for remote/local engine selection times. Logger.debug( LOG_TAG, "Comparing local engine selection timestamp [" + config.userSelectedEnginesTimestamp + "] to server meta/global timestamp [" + config.persistedMetaGlobal().lastModified() + "]."); if (config.userSelectedEnginesTimestamp < config.persistedMetaGlobal().lastModified()) { // Remote has later meta/global timestamp. Don't upload engine changes. config.userSelectedEngines = null; } // Persist enabled engine names. config.enabledEngineNames = global.getEnabledEngineNames(); if (config.enabledEngineNames == null) { Logger.warn(LOG_TAG, "meta/global reported no enabled engine names!"); } else { if (Logger.shouldLogVerbose(LOG_TAG)) { Logger.trace( LOG_TAG, "Persisting enabled engine names '" + Utils.toCommaSeparatedString(config.enabledEngineNames) + "' from meta/global."); } } config.persistToPrefs(); advance(); }