Bug 801225 - Cleanup and restructuring of Android services code to support product announcements feature. r=nalexander, a=bbajaj

This commit is contained in:
Richard Newman 2012-10-17 00:28:29 -07:00
Родитель 7800cefdd1
Коммит 8ad9807874
25 изменённых файлов: 273 добавлений и 143 удалений

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -9,7 +9,6 @@ package org.mozilla.gecko.sync;
* Preprocessed class for storing preprocessed values. * Preprocessed class for storing preprocessed values.
*/ */
public class GlobalConstants { public class GlobalConstants {
public static final String PRODUCT_NAME = "@MOZ_APP_DISPLAYNAME@";
public static final String ANDROID_CPU_ARCH = "@ANDROID_CPU_ARCH@"; public static final String ANDROID_CPU_ARCH = "@ANDROID_CPU_ARCH@";
// One of 'beta', 'aurora', 'nightly', 'default'. // One of 'beta', 'aurora', 'nightly', 'default'.
@ -23,47 +22,13 @@ public class GlobalConstants {
#endif #endif
public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@"; public static final String MOZ_APP_VERSION = "@MOZ_APP_VERSION@";
public static final String SYNC_MAJOR_VERSION = "1";
public static final String SYNC_MINOR_VERSION = "0";
public static final String SYNC_VERSION_STRING = SYNC_MAJOR_VERSION + "." +
MOZ_APP_VERSION + "." +
SYNC_MINOR_VERSION;
public static final String SYNC_USER_AGENT = "Firefox AndroidSync " +
SYNC_VERSION_STRING + " (" +
PRODUCT_NAME + ")";
public static final String BROWSER_INTENT_PACKAGE = "@ANDROID_PACKAGE_NAME@"; public static final String BROWSER_INTENT_PACKAGE = "@ANDROID_PACKAGE_NAME@";
public static final String BROWSER_INTENT_CLASS = BROWSER_INTENT_PACKAGE + ".App"; public static final String BROWSER_INTENT_CLASS = BROWSER_INTENT_PACKAGE + ".App";
public static final String ACCOUNTTYPE_SYNC = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@";
/** /**
* Bug 790931: this signing-level permission protects broadcast intents that * Bug 790931: this signing-level permission protects broadcast intents that
* should be received only by Firefox versions sharing the same Android * should be received only by Firefox versions sharing the same Android
* Account type. * Account type.
*/ */
public static final String PER_ACCOUNT_TYPE_PERMISSION = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@.permission.PER_ACCOUNT_TYPE"; public static final String PER_ACCOUNT_TYPE_PERMISSION = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@.permission.PER_ACCOUNT_TYPE";
/**
* Bug 790931: this action is broadcast when an Android Account is deleted.
* This allows each installed Firefox to delete any pickle file and to (try
* to) wipe its client record from the server.
* <p>
* It is protected by signing-level permission PER_ACCOUNT_TYPE_PERMISSION and
* can be received only by Firefox versions sharing the same Android Account
* type.
* <p>
* See {@link SyncAccounts#makeSyncAccountDeletedIntent(android.content.Context, android.accounts.AccountManager, android.accounts.Account)}
* for contents of the intent.
*/
public static final String SYNC_ACCOUNT_DELETED_ACTION = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@.accounts.SYNC_ACCOUNT_DELETED_ACTION";
/**
* Bug 790931: version number of contents of SYNC_ACCOUNT_DELETED_ACTION intent.
* <p>
* See {@link SyncAccounts#makeSyncAccountDeletedIntent(android.content.Context, android.accounts.AccountManager, android.accounts.Account)}
* for contents of the intent.
*/
public static final long SYNC_ACCOUNT_DELETED_INTENT_VERSION = 1;
} }

Просмотреть файл

@ -11,7 +11,8 @@ import java.util.Set;
import org.mozilla.gecko.sync.log.writers.AndroidLevelCachingLogWriter; import org.mozilla.gecko.sync.log.writers.AndroidLevelCachingLogWriter;
import org.mozilla.gecko.sync.log.writers.AndroidLogWriter; import org.mozilla.gecko.sync.log.writers.AndroidLogWriter;
import org.mozilla.gecko.sync.log.writers.LogWriter; import org.mozilla.gecko.sync.log.writers.LogWriter;
import org.mozilla.gecko.sync.log.writers.SingleTagLogWriter; import org.mozilla.gecko.sync.log.writers.SimpleTagLogWriter;
import org.mozilla.gecko.sync.log.writers.ThreadLocalTagLogWriter;
import android.util.Log; import android.util.Log;
@ -19,30 +20,62 @@ import android.util.Log;
* Logging helper class. Serializes all log operations (by synchronizing). * Logging helper class. Serializes all log operations (by synchronizing).
*/ */
public class Logger { public class Logger {
public static final String LOG_TAG = "Logger"; public static final String LOGGER_TAG = "Logger";
public static final String DEFAULT_LOG_TAG = "GeckoLogger";
public static final String GLOBAL_LOG_TAG = "FxSync";
// For extra debugging. // For extra debugging.
public static boolean LOG_PERSONAL_INFORMATION = false; public static boolean LOG_PERSONAL_INFORMATION = false;
/** /**
* Current set of writers logged to. * Allow each thread to use its own global log tag. This allows
* independent services to log as different sources.
*
* When your thread sets up logging, it should do something like the following:
*
* Logger.setThreadLogTag("MyTag");
*
* The value is inheritable, so worker threads and such do not need to
* set the same log tag as their parent.
*/
private static final InheritableThreadLocal<String> logTag = new InheritableThreadLocal<String>() {
@Override
protected String initialValue() {
return DEFAULT_LOG_TAG;
}
};
public static void setThreadLogTag(final String logTag) {
Logger.logTag.set(logTag);
}
public static String getThreadLogTag() {
return Logger.logTag.get();
}
/**
* Current set of writers to which we will log.
* <p> * <p>
* We want logging to be available while running tests, so we set initialize * We want logging to be available while running tests, so we initialize
* this set statically. * this set statically.
*/ */
protected final static Set<LogWriter> logWriters = new LinkedHashSet<LogWriter>(Logger.defaultLogWriters()); protected final static Set<LogWriter> logWriters;
static {
final Set<LogWriter> defaultWriters = Logger.defaultLogWriters();
logWriters = new LinkedHashSet<LogWriter>(defaultWriters);
}
/** /**
* Default set of log writers to log to. * Default set of log writers to log to.
*/ */
protected final static Set<LogWriter> defaultLogWriters() { public final static Set<LogWriter> defaultLogWriters() {
final Set<LogWriter> defaultLogWriters = new LinkedHashSet<LogWriter>();
LogWriter log = new AndroidLogWriter();
LogWriter cache = new AndroidLevelCachingLogWriter(log);
final String processedPackage = GlobalConstants.BROWSER_INTENT_PACKAGE.replace("org.mozilla.", ""); final String processedPackage = GlobalConstants.BROWSER_INTENT_PACKAGE.replace("org.mozilla.", "");
LogWriter single = new SingleTagLogWriter(processedPackage, new SingleTagLogWriter(GLOBAL_LOG_TAG, cache));
final Set<LogWriter> defaultLogWriters = new LinkedHashSet<LogWriter>();
final LogWriter log = new AndroidLogWriter();
final LogWriter cache = new AndroidLevelCachingLogWriter(log);
final LogWriter single = new SimpleTagLogWriter(processedPackage, new ThreadLocalTagLogWriter(Logger.logTag, cache));
defaultLogWriters.add(single); defaultLogWriters.add(single);
return defaultLogWriters; return defaultLogWriters;
} }
@ -51,11 +84,15 @@ public class Logger {
logWriters.add(logWriter); logWriters.add(logWriter);
} }
public static synchronized void startLoggingToWriters(Set<LogWriter> writers) {
logWriters.addAll(writers);
}
public static synchronized void stopLoggingTo(LogWriter logWriter) { public static synchronized void stopLoggingTo(LogWriter logWriter) {
try { try {
logWriter.close(); logWriter.close();
} catch (Exception e) { } catch (Exception e) {
Log.e(LOG_TAG, "Got exception closing and removing LogWriter " + logWriter + ".", e); Log.e(LOGGER_TAG, "Got exception closing and removing LogWriter " + logWriter + ".", e);
} }
logWriters.remove(logWriter); logWriters.remove(logWriter);
} }
@ -65,7 +102,7 @@ public class Logger {
try { try {
logWriter.close(); logWriter.close();
} catch (Exception e) { } catch (Exception e) {
Log.e(LOG_TAG, "Got exception closing and removing LogWriter " + logWriter + ".", e); Log.e(LOGGER_TAG, "Got exception closing and removing LogWriter " + logWriter + ".", e);
} }
} }
logWriters.clear(); logWriters.clear();
@ -89,92 +126,92 @@ public class Logger {
return false; return false;
} }
public static void error(String logTag, String message) { public static void error(String tag, String message) {
Logger.error(logTag, message, null); Logger.error(tag, message, null);
} }
public static void warn(String logTag, String message) { public static void warn(String tag, String message) {
Logger.warn(logTag, message, null); Logger.warn(tag, message, null);
} }
public static void info(String logTag, String message) { public static void info(String tag, String message) {
Logger.info(logTag, message, null); Logger.info(tag, message, null);
} }
public static void debug(String logTag, String message) { public static void debug(String tag, String message) {
Logger.debug(logTag, message, null); Logger.debug(tag, message, null);
} }
public static void trace(String logTag, String message) { public static void trace(String tag, String message) {
Logger.trace(logTag, message, null); Logger.trace(tag, message, null);
} }
public static void pii(String logTag, String message) { public static void pii(String tag, String message) {
if (LOG_PERSONAL_INFORMATION) { if (LOG_PERSONAL_INFORMATION) {
Logger.debug(logTag, "$$PII$$: " + message); Logger.debug(tag, "$$PII$$: " + message);
} }
} }
public static synchronized void error(String logTag, String message, Throwable error) { public static synchronized void error(String tag, String message, Throwable error) {
Iterator<LogWriter> it = logWriters.iterator(); Iterator<LogWriter> it = logWriters.iterator();
while (it.hasNext()) { while (it.hasNext()) {
LogWriter writer = it.next(); LogWriter writer = it.next();
try { try {
writer.error(logTag, message, error); writer.error(tag, message, error);
} catch (Exception e) { } catch (Exception e) {
Log.e(LOG_TAG, "Got exception logging; removing LogWriter " + writer + ".", e); Log.e(LOGGER_TAG, "Got exception logging; removing LogWriter " + writer + ".", e);
it.remove(); it.remove();
} }
} }
} }
public static synchronized void warn(String logTag, String message, Throwable error) { public static synchronized void warn(String tag, String message, Throwable error) {
Iterator<LogWriter> it = logWriters.iterator(); Iterator<LogWriter> it = logWriters.iterator();
while (it.hasNext()) { while (it.hasNext()) {
LogWriter writer = it.next(); LogWriter writer = it.next();
try { try {
writer.warn(logTag, message, error); writer.warn(tag, message, error);
} catch (Exception e) { } catch (Exception e) {
Log.e(LOG_TAG, "Got exception logging; removing LogWriter " + writer + ".", e); Log.e(LOGGER_TAG, "Got exception logging; removing LogWriter " + writer + ".", e);
it.remove(); it.remove();
} }
} }
} }
public static synchronized void info(String logTag, String message, Throwable error) { public static synchronized void info(String tag, String message, Throwable error) {
Iterator<LogWriter> it = logWriters.iterator(); Iterator<LogWriter> it = logWriters.iterator();
while (it.hasNext()) { while (it.hasNext()) {
LogWriter writer = it.next(); LogWriter writer = it.next();
try { try {
writer.info(logTag, message, error); writer.info(tag, message, error);
} catch (Exception e) { } catch (Exception e) {
Log.e(LOG_TAG, "Got exception logging; removing LogWriter " + writer + ".", e); Log.e(LOGGER_TAG, "Got exception logging; removing LogWriter " + writer + ".", e);
it.remove(); it.remove();
} }
} }
} }
public static synchronized void debug(String logTag, String message, Throwable error) { public static synchronized void debug(String tag, String message, Throwable error) {
Iterator<LogWriter> it = logWriters.iterator(); Iterator<LogWriter> it = logWriters.iterator();
while (it.hasNext()) { while (it.hasNext()) {
LogWriter writer = it.next(); LogWriter writer = it.next();
try { try {
writer.debug(logTag, message, error); writer.debug(tag, message, error);
} catch (Exception e) { } catch (Exception e) {
Log.e(LOG_TAG, "Got exception logging; removing LogWriter " + writer + ".", e); Log.e(LOGGER_TAG, "Got exception logging; removing LogWriter " + writer + ".", e);
it.remove(); it.remove();
} }
} }
} }
public static synchronized void trace(String logTag, String message, Throwable error) { public static synchronized void trace(String tag, String message, Throwable error) {
Iterator<LogWriter> it = logWriters.iterator(); Iterator<LogWriter> it = logWriters.iterator();
while (it.hasNext()) { while (it.hasNext()) {
LogWriter writer = it.next(); LogWriter writer = it.next();
try { try {
writer.trace(logTag, message, error); writer.trace(tag, message, error);
} catch (Exception e) { } catch (Exception e) {
Log.e(LOG_TAG, "Got exception logging; removing LogWriter " + writer + ".", e); Log.e(LOGGER_TAG, "Got exception logging; removing LogWriter " + writer + ".", e);
it.remove(); it.remove();
} }
} }

Просмотреть файл

@ -0,0 +1,48 @@
#filter substitution
/* 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;
/**
* Preprocessed class for storing preprocessed values.
*/
public class SyncConstants {
public static final String PRODUCT_NAME = "@MOZ_APP_DISPLAYNAME@";
public static final String GLOBAL_LOG_TAG = "FxSync";
public static final String SYNC_MAJOR_VERSION = "1";
public static final String SYNC_MINOR_VERSION = "0";
public static final String SYNC_VERSION_STRING = SYNC_MAJOR_VERSION + "." +
GlobalConstants.MOZ_APP_VERSION + "." +
SYNC_MINOR_VERSION;
public static final String SYNC_USER_AGENT = "Firefox AndroidSync " +
SYNC_VERSION_STRING + " (" +
PRODUCT_NAME + ")";
public static final String ACCOUNTTYPE_SYNC = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@";
/**
* Bug 790931: this action is broadcast when an Android Account is deleted.
* This allows each installed Firefox to delete any pickle file and to (try
* to) wipe its client record from the server.
* <p>
* It is protected by signing-level permission PER_ACCOUNT_TYPE_PERMISSION and
* can be received only by Firefox versions sharing the same Android Account
* type.
* <p>
* See {@link SyncAccounts#makeSyncAccountDeletedIntent(android.content.Context, android.accounts.AccountManager, android.accounts.Account)}
* for contents of the intent.
*/
public static final String SYNC_ACCOUNT_DELETED_ACTION = "@MOZ_ANDROID_SHARED_ACCOUNT_TYPE@.accounts.SYNC_ACCOUNT_DELETED_ACTION";
/**
* Bug 790931: version number of contents of SYNC_ACCOUNT_DELETED_ACTION intent.
* <p>
* See {@link SyncAccounts#makeSyncAccountDeletedIntent(android.content.Context, android.accounts.AccountManager, android.accounts.Account)}
* for contents of the intent.
*/
public static final long SYNC_ACCOUNT_DELETED_INTENT_VERSION = 1;
}

Просмотреть файл

@ -0,0 +1,20 @@
/* 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.log.writers;
/**
* Make a <code>LogWriter</code> only log with a single string tag.
*/
public class SimpleTagLogWriter extends TagLogWriter {
final String tag;
public SimpleTagLogWriter(String tag, LogWriter inner) {
super(inner);
this.tag = tag;
}
protected String getMainTag() {
return tag;
}
}

Просмотреть файл

@ -5,49 +5,51 @@
package org.mozilla.gecko.sync.log.writers; package org.mozilla.gecko.sync.log.writers;
/** /**
* Make a <code>LogWriter</code> only log with a single tag. * A @link{LogWriter} that logs each message under a parent tag.
*/ */
public class SingleTagLogWriter extends LogWriter { public abstract class TagLogWriter extends LogWriter {
protected final String tag;
protected final LogWriter inner; protected final LogWriter inner;
public SingleTagLogWriter(String tag, LogWriter inner) { public TagLogWriter(final LogWriter inner) {
this.tag = tag; super();
this.inner = inner; this.inner = inner;
} }
protected abstract String getMainTag();
@Override @Override
public void error(String tag, String message, Throwable error) { public void error(String tag, String message, Throwable error) {
inner.error(this.tag, tag + " :: " + message, error); inner.error(this.getMainTag(), tag + " :: " + message, error);
} }
@Override @Override
public void warn(String tag, String message, Throwable error) { public void warn(String tag, String message, Throwable error) {
inner.warn(this.tag, tag + " :: " + message, error); inner.warn(this.getMainTag(), tag + " :: " + message, error);
} }
@Override @Override
public void info(String tag, String message, Throwable error) { public void info(String tag, String message, Throwable error) {
inner.info(this.tag, tag + " :: " + message, error); inner.info(this.getMainTag(), tag + " :: " + message, error);
} }
@Override @Override
public void debug(String tag, String message, Throwable error) { public void debug(String tag, String message, Throwable error) {
inner.debug(this.tag, tag + " :: " + message, error); inner.debug(this.getMainTag(), tag + " :: " + message, error);
} }
@Override @Override
public void trace(String tag, String message, Throwable error) { public void trace(String tag, String message, Throwable error) {
inner.trace(this.tag, tag + " :: " + message, error); inner.trace(this.getMainTag(), tag + " :: " + message, error);
} }
@Override @Override
public boolean shouldLogVerbose(String tag) { public boolean shouldLogVerbose(String tag) {
return inner.shouldLogVerbose(this.tag); return inner.shouldLogVerbose(this.getMainTag());
} }
@Override @Override
public void close() { public void close() {
inner.close(); inner.close();
} }
} }

Просмотреть файл

@ -0,0 +1,25 @@
/* 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.log.writers;
/**
* Log with a single global tag but that tag can be different for each thread.
*
* Takes a @link{ThreadLocal} as a constructor parameter.
*/
public class ThreadLocalTagLogWriter extends TagLogWriter {
private final ThreadLocal<String> tag;
public ThreadLocalTagLogWriter(ThreadLocal<String> tag, LogWriter inner) {
super(inner);
this.tag = tag;
}
@Override
protected String getMainTag() {
return this.tag.get();
}
}

Просмотреть файл

@ -181,17 +181,6 @@ public class BaseResource implements Resource {
private static Object connManagerMonitor = new Object(); private static Object connManagerMonitor = new Object();
private static ClientConnectionManager connManager; private static ClientConnectionManager connManager;
/**
* This method exists for test code.
*/
public static ClientConnectionManager enablePlainHTTPConnectionManager() {
synchronized (connManagerMonitor) {
ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager();
connManager = cm;
return cm;
}
}
// Call within a synchronized block on connManagerMonitor. // Call within a synchronized block on connManagerMonitor.
private static ClientConnectionManager enableTLSConnectionManager() throws KeyManagementException, NoSuchAlgorithmException { private static ClientConnectionManager enableTLSConnectionManager() throws KeyManagementException, NoSuchAlgorithmException {
SSLContext sslContext = SSLContext.getInstance("TLS"); SSLContext sslContext = SSLContext.getInstance("TLS");

Просмотреть файл

@ -10,7 +10,7 @@ import java.net.URISyntaxException;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import java.util.HashMap; import java.util.HashMap;
import org.mozilla.gecko.sync.GlobalConstants; import org.mozilla.gecko.sync.SyncConstants;
import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.Logger;
import ch.boye.httpclientandroidlib.HttpEntity; import ch.boye.httpclientandroidlib.HttpEntity;
@ -131,7 +131,7 @@ public class SyncStorageRequest implements Resource {
@Override @Override
public void addHeaders(HttpRequestBase request, DefaultHttpClient client) { public void addHeaders(HttpRequestBase request, DefaultHttpClient client) {
client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, GlobalConstants.SYNC_USER_AGENT); client.getParams().setParameter(CoreProtocolPNames.USER_AGENT, SyncConstants.SYNC_USER_AGENT);
// Clients can use their delegate interface to specify X-If-Unmodified-Since. // Clients can use their delegate interface to specify X-If-Unmodified-Since.
String ifUnmodifiedSince = this.request.delegate.ifUnmodifiedSince(); String ifUnmodifiedSince = this.request.delegate.ifUnmodifiedSince();

Просмотреть файл

@ -6,6 +6,7 @@ package org.mozilla.gecko.sync.receivers;
import org.mozilla.gecko.sync.ExtendedJSONObject; import org.mozilla.gecko.sync.ExtendedJSONObject;
import org.mozilla.gecko.sync.GlobalConstants; import org.mozilla.gecko.sync.GlobalConstants;
import org.mozilla.gecko.sync.SyncConstants;
import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.Logger;
import org.mozilla.gecko.sync.SyncConfiguration; import org.mozilla.gecko.sync.SyncConfiguration;
import org.mozilla.gecko.sync.Utils; import org.mozilla.gecko.sync.Utils;
@ -32,7 +33,7 @@ public class SyncAccountDeletedService extends IntentService {
final Context context = this; final Context context = this;
long intentVersion = intent.getLongExtra(Constants.JSON_KEY_VERSION, 0); long intentVersion = intent.getLongExtra(Constants.JSON_KEY_VERSION, 0);
long expectedVersion = GlobalConstants.SYNC_ACCOUNT_DELETED_INTENT_VERSION; long expectedVersion = SyncConstants.SYNC_ACCOUNT_DELETED_INTENT_VERSION;
if (intentVersion != expectedVersion) { if (intentVersion != expectedVersion) {
Logger.warn(LOG_TAG, "Intent malformed: version " + intentVersion + " given but version " + expectedVersion + "expected. " + Logger.warn(LOG_TAG, "Intent malformed: version " + intentVersion + " given but version " + expectedVersion + "expected. " +
"Not cleaning up after deleted Account."); "Not cleaning up after deleted Account.");

Просмотреть файл

@ -12,6 +12,7 @@ import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.sync.CredentialException; import org.mozilla.gecko.sync.CredentialException;
import org.mozilla.gecko.sync.ExtendedJSONObject; import org.mozilla.gecko.sync.ExtendedJSONObject;
import org.mozilla.gecko.sync.GlobalConstants; import org.mozilla.gecko.sync.GlobalConstants;
import org.mozilla.gecko.sync.SyncConstants;
import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.Logger;
import org.mozilla.gecko.sync.SyncConfiguration; import org.mozilla.gecko.sync.SyncConfiguration;
import org.mozilla.gecko.sync.ThreadPool; import org.mozilla.gecko.sync.ThreadPool;
@ -53,7 +54,7 @@ public class SyncAccounts {
* @return Sync accounts. * @return Sync accounts.
*/ */
public static Account[] syncAccounts(final Context c) { public static Account[] syncAccounts(final Context c) {
return AccountManager.get(c).getAccountsByType(GlobalConstants.ACCOUNTTYPE_SYNC); return AccountManager.get(c).getAccountsByType(SyncConstants.ACCOUNTTYPE_SYNC);
} }
/** /**
@ -64,7 +65,7 @@ public class SyncAccounts {
* Do not call this method from the main thread. * Do not call this method from the main thread.
*/ */
public static boolean syncAccountsExist(Context c) { public static boolean syncAccountsExist(Context c) {
final boolean accountsExist = AccountManager.get(c).getAccountsByType(GlobalConstants.ACCOUNTTYPE_SYNC).length > 0; final boolean accountsExist = AccountManager.get(c).getAccountsByType(SyncConstants.ACCOUNTTYPE_SYNC).length > 0;
if (accountsExist) { if (accountsExist) {
return true; return true;
} }
@ -219,7 +220,7 @@ public class SyncAccounts {
try { try {
return createSyncAccount(syncAccount, syncAutomatically); return createSyncAccount(syncAccount, syncAutomatically);
} catch (Exception e) { } catch (Exception e) {
Log.e(Logger.GLOBAL_LOG_TAG, "Unable to create account.", e); Log.e(SyncConstants.GLOBAL_LOG_TAG, "Unable to create account.", e);
return null; return null;
} }
} }
@ -300,13 +301,13 @@ public class SyncAccounts {
Logger.info(LOG_TAG, "Setting explicit server URL: " + serverURL); Logger.info(LOG_TAG, "Setting explicit server URL: " + serverURL);
} }
final Account account = new Account(username, GlobalConstants.ACCOUNTTYPE_SYNC); final Account account = new Account(username, SyncConstants.ACCOUNTTYPE_SYNC);
final Bundle userbundle = new Bundle(); final Bundle userbundle = new Bundle();
// Add sync key and server URL. // Add sync key and server URL.
userbundle.putString(Constants.OPTION_SYNCKEY, syncKey); userbundle.putString(Constants.OPTION_SYNCKEY, syncKey);
userbundle.putString(Constants.OPTION_SERVER, serverURL); userbundle.putString(Constants.OPTION_SERVER, serverURL);
Logger.debug(LOG_TAG, "Adding account for " + GlobalConstants.ACCOUNTTYPE_SYNC); Logger.debug(LOG_TAG, "Adding account for " + SyncConstants.ACCOUNTTYPE_SYNC);
boolean result = false; boolean result = false;
try { try {
result = accountManager.addAccountExplicitly(account, password, userbundle); result = accountManager.addAccountExplicitly(account, password, userbundle);
@ -314,13 +315,13 @@ public class SyncAccounts {
// We use Log rather than Logger here to avoid possibly hiding these errors. // We use Log rather than Logger here to avoid possibly hiding these errors.
final String message = e.getMessage(); final String message = e.getMessage();
if (message != null && (message.indexOf("is different than the authenticator's uid") > 0)) { if (message != null && (message.indexOf("is different than the authenticator's uid") > 0)) {
Log.wtf(Logger.GLOBAL_LOG_TAG, Log.wtf(SyncConstants.GLOBAL_LOG_TAG,
"Unable to create account. " + "Unable to create account. " +
"If you have more than one version of " + "If you have more than one version of " +
"Firefox/Beta/Aurora/Nightly/Fennec installed, that's why.", "Firefox/Beta/Aurora/Nightly/Fennec installed, that's why.",
e); e);
} else { } else {
Log.e(Logger.GLOBAL_LOG_TAG, "Unable to create account.", e); Log.e(SyncConstants.GLOBAL_LOG_TAG, "Unable to create account.", e);
} }
} }
@ -559,9 +560,9 @@ public class SyncAccounts {
* @return <code>Intent</code> to broadcast. * @return <code>Intent</code> to broadcast.
*/ */
public static Intent makeSyncAccountDeletedIntent(final Context context, final AccountManager accountManager, final Account account) { public static Intent makeSyncAccountDeletedIntent(final Context context, final AccountManager accountManager, final Account account) {
final Intent intent = new Intent(GlobalConstants.SYNC_ACCOUNT_DELETED_ACTION); final Intent intent = new Intent(SyncConstants.SYNC_ACCOUNT_DELETED_ACTION);
intent.putExtra(Constants.JSON_KEY_VERSION, Long.valueOf(GlobalConstants.SYNC_ACCOUNT_DELETED_INTENT_VERSION)); intent.putExtra(Constants.JSON_KEY_VERSION, Long.valueOf(SyncConstants.SYNC_ACCOUNT_DELETED_INTENT_VERSION));
intent.putExtra(Constants.JSON_KEY_TIMESTAMP, Long.valueOf(System.currentTimeMillis())); intent.putExtra(Constants.JSON_KEY_TIMESTAMP, Long.valueOf(System.currentTimeMillis()));
intent.putExtra(Constants.JSON_KEY_ACCOUNT, account.name); intent.putExtra(Constants.JSON_KEY_ACCOUNT, account.name);

Просмотреть файл

@ -8,6 +8,7 @@ import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import org.mozilla.gecko.sync.GlobalConstants; import org.mozilla.gecko.sync.GlobalConstants;
import org.mozilla.gecko.sync.SyncConstants;
import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.Logger;
import org.mozilla.gecko.sync.Utils; import org.mozilla.gecko.sync.Utils;
import org.mozilla.gecko.sync.setup.activities.SetupSyncActivity; import org.mozilla.gecko.sync.setup.activities.SetupSyncActivity;
@ -99,7 +100,7 @@ public class SyncAuthenticatorService extends Service {
final Bundle result = new Bundle(); final Bundle result = new Bundle();
// This is a Sync account. // This is a Sync account.
result.putString(AccountManager.KEY_ACCOUNT_TYPE, GlobalConstants.ACCOUNTTYPE_SYNC); result.putString(AccountManager.KEY_ACCOUNT_TYPE, SyncConstants.ACCOUNTTYPE_SYNC);
// Server. // Server.
String serverURL = am.getUserData(account, Constants.OPTION_SERVER); String serverURL = am.getUserData(account, Constants.OPTION_SERVER);
@ -145,7 +146,7 @@ public class SyncAuthenticatorService extends Service {
final Intent intent = new Intent(mContext, SetupSyncActivity.class); final Intent intent = new Intent(mContext, SetupSyncActivity.class);
intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE,
response); response);
intent.putExtra("accountType", GlobalConstants.ACCOUNTTYPE_SYNC); intent.putExtra("accountType", SyncConstants.ACCOUNTTYPE_SYNC);
intent.putExtra(Constants.INTENT_EXTRA_IS_SETUP, true); intent.putExtra(Constants.INTENT_EXTRA_IS_SETUP, true);
final Bundle result = new Bundle(); final Bundle result = new Bundle();

Просмотреть файл

@ -7,7 +7,7 @@ package org.mozilla.gecko.sync.setup.activities;
import java.util.Locale; import java.util.Locale;
import org.mozilla.gecko.R; import org.mozilla.gecko.R;
import org.mozilla.gecko.sync.GlobalConstants; import org.mozilla.gecko.sync.SyncConstants;
import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.Logger;
import org.mozilla.gecko.sync.ThreadPool; import org.mozilla.gecko.sync.ThreadPool;
import org.mozilla.gecko.sync.setup.Constants; import org.mozilla.gecko.sync.setup.Constants;
@ -63,6 +63,8 @@ public class AccountActivity extends AccountAuthenticatorActivity {
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.sync_account); setContentView(R.layout.sync_account);
ActivityUtils.prepareLogging();
mContext = getApplicationContext(); mContext = getApplicationContext();
Logger.debug(LOG_TAG, "AccountManager.get(" + mContext + ")"); Logger.debug(LOG_TAG, "AccountManager.get(" + mContext + ")");
mAccountManager = AccountManager.get(mContext); mAccountManager = AccountManager.get(mContext);
@ -110,6 +112,7 @@ public class AccountActivity extends AccountAuthenticatorActivity {
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
ActivityUtils.prepareLogging();
clearCredentials(); clearCredentials();
usernameInput.requestFocus(); usernameInput.requestFocus();
cancelButton.setOnClickListener(new OnClickListener() { cancelButton.setOnClickListener(new OnClickListener() {
@ -264,8 +267,8 @@ public class AccountActivity extends AccountAuthenticatorActivity {
Bundle resultBundle = new Bundle(); Bundle resultBundle = new Bundle();
resultBundle.putString(AccountManager.KEY_ACCOUNT_NAME, syncAccount.username); resultBundle.putString(AccountManager.KEY_ACCOUNT_NAME, syncAccount.username);
resultBundle.putString(AccountManager.KEY_ACCOUNT_TYPE, GlobalConstants.ACCOUNTTYPE_SYNC); resultBundle.putString(AccountManager.KEY_ACCOUNT_TYPE, SyncConstants.ACCOUNTTYPE_SYNC);
resultBundle.putString(AccountManager.KEY_AUTHTOKEN, GlobalConstants.ACCOUNTTYPE_SYNC); resultBundle.putString(AccountManager.KEY_AUTHTOKEN, SyncConstants.ACCOUNTTYPE_SYNC);
setAccountAuthenticatorResult(resultBundle); setAccountAuthenticatorResult(resultBundle);
setResult(RESULT_OK); setResult(RESULT_OK);

Просмотреть файл

@ -4,9 +4,15 @@
package org.mozilla.gecko.sync.setup.activities; package org.mozilla.gecko.sync.setup.activities;
import org.mozilla.gecko.sync.Logger;
import org.mozilla.gecko.sync.SyncConstants;
import org.mozilla.gecko.sync.setup.InvalidSyncKeyException; import org.mozilla.gecko.sync.setup.InvalidSyncKeyException;
public class ActivityUtils { public class ActivityUtils {
public static void prepareLogging() {
Logger.setThreadLogTag(SyncConstants.GLOBAL_LOG_TAG);
}
/** /**
* Sync key should be a 26-character string, and can include arbitrary * Sync key should be a 26-character string, and can include arbitrary
* capitalization and hyphenation. * capitalization and hyphenation.

Просмотреть файл

@ -4,13 +4,13 @@ import org.mozilla.gecko.R;
import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.Logger;
import org.mozilla.gecko.sync.setup.Constants; import org.mozilla.gecko.sync.setup.Constants;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
public class RedirectToSetupActivity extends Activity { public class RedirectToSetupActivity extends SyncActivity {
public static final String LOG_TAG = "RedirectToSetupActivity"; public static final String LOG_TAG = "RedirectToSetupActivity";
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

Просмотреть файл

@ -11,6 +11,7 @@ import org.mozilla.gecko.sync.CommandProcessor;
import org.mozilla.gecko.sync.CommandRunner; import org.mozilla.gecko.sync.CommandRunner;
import org.mozilla.gecko.sync.CredentialException; import org.mozilla.gecko.sync.CredentialException;
import org.mozilla.gecko.sync.GlobalConstants; import org.mozilla.gecko.sync.GlobalConstants;
import org.mozilla.gecko.sync.SyncConstants;
import org.mozilla.gecko.sync.GlobalSession; import org.mozilla.gecko.sync.GlobalSession;
import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.Logger;
import org.mozilla.gecko.sync.SyncConfiguration; import org.mozilla.gecko.sync.SyncConfiguration;
@ -49,6 +50,7 @@ public class SendTabActivity extends Activity {
@Override @Override
public void onResume() { public void onResume() {
ActivityUtils.prepareLogging();
Logger.info(LOG_TAG, "Called SendTabActivity.onResume."); Logger.info(LOG_TAG, "Called SendTabActivity.onResume.");
super.onResume(); super.onResume();
@ -93,7 +95,7 @@ public class SendTabActivity extends Activity {
private void redirectIfNoSyncAccount() { private void redirectIfNoSyncAccount() {
accountManager = AccountManager.get(getApplicationContext()); accountManager = AccountManager.get(getApplicationContext());
Account[] accts = accountManager.getAccountsByType(GlobalConstants.ACCOUNTTYPE_SYNC); Account[] accts = accountManager.getAccountsByType(SyncConstants.ACCOUNTTYPE_SYNC);
// A Sync account exists. // A Sync account exists.
if (accts.length > 0) { if (accts.length > 0) {

Просмотреть файл

@ -7,14 +7,13 @@ package org.mozilla.gecko.sync.setup.activities;
import org.mozilla.gecko.R; import org.mozilla.gecko.R;
import org.mozilla.gecko.sync.setup.Constants; import org.mozilla.gecko.sync.setup.Constants;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
public class SetupFailureActivity extends Activity { public class SetupFailureActivity extends SyncActivity {
private Context mContext; private Context mContext;
@Override @Override

Просмотреть файл

@ -6,18 +6,15 @@ package org.mozilla.gecko.sync.setup.activities;
import org.mozilla.gecko.R; import org.mozilla.gecko.R;
import org.mozilla.gecko.sync.GlobalConstants; import org.mozilla.gecko.sync.GlobalConstants;
import org.mozilla.gecko.sync.Logger;
import org.mozilla.gecko.sync.setup.Constants; import org.mozilla.gecko.sync.setup.Constants;
import org.mozilla.gecko.sync.setup.SyncAccounts; import org.mozilla.gecko.sync.setup.SyncAccounts;
import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
public class SetupSuccessActivity extends Activity { public class SetupSuccessActivity extends SyncActivity {
private final static String LOG_TAG = "SetupSuccessActivity";
private TextView setupSubtitle; private TextView setupSubtitle;
@Override @Override
@ -36,7 +33,6 @@ public class SetupSuccessActivity extends Activity {
@Override @Override
public void onDestroy() { public void onDestroy() {
Logger.debug(LOG_TAG, "onDestroy() called.");
super.onDestroy(); super.onDestroy();
} }

Просмотреть файл

@ -9,8 +9,8 @@ import java.util.HashMap;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.mozilla.gecko.R; import org.mozilla.gecko.R;
import org.mozilla.gecko.sync.GlobalConstants;
import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.Logger;
import org.mozilla.gecko.sync.SyncConstants;
import org.mozilla.gecko.sync.ThreadPool; import org.mozilla.gecko.sync.ThreadPool;
import org.mozilla.gecko.sync.Utils; import org.mozilla.gecko.sync.Utils;
import org.mozilla.gecko.sync.jpake.JPakeClient; import org.mozilla.gecko.sync.jpake.JPakeClient;
@ -64,12 +64,12 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
public SetupSyncActivity() { public SetupSyncActivity() {
super(); super();
Logger.info(LOG_TAG, "SetupSyncActivity constructor called.");
} }
/** Called when the activity is first created. */ /** Called when the activity is first created. */
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
ActivityUtils.prepareLogging();
Logger.info(LOG_TAG, "Called SetupSyncActivity.onCreate."); Logger.info(LOG_TAG, "Called SetupSyncActivity.onCreate.");
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -88,6 +88,7 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
@Override @Override
public void onResume() { public void onResume() {
ActivityUtils.prepareLogging();
Logger.info(LOG_TAG, "Called SetupSyncActivity.onResume."); Logger.info(LOG_TAG, "Called SetupSyncActivity.onResume.");
super.onResume(); super.onResume();
@ -106,7 +107,8 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
ThreadPool.run(new Runnable() { ThreadPool.run(new Runnable() {
@Override @Override
public void run() { public void run() {
Account[] accts = mAccountManager.getAccountsByType(GlobalConstants.ACCOUNTTYPE_SYNC); ActivityUtils.prepareLogging();
Account[] accts = mAccountManager.getAccountsByType(SyncConstants.ACCOUNTTYPE_SYNC);
finishResume(accts); finishResume(accts);
} }
}); });
@ -319,7 +321,7 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
} }
} }
@SuppressWarnings("unchecked") @SuppressWarnings({ "unchecked", "static-method" })
protected JSONObject makeAccountJSON(String username, String password, protected JSONObject makeAccountJSON(String username, String password,
String syncKey, String serverURL) { String syncKey, String serverURL) {
@ -346,7 +348,7 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
*/ */
public void onPaired() { public void onPaired() {
// Extract Sync account data. // Extract Sync account data.
Account[] accts = mAccountManager.getAccountsByType(GlobalConstants.ACCOUNTTYPE_SYNC); Account[] accts = mAccountManager.getAccountsByType(SyncConstants.ACCOUNTTYPE_SYNC);
if (accts.length == 0) { if (accts.length == 0) {
// Error, no account present. // Error, no account present.
Logger.error(LOG_TAG, "No accounts present."); Logger.error(LOG_TAG, "No accounts present.");
@ -437,8 +439,8 @@ public class SetupSyncActivity extends AccountAuthenticatorActivity {
if (isSuccess) { if (isSuccess) {
Bundle resultBundle = new Bundle(); Bundle resultBundle = new Bundle();
resultBundle.putString(AccountManager.KEY_ACCOUNT_NAME, syncAccount.username); resultBundle.putString(AccountManager.KEY_ACCOUNT_NAME, syncAccount.username);
resultBundle.putString(AccountManager.KEY_ACCOUNT_TYPE, GlobalConstants.ACCOUNTTYPE_SYNC); resultBundle.putString(AccountManager.KEY_ACCOUNT_TYPE, SyncConstants.ACCOUNTTYPE_SYNC);
resultBundle.putString(AccountManager.KEY_AUTHTOKEN, GlobalConstants.ACCOUNTTYPE_SYNC); resultBundle.putString(AccountManager.KEY_AUTHTOKEN, SyncConstants.ACCOUNTTYPE_SYNC);
setAccountAuthenticatorResult(resultBundle); setAccountAuthenticatorResult(resultBundle);
} }
displayResultAndFinish(isSuccess); displayResultAndFinish(isSuccess);

Просмотреть файл

@ -0,0 +1,27 @@
/* 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.setup.activities;
import android.app.Activity;
import android.os.Bundle;
/**
* Shared superclass of Sync activities. Currently exists to prepare per-thread
* logging.
*/
public abstract class SyncActivity extends Activity {
@Override
protected void onResume() {
super.onResume();
ActivityUtils.prepareLogging();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityUtils.prepareLogging();
}
}

Просмотреть файл

@ -20,7 +20,7 @@ import android.webkit.WebViewClient;
* @author liuche * @author liuche
* *
*/ */
public class WebViewActivity extends Activity { public class WebViewActivity extends SyncActivity {
private final static String LOG_TAG = "WebViewActivity"; private final static String LOG_TAG = "WebViewActivity";
@Override @Override

Просмотреть файл

@ -13,7 +13,7 @@ import java.net.URISyntaxException;
import java.security.GeneralSecurityException; import java.security.GeneralSecurityException;
import org.mozilla.apache.commons.codec.binary.Base64; import org.mozilla.apache.commons.codec.binary.Base64;
import org.mozilla.gecko.sync.GlobalConstants; import org.mozilla.gecko.sync.SyncConstants;
import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.Logger;
import org.mozilla.gecko.sync.net.BaseResource; import org.mozilla.gecko.sync.net.BaseResource;
import org.mozilla.gecko.sync.net.SyncResourceDelegate; import org.mozilla.gecko.sync.net.SyncResourceDelegate;
@ -102,7 +102,7 @@ public class AuthenticateAccountStage implements AuthenticatorStage {
// Make reference to request, to abort if necessary. // Make reference to request, to abort if necessary.
httpRequest = request; httpRequest = request;
client.log.enableDebug(true); client.log.enableDebug(true);
request.setHeader(new BasicHeader("User-Agent", GlobalConstants.SYNC_USER_AGENT)); request.setHeader(new BasicHeader("User-Agent", SyncConstants.SYNC_USER_AGENT));
// Host header is not set for some reason, so do it explicitly. // Host header is not set for some reason, so do it explicitly.
try { try {
URI authServerUri = new URI(authRequestUrl); URI authServerUri = new URI(authRequestUrl);

Просмотреть файл

@ -14,6 +14,7 @@ import org.mozilla.gecko.db.BrowserContract;
import org.mozilla.gecko.sync.AlreadySyncingException; import org.mozilla.gecko.sync.AlreadySyncingException;
import org.mozilla.gecko.sync.CredentialException; import org.mozilla.gecko.sync.CredentialException;
import org.mozilla.gecko.sync.GlobalConstants; import org.mozilla.gecko.sync.GlobalConstants;
import org.mozilla.gecko.sync.SyncConstants;
import org.mozilla.gecko.sync.GlobalSession; import org.mozilla.gecko.sync.GlobalSession;
import org.mozilla.gecko.sync.Logger; import org.mozilla.gecko.sync.Logger;
import org.mozilla.gecko.sync.NonObjectJSONException; import org.mozilla.gecko.sync.NonObjectJSONException;
@ -238,11 +239,11 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter implements GlobalSe
* @param backoff time to wait in milliseconds. * @param backoff time to wait in milliseconds.
*/ */
@Override @Override
public void requestBackoff(long backoff) { public void requestBackoff(final long backoff) {
if (backoff > 0) { if (backoff > 0) {
// Fuzz the backoff time (up to 25% more) to prevent client lock-stepping; agrees with desktop. // Fuzz the backoff time (up to 25% more) to prevent client lock-stepping; agrees with desktop.
backoff = backoff + Math.round((double) backoff * 0.25d * Math.random()); final long fuzzedBackoff = backoff + Math.round((double) backoff * 0.25d * Math.random());
this.extendEarliestNextSync(System.currentTimeMillis() + backoff); this.extendEarliestNextSync(System.currentTimeMillis() + fuzzedBackoff);
} }
} }
@ -275,6 +276,7 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter implements GlobalSe
final String authority, final String authority,
final ContentProviderClient provider, final ContentProviderClient provider,
final SyncResult syncResult) { final SyncResult syncResult) {
Logger.setThreadLogTag(SyncConstants.GLOBAL_LOG_TAG);
Logger.resetLogging(); Logger.resetLogging();
Utils.reseedSharedRandom(); // Make sure we don't work with the same random seed for too long. Utils.reseedSharedRandom(); // Make sure we don't work with the same random seed for too long.
@ -521,7 +523,7 @@ public class SyncAdapter extends AbstractThreadedSyncAdapter implements GlobalSe
public synchronized String getClientName() { public synchronized String getClientName() {
String clientName = accountSharedPreferences.getString(SyncConfiguration.PREF_CLIENT_NAME, null); String clientName = accountSharedPreferences.getString(SyncConfiguration.PREF_CLIENT_NAME, null);
if (clientName == null) { if (clientName == null) {
clientName = GlobalConstants.PRODUCT_NAME + " on " + android.os.Build.MODEL; clientName = SyncConstants.PRODUCT_NAME + " on " + android.os.Build.MODEL;
accountSharedPreferences.edit().putString(SyncConfiguration.PREF_CLIENT_NAME, clientName).commit(); accountSharedPreferences.edit().putString(SyncConfiguration.PREF_CLIENT_NAME, clientName).commit();
} }
return clientName; return clientName;

Просмотреть файл

@ -61,8 +61,10 @@ sync/log/writers/AndroidLogWriter.java
sync/log/writers/LevelFilteringLogWriter.java sync/log/writers/LevelFilteringLogWriter.java
sync/log/writers/LogWriter.java sync/log/writers/LogWriter.java
sync/log/writers/PrintLogWriter.java sync/log/writers/PrintLogWriter.java
sync/log/writers/SingleTagLogWriter.java sync/log/writers/SimpleTagLogWriter.java
sync/log/writers/StringLogWriter.java sync/log/writers/StringLogWriter.java
sync/log/writers/TagLogWriter.java
sync/log/writers/ThreadLocalTagLogWriter.java
sync/Logger.java sync/Logger.java
sync/MetaGlobal.java sync/MetaGlobal.java
sync/MetaGlobalException.java sync/MetaGlobalException.java
@ -183,6 +185,7 @@ sync/setup/activities/SendTabActivity.java
sync/setup/activities/SetupFailureActivity.java sync/setup/activities/SetupFailureActivity.java
sync/setup/activities/SetupSuccessActivity.java sync/setup/activities/SetupSuccessActivity.java
sync/setup/activities/SetupSyncActivity.java sync/setup/activities/SetupSyncActivity.java
sync/setup/activities/SyncActivity.java
sync/setup/activities/WebViewActivity.java sync/setup/activities/WebViewActivity.java
sync/setup/auth/AccountAuthenticator.java sync/setup/auth/AccountAuthenticator.java
sync/setup/auth/AuthenticateAccountStage.java sync/setup/auth/AuthenticateAccountStage.java

Просмотреть файл

@ -1 +1,2 @@
sync/GlobalConstants.java sync/GlobalConstants.java
sync/SyncConstants.java