author | Bryan Kok <bryan.wyern1@gmail.com> |
Mon, 21 Jul 2014 11:13:24 -0700 | |
changeset 195374 | 70afb8fb9ae5766c32d223a4803f55c3f49ca123 |
parent 195373 | 476a0455e0e816fe60cc1a6d0dfb893400873041 |
child 195375 | bf683354136b12ac2836e30ae40b12892ded6dbb |
push id | 46575 |
push user | kwierso@gmail.com |
push date | Tue, 22 Jul 2014 00:35:21 +0000 |
treeherder | mozilla-inbound@fee5c4bdd713 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | nalexander |
bugs | 1019719 |
milestone | 33.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/mobile/android/base/fxa/activities/FxAccountStatusFragment.java +++ b/mobile/android/base/fxa/activities/FxAccountStatusFragment.java @@ -343,17 +343,17 @@ public class FxAccountStatusFragment * @param fxAccount new instance. */ public void refresh(AndroidFxAccount fxAccount) { if (fxAccount == null) { throw new IllegalArgumentException("fxAccount must not be null"); } this.fxAccount = fxAccount; try { - this.clientsDataDelegate = new SharedPreferencesClientsDataDelegate(fxAccount.getSyncPrefs()); + this.clientsDataDelegate = new SharedPreferencesClientsDataDelegate(fxAccount.getSyncPrefs(), getActivity().getApplicationContext()); } catch (Exception e) { Logger.error(LOG_TAG, "Got exception fetching Sync prefs associated to Firefox Account; aborting.", e); // Something is terribly wrong; best to get a stack trace rather than // continue with a null clients delegate. throw new IllegalStateException(e); } handler = new Handler(); // Attached to current (assumed to be UI) thread.
--- a/mobile/android/base/fxa/sync/FxAccountSyncAdapter.java +++ b/mobile/android/base/fxa/sync/FxAccountSyncAdapter.java @@ -352,17 +352,17 @@ public class FxAccountSyncAdapter extend } // Invalidate the previous backoff, because our storage host has changed, // or we never had one at all, or we're OK to sync. storageBackoffHandler.setEarliestNextRequest(0L); FxAccountGlobalSession globalSession = null; try { - final ClientsDataDelegate clientsDataDelegate = new SharedPreferencesClientsDataDelegate(sharedPrefs); + final ClientsDataDelegate clientsDataDelegate = new SharedPreferencesClientsDataDelegate(sharedPrefs, getContext()); if (FxAccountConstants.LOG_PERSONAL_INFORMATION) { FxAccountConstants.pii(LOG_TAG, "Client device name is: '" + clientsDataDelegate.getClientName() + "'."); FxAccountConstants.pii(LOG_TAG, "Client device data last modified: " + clientsDataDelegate.getLastModifiedTimestamp()); } // We compute skew over time using SkewHandler. This yields an unchanging // skew adjustment that the HawkAuthHeaderProvider uses to adjust its // timestamps. Eventually we might want this to adapt within the scope of a
--- a/mobile/android/base/locales/en-US/sync_strings.dtd +++ b/mobile/android/base/locales/en-US/sync_strings.dtd @@ -29,26 +29,26 @@ <!-- Account Login Screen --> <!ENTITY sync.subtitle.account.label 'Enter your &syncBrand.fullName.label; account information'> <!ENTITY sync.input.username.label 'Account Name'> <!ENTITY sync.input.password.label 'Password'> <!ENTITY sync.input.key.label 'Recovery Key'> <!ENTITY sync.checkbox.server.label 'Use custom server'> <!ENTITY sync.input.server.label 'Server URL'> - + <!-- Setup Fail --> <!ENTITY sync.title.fail.label 'Cannot Set Up &syncBrand.shortName.label;'> <!ENTITY sync.subtitle.fail.label '&syncBrand.fullName.label; could not connect to the server. Would you like to try again?'> <!ENTITY sync.button.tryagain.label 'Try again'> <!ENTITY sync.button.manual.label 'Manual Setup'> <!ENTITY sync.subtitle.nointernet.label 'No internet connection available.'> <!ENTITY sync.subtitle.failaccount.label 'Account creation on your device failed.'> <!ENTITY sync.subtitle.failmultiple.label 'Do you have more than one Firefox installed? Currently, &syncBrand.fullName.label; only supports one Firefox installation at a time. Please uninstall other instances to use &syncBrand.shortName.label;.'> - + <!-- Setup Success --> <!ENTITY sync.title.success.label 'Setup Complete'> <!ENTITY sync.subtitle.success.label1 'Your data is now being downloaded in the background. You can go to Settings to manage your account, or start browsing with &brandShortName;.'> <!ENTITY sync.settings.label 'Settings'> <!ENTITY sync.subtitle.manage.label1 'Your &syncBrand.fullName.label; account is already set up. You can go to Settings to manage your account, or launch &brandShortName;.'> <!-- Pair Device --> <!ENTITY sync.pair.tryagain.label 'Please try again.'> @@ -69,16 +69,23 @@ <!-- Common text --> <!ENTITY sync.button.cancel.label 'Cancel'> <!ENTITY sync.button.connect.label 'Connect'> <!ENTITY sync.button.ok.label 'OK'> <!-- Account strings --> <!ENTITY sync.account.label '&syncBrand.fullName.label; (deprecated)'> +<!-- Localization note (sync.default.client.name): Default string of the "Device name" menu item upon setting up Firefox Sync. + The placeholder &formatS1 will be replaced by the name of the Firefox release channel and &formatS2 by the model name of the + Android device. Examples: + Aurora on GT-I1950 + Fennec on MI 2S --> +<!ENTITY sync.default.client.name '&formatS1; on &formatS2;'> + <!-- Bookmark folder strings --> <!ENTITY bookmarks.folder.menu.label 'Bookmarks Menu'> <!ENTITY bookmarks.folder.places.label ''> <!ENTITY bookmarks.folder.tags.label 'Tags'> <!ENTITY bookmarks.folder.toolbar.label 'Bookmarks Toolbar'> <!ENTITY bookmarks.folder.unfiled.label 'Unsorted Bookmarks'> <!ENTITY bookmarks.folder.desktop.label 'Desktop Bookmarks'> <!ENTITY bookmarks.folder.mobile.label 'Mobile Bookmarks'>
--- a/mobile/android/base/sync/SharedPreferencesClientsDataDelegate.java +++ b/mobile/android/base/sync/SharedPreferencesClientsDataDelegate.java @@ -1,28 +1,32 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ package org.mozilla.gecko.sync; import org.mozilla.gecko.background.common.GlobalConstants; import org.mozilla.gecko.sync.delegates.ClientsDataDelegate; +import org.mozilla.gecko.R; +import android.content.Context; import android.content.SharedPreferences; /** * A <code>ClientsDataDelegate</code> implementation that persists to a * <code>SharedPreferences</code> instance. */ public class SharedPreferencesClientsDataDelegate implements ClientsDataDelegate { protected final SharedPreferences sharedPreferences; + protected final Context context; - public SharedPreferencesClientsDataDelegate(SharedPreferences sharedPreferences) { + public SharedPreferencesClientsDataDelegate(SharedPreferences sharedPreferences, Context context) { this.sharedPreferences = sharedPreferences; + this.context = context; } @Override public synchronized String getAccountGUID() { String accountGUID = sharedPreferences.getString(SyncConfiguration.PREF_ACCOUNT_GUID, null); if (accountGUID == null) { accountGUID = Utils.generateGuid(); sharedPreferences.edit().putString(SyncConfiguration.PREF_ACCOUNT_GUID, accountGUID).commit(); @@ -41,18 +45,25 @@ public class SharedPreferencesClientsDat .edit() .putString(SyncConfiguration.PREF_CLIENT_NAME, clientName) .putLong(SyncConfiguration.PREF_CLIENT_DATA_TIMESTAMP, now) .commit(); } @Override public String getDefaultClientName() { - // Bug 1019719: localize this string! - return GlobalConstants.MOZ_APP_DISPLAYNAME + " on " + android.os.Build.MODEL; + String name = GlobalConstants.MOZ_APP_DISPLAYNAME; + if (name.contains("Aurora")) { + name = "Aurora"; + } else if (name.contains("Beta")) { + name = "Beta"; + } else if (name.contains("Nightly")) { + name = "Nightly"; + } + return context.getResources().getString(R.string.sync_default_client_name, name, android.os.Build.MODEL); } @Override public synchronized String getClientName() { String clientName = sharedPreferences.getString(SyncConfiguration.PREF_CLIENT_NAME, null); if (clientName == null) { clientName = getDefaultClientName(); long now = System.currentTimeMillis();
--- a/mobile/android/base/sync/syncadapter/SyncAdapter.java +++ b/mobile/android/base/sync/syncadapter/SyncAdapter.java @@ -336,17 +336,17 @@ public class SyncAdapter extends Abstrac } // Support multiple accounts by mapping each server/account pair to a branch of the // shared preferences space. final String product = GlobalConstants.BROWSER_INTENT_PACKAGE; final String profile = Constants.DEFAULT_PROFILE; final long version = SyncConfiguration.CURRENT_PREFS_VERSION; self.accountSharedPreferences = Utils.getSharedPreferences(mContext, product, username, serverURL, profile, version); - self.clientsDataDelegate = new SharedPreferencesClientsDataDelegate(accountSharedPreferences); + self.clientsDataDelegate = new SharedPreferencesClientsDataDelegate(accountSharedPreferences, mContext); self.backoffHandler = new PrefsBackoffHandler(accountSharedPreferences, SyncConstants.BACKOFF_PREF_SUFFIX_11); final String nodeWeaveURL = Utils.nodeWeaveURL(serverURL, username); self.nodeAssignmentDelegate = new SharedPreferencesNodeAssignmentCallback(accountSharedPreferences, nodeWeaveURL); Logger.info(LOG_TAG, "Client is named '" + clientsDataDelegate.getClientName() + "'" + ", has client guid " + clientsDataDelegate.getAccountGUID() + ", and has " + clientsDataDelegate.getClientsCount() + " clients.");
--- a/mobile/android/services/strings.xml.in +++ b/mobile/android/services/strings.xml.in @@ -92,16 +92,17 @@ <string name="sync_new_tab">&new_tab;</string> <string name="sync_title_send_tab">&sync.title.send.tab.label;</string> <string name="sync_button_send">&sync.button.send.label;</string> <string name="sync_button_set_up_sync">&sync.button.set.up.sync.label;</string> <string name="sync_title_redirect_to_set_up_sync">&sync.title.redirect.to.set.up.sync.label;</string> <string name="sync_text_redirect_to_set_up_sync">&sync.text.redirect.to.set.up.sync.label;</string> <string name="sync_text_tab_sent">&sync.text.tab.sent.label;</string> <string name="sync_text_tab_not_sent">&sync.text.tab.not.sent.label;</string> + <string name="sync_default_client_name">&sync.default.client.name;</string> <string name="browser_intent_package">@ANDROID_PACKAGE_NAME@</string> <string name="browser_intent_class">@ANDROID_PACKAGE_NAME@.App</string> <!-- Firefox Account strings. --> <string name="fxaccount_full_label">&fxaccount_full_label;</string>