Bug 1081401: Remove unnecessary autoboxing (recalcitrant sync part). r=rnewman
authorChris Kitching <chriskitching@linux.com>
Sat, 11 Oct 2014 20:49:46 +0100
changeset 209996 42758a959e470994cf11d4c68c422086740c4189
parent 209995 6c618ccad72e438a1f8562d7118bfba404ee8573
child 209997 cd62bf9df675aaf25be1170459cbb0e7d504c81a
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersrnewman
bugs1081401
milestone35.0a1
Bug 1081401: Remove unnecessary autoboxing (recalcitrant sync part). r=rnewman
mobile/android/base/background/common/log/writers/AndroidLevelCachingLogWriter.java
mobile/android/base/background/fxa/FxAccountAgeLockoutHelper.java
mobile/android/base/background/fxa/FxAccountClient20.java
mobile/android/base/background/healthreport/HealthReportDatabaseStorage.java
mobile/android/base/background/healthreport/HealthReportProvider.java
mobile/android/base/background/healthreport/upload/ObsoleteDocumentTracker.java
mobile/android/base/background/preferences/PreferenceManagerCompat.java
mobile/android/base/fxa/authenticator/AccountPickler.java
mobile/android/base/fxa/authenticator/AndroidFxAccount.java
mobile/android/base/sync/CryptoRecord.java
mobile/android/base/sync/EngineSettings.java
mobile/android/base/sync/ExtendedJSONObject.java
mobile/android/base/sync/GlobalSession.java
mobile/android/base/sync/InfoCollections.java
mobile/android/base/sync/MetaGlobal.java
mobile/android/base/sync/SyncConfiguration.java
mobile/android/base/sync/config/AccountPickler.java
mobile/android/base/sync/config/ConfigurationMigrator.java
mobile/android/base/sync/repositories/RepositorySessionBundle.java
mobile/android/base/sync/repositories/Server11RepositorySession.java
mobile/android/base/sync/repositories/android/AndroidBrowserBookmarksRepositorySession.java
mobile/android/base/sync/repositories/android/AndroidBrowserRepositorySession.java
mobile/android/base/sync/repositories/android/BrowserContractHelpers.java
mobile/android/base/sync/setup/activities/SendTabActivity.java
mobile/android/base/sync/stage/SafeConstrainedServer11Repository.java
mobile/android/base/sync/stage/ServerSyncStage.java
--- a/mobile/android/base/background/common/log/writers/AndroidLevelCachingLogWriter.java
+++ b/mobile/android/base/background/common/log/writers/AndroidLevelCachingLogWriter.java
@@ -37,58 +37,58 @@ public class AndroidLevelCachingLogWrite
     isInfoLoggable    = new IdentityHashMap<String, Boolean>();
     isDebugLoggable   = new IdentityHashMap<String, Boolean>();
     isVerboseLoggable = new IdentityHashMap<String, Boolean>();
   }
 
   private boolean shouldLogError(String logTag) {
     Boolean out = isErrorLoggable.get(logTag);
     if (out != null) {
-      return out.booleanValue();
+      return out;
     }
     out = Log.isLoggable(logTag, Log.ERROR);
     isErrorLoggable.put(logTag, out);
     return out;
   }
 
   private boolean shouldLogWarn(String logTag) {
     Boolean out = isWarnLoggable.get(logTag);
     if (out != null) {
-      return out.booleanValue();
+      return out;
     }
     out = Log.isLoggable(logTag, Log.WARN);
     isWarnLoggable.put(logTag, out);
     return out;
   }
 
   private boolean shouldLogInfo(String logTag) {
     Boolean out = isInfoLoggable.get(logTag);
     if (out != null) {
-      return out.booleanValue();
+      return out;
     }
     out = Log.isLoggable(logTag, Log.INFO);
     isInfoLoggable.put(logTag, out);
     return out;
   }
 
   private boolean shouldLogDebug(String logTag) {
     Boolean out = isDebugLoggable.get(logTag);
     if (out != null) {
-      return out.booleanValue();
+      return out;
     }
     out = Log.isLoggable(logTag, Log.DEBUG);
     isDebugLoggable.put(logTag, out);
     return out;
   }
 
   @Override
   public boolean shouldLogVerbose(String logTag) {
     Boolean out = isVerboseLoggable.get(logTag);
     if (out != null) {
-      return out.booleanValue();
+      return out;
     }
     out = Log.isLoggable(logTag, Log.VERBOSE);
     isVerboseLoggable.put(logTag, out);
     return out;
   }
 
   @Override
   public void error(String tag, String message, Throwable error) {
--- a/mobile/android/base/background/fxa/FxAccountAgeLockoutHelper.java
+++ b/mobile/android/base/background/fxa/FxAccountAgeLockoutHelper.java
@@ -86,11 +86,11 @@ public class FxAccountAgeLockoutHelper {
     try {
       yearOfBirth = Integer.valueOf(yearText, 10);
     } catch (NumberFormatException e) {
       // Any non-numbers in the list are ranges (and we say as much to
       // translators in the resource file), so these people pass the age check.
       FxAccountConstants.pii(LOG_TAG, "Passed age check: year text was found in item list but was not a number.");
       return true;
     }
-    return passesAgeCheck(yearOfBirth.intValue());
+    return passesAgeCheck(yearOfBirth);
   }
 }
--- a/mobile/android/base/background/fxa/FxAccountClient20.java
+++ b/mobile/android/base/background/fxa/FxAccountClient20.java
@@ -139,45 +139,42 @@ public class FxAccountClient20 extends F
         try {
           final String[] requiredStringFields = getKeys ? LOGIN_RESPONSE_REQUIRED_STRING_FIELDS_KEYS : LOGIN_RESPONSE_REQUIRED_STRING_FIELDS;
           body.throwIfFieldsMissingOrMisTyped(requiredStringFields, String.class);
 
           String uid = body.getString(JSON_KEY_UID);
           boolean verified = false; // In production, we're definitely not verified immediately upon creation.
           Boolean tempVerified = body.getBoolean(JSON_KEY_VERIFIED);
           if (tempVerified != null) {
-            verified = tempVerified.booleanValue();
+            verified = tempVerified;
           }
           byte[] sessionToken = Utils.hex2Byte(body.getString(JSON_KEY_SESSIONTOKEN));
           byte[] keyFetchToken = null;
           if (getKeys) {
             keyFetchToken = Utils.hex2Byte(body.getString(JSON_KEY_KEYFETCHTOKEN));
           }
           LoginResponse loginResponse = new LoginResponse(new String(emailUTF8, "UTF-8"), uid, verified, sessionToken, keyFetchToken);
 
           delegate.handleSuccess(loginResponse);
-          return;
         } catch (Exception e) {
           delegate.handleError(e);
-          return;
         }
       }
     };
 
     post(resource, body, delegate);
   }
 
   @Override
   public void createAccountAndGetKeys(byte[] emailUTF8, PasswordStretcher passwordStretcher, RequestDelegate<LoginResponse> delegate) {
     try {
       byte[] quickStretchedPW = passwordStretcher.getQuickStretchedPW(emailUTF8);
       createAccount(emailUTF8, quickStretchedPW, true, false, "sync", delegate);
     } catch (Exception e) {
       invokeHandleError(delegate, e);
-      return;
     }
   }
 
   @Override
   public void loginAndGetKeys(byte[] emailUTF8, PasswordStretcher passwordStretcher, RequestDelegate<LoginResponse> delegate) {
     login(emailUTF8, passwordStretcher, true, delegate);
   }
 
--- a/mobile/android/base/background/healthreport/HealthReportDatabaseStorage.java
+++ b/mobile/android/base/background/healthreport/HealthReportDatabaseStorage.java
@@ -1192,17 +1192,17 @@ public class HealthReportDatabaseStorage
 
   @Override
   public void recordDailyLast(int env, int day, int field, String value) {
     this.recordDailyLast(env, day, field, value, EVENTS_TEXTUAL);
   }
 
   @Override
   public void recordDailyLast(int env, int day, int field, int value) {
-    this.recordDailyLast(env, day, field, Integer.valueOf(value), EVENTS_INTEGER);
+    this.recordDailyLast(env, day, field, value, EVENTS_INTEGER);
   }
 
   private void recordDailyDiscrete(int env, int day, int field, Object value, String table) {
     if (env == -1) {
       Logger.warn(LOG_TAG, "Refusing to record with environment = -1.");
       return;
     }
 
--- a/mobile/android/base/background/healthreport/HealthReportProvider.java
+++ b/mobile/android/base/background/healthreport/HealthReportProvider.java
@@ -184,17 +184,17 @@ public class HealthReportProvider extend
       int by = values.containsKey("value") ? values.getAsInteger("value") : 1;
       storage.incrementDailyCount(env, day, field.getID(), by);
       return 1;
 
     case EVENTS_FIELD_LAST:
       Object object = values.get("value");
       if (object instanceof Integer ||
           object instanceof Long) {
-        storage.recordDailyLast(env, day, field.getID(), ((Integer) object).intValue());
+        storage.recordDailyLast(env, day, field.getID(), (Integer) object);
       } else if (object instanceof String) {
         storage.recordDailyLast(env, day, field.getID(), (String) object);
       } else {
         storage.recordDailyLast(env, day, field.getID(), object.toString());
       }
       return 1;
 
     default:
@@ -282,17 +282,17 @@ public class HealthReportProvider extend
     field = pathSegments.get(4);
 
     return storage.getField(measurement, measurementVersion, field);
   }
 
   private MeasurementFields getFieldSpecs(ContentValues values) {
     final ArrayList<FieldSpec> specs = new ArrayList<FieldSpec>(values.size());
     for (Entry<String, Object> entry : values.valueSet()) {
-      specs.add(new FieldSpec(entry.getKey(), ((Integer) entry.getValue()).intValue()));
+      specs.add(new FieldSpec(entry.getKey(), (Integer) entry.getValue()));
     }
 
     return new MeasurementFields() {
       @Override
       public Iterable<FieldSpec> getFields() {
         return specs;
       }
     };
--- a/mobile/android/base/background/healthreport/upload/ObsoleteDocumentTracker.java
+++ b/mobile/android/base/background/healthreport/upload/ObsoleteDocumentTracker.java
@@ -231,15 +231,15 @@ public class ObsoleteDocumentTracker {
     ExtendedJSONObject ids = getObsoleteIds();
 
     Set<String> keys = new HashSet<String>(ids.keySet()); // Avoid invalidating an iterator.
     for (String key : keys) {
       Object o = ids.get(key);
       if (!(o instanceof Long)) {
         continue;
       }
-      if (((Long) o).longValue() > HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID) {
+      if ((Long) o > HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID) {
         ids.put(key, HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID);
       }
     }
     setObsoleteIds(ids);
   }
 }
--- a/mobile/android/base/background/preferences/PreferenceManagerCompat.java
+++ b/mobile/android/base/background/preferences/PreferenceManagerCompat.java
@@ -83,17 +83,17 @@ public class PreferenceManagerCompat {
             if (listener != null) {
                 Object proxy = Proxy.newProxyInstance(
                         onPreferenceTreeClickListener.getType().getClassLoader(),
                         new Class<?>[] { onPreferenceTreeClickListener.getType() },
                         new InvocationHandler() {
                     @Override
           public Object invoke(Object proxy, Method method, Object[] args) {
                         if (method.getName().equals("onPreferenceTreeClick")) {
-                            return Boolean.valueOf(listener.onPreferenceTreeClick((PreferenceScreen) args[0], (Preference) args[1]));
+                            return listener.onPreferenceTreeClick((PreferenceScreen) args[0], (Preference) args[1]);
                         } else {
                             return null;
                         }
                     }
                 });
                 onPreferenceTreeClickListener.set(manager, proxy);
             } else {
                 onPreferenceTreeClickListener.set(manager, null);
--- a/mobile/android/base/fxa/authenticator/AccountPickler.java
+++ b/mobile/android/base/fxa/authenticator/AccountPickler.java
@@ -77,18 +77,18 @@ public class AccountPickler {
    * @return <code>true</code> if given pickle existed and was successfully deleted.
    */
   public static boolean deletePickle(final Context context, final String filename) {
     return context.deleteFile(filename);
   }
 
   public static ExtendedJSONObject toJSON(final AndroidFxAccount account, final long now) {
     final ExtendedJSONObject o = new ExtendedJSONObject();
-    o.put(KEY_PICKLE_VERSION, Long.valueOf(PICKLE_VERSION));
-    o.put(KEY_PICKLE_TIMESTAMP, Long.valueOf(now));
+    o.put(KEY_PICKLE_VERSION, PICKLE_VERSION);
+    o.put(KEY_PICKLE_TIMESTAMP, now);
 
     o.put(KEY_ACCOUNT_VERSION, AndroidFxAccount.CURRENT_ACCOUNT_VERSION);
     o.put(KEY_ACCOUNT_TYPE, FxAccountConstants.ACCOUNT_TYPE);
     o.put(KEY_EMAIL, account.getEmail());
     o.put(KEY_PROFILE, account.getProfile());
     o.put(KEY_IDP_SERVER_URI, account.getAccountServerURI());
     o.put(KEY_TOKEN_SERVER_URI, account.getTokenServerURI());
     o.put(KEY_IS_SYNCING_ENABLED, account.isSyncing());
@@ -183,17 +183,17 @@ public class AccountPickler {
     if (account == null) {
       Logger.warn(LOG_TAG, "Failed to add Android Account; aborting.");
       return null;
     }
 
     Long timestamp = json.getLong(KEY_PICKLE_TIMESTAMP);
     if (timestamp == null) {
       Logger.warn(LOG_TAG, "Did not find timestamp in pickle file; ignoring.");
-      timestamp = Long.valueOf(-1);
+      timestamp = -1L;
     }
 
     Logger.info(LOG_TAG, "Un-pickled Android account named " + params.email + " (version " +
         params.pickleVersion + ", pickled at " + timestamp + ").");
 
     return account;
   }
 
--- a/mobile/android/base/fxa/authenticator/AndroidFxAccount.java
+++ b/mobile/android/base/fxa/authenticator/AndroidFxAccount.java
@@ -164,17 +164,17 @@ public class AndroidFxAccount {
     ExtendedJSONObject o = unbundle();
     if (o == null) {
       return def;
     }
     Boolean b = o.getBoolean(key);
     if (b == null) {
       return def;
     }
-    return b.booleanValue();
+    return b;
   }
 
   protected byte[] getBundleDataBytes(String key) {
     ExtendedJSONObject o = unbundle();
     if (o == null) {
       return null;
     }
     return o.getByteArrayHex(key);
--- a/mobile/android/base/sync/CryptoRecord.java
+++ b/mobile/android/base/sync/CryptoRecord.java
@@ -148,17 +148,17 @@ public class CryptoRecord extends Record
     CryptoRecord record = new CryptoRecord(payload);
     record.guid         = id;
     record.collection   = collection;
     if (jsonRecord.containsKey(KEY_MODIFIED)) {
       Long timestamp = jsonRecord.getTimestamp(KEY_MODIFIED);
       if (timestamp == null) {
         throw new RecordParseException("timestamp could not be parsed");
       }
-      record.lastModified = timestamp.longValue();
+      record.lastModified = timestamp;
     }
     if (jsonRecord.containsKey(KEY_SORTINDEX)) {
       // getLong tries to cast to Long, and might return null. We catch all
       // exceptions, just to be safe.
       try {
         record.sortIndex = jsonRecord.getLong(KEY_SORTINDEX);
       } catch (Exception e) {
         throw new RecordParseException("timestamp could not be parsed");
--- a/mobile/android/base/sync/EngineSettings.java
+++ b/mobile/android/base/sync/EngineSettings.java
@@ -11,17 +11,17 @@ public class EngineSettings {
   public EngineSettings(final String syncID, final int version) {
     this.syncID = syncID;
     this.version = version;
   }
 
   public EngineSettings(ExtendedJSONObject object) {
     try {
       this.syncID = object.getString("syncID");
-      this.version = object.getIntegerSafely("version").intValue();
+      this.version = object.getIntegerSafely("version");
     } catch (Exception e ) {
       throw new IllegalArgumentException(e);
     }
   }
 
   public ExtendedJSONObject toJSONObject() {
     ExtendedJSONObject json = new ExtendedJSONObject();
     json.put("syncID", syncID);
--- a/mobile/android/base/sync/ExtendedJSONObject.java
+++ b/mobile/android/base/sync/ExtendedJSONObject.java
@@ -219,17 +219,17 @@ public class ExtendedJSONObject {
     Object val = this.object.get(key);
     if (val == null) {
       return null;
     }
     if (val instanceof Integer) {
       return (Integer) val;
     }
     if (val instanceof Long) {
-      return Integer.valueOf(((Long) val).intValue());
+      return ((Long) val).intValue();
     }
     if (val instanceof String) {
       return Integer.parseInt((String) val, 10);
     }
     throw new NumberFormatException("Expecting Integer, got " + val.getClass());
   }
 
   /**
@@ -238,17 +238,17 @@ public class ExtendedJSONObject {
    * @param key
    * @return A Long, or null if the value is non-numeric or doesn't exist.
    */
   public Long getTimestamp(String key) {
     Object val = this.object.get(key);
 
     // This is absurd.
     if (val instanceof Double) {
-      double millis = ((Double) val).doubleValue() * 1000;
+      double millis = ((Double) val) * 1000;
       return Double.valueOf(millis).longValue();
     }
     if (val instanceof Float) {
       double millis = ((Float) val).doubleValue() * 1000;
       return Double.valueOf(millis).longValue();
     }
     if (val instanceof Number) {
       // Must be an integral number.
--- a/mobile/android/base/sync/GlobalSession.java
+++ b/mobile/android/base/sync/GlobalSession.java
@@ -1009,17 +1009,17 @@ public class GlobalSession implements Ht
     for (String engineName : enabledEngineNames()) {
       EngineSettings engineSettings = null;
       try {
         GlobalSyncStage globalStage = this.getSyncStageByName(engineName);
         Integer version = globalStage.getStorageVersion();
         if (version == null) {
           continue; // Don't want this stage to be included in meta/global.
         }
-        engineSettings = new EngineSettings(Utils.generateGuid(), version.intValue());
+        engineSettings = new EngineSettings(Utils.generateGuid(), version);
       } catch (NoSuchStageException e) {
         // No trouble; Android Sync might not recognize this engine yet.
         // By default, version 0.  Other clients will see the 0 version and reset/wipe accordingly.
         engineSettings = new EngineSettings(Utils.generateGuid(), 0);
       }
       engines.put(engineName, engineSettings.toJSONObject());
     }
 
--- a/mobile/android/base/sync/InfoCollections.java
+++ b/mobile/android/base/sync/InfoCollections.java
@@ -93,11 +93,11 @@ public class InfoCollections {
     // No meta/global on the server? We need an update. The server fetch will fail and
     // then we will upload a fresh meta/global.
     Long serverLastModified = getTimestamp(collection);
     if (serverLastModified == null) {
       return true;
     }
 
     // Otherwise, we need an update if our modification time is stale.
-    return (serverLastModified.longValue() > lastModified);
+    return serverLastModified > lastModified;
   }
 }
--- a/mobile/android/base/sync/MetaGlobal.java
+++ b/mobile/android/base/sync/MetaGlobal.java
@@ -222,17 +222,17 @@ public class MetaGlobal implements SyncS
                            " for " + engineName + ". Recording exception.");
       exceptions.put(engineName, new MetaGlobalMalformedSyncIDException());
     }
 
     try {
       Integer version = engineEntry.getIntegerSafely("version");
       Logger.trace(LOG_TAG, "Engine " + engineName + " has server version " + version);
       if (version == null ||
-          version.intValue() == 0) {
+          version == 0) {
         // Invalid version. Wipe the server.
         Logger.warn(LOG_TAG, "Malformed version " + version +
                              " for " + engineName + ". Recording exception.");
         exceptions.put(engineName, new MetaGlobalMalformedVersionException());
         return;
       }
       versions.put(engineName, version);
     } catch (NumberFormatException e) {
--- a/mobile/android/base/sync/SyncConfiguration.java
+++ b/mobile/android/base/sync/SyncConfiguration.java
@@ -406,18 +406,18 @@ public class SyncConfiguration {
       jObj.put(engine, enabled);
       if (!enabled) {
         declined.add(engine);
       }
     }
 
     // Our history checkbox drives form history, too.
     // We don't need to do this for enablement: that's done at retrieval time.
-    if (selectedEngines.containsKey("history") && !selectedEngines.get("history").booleanValue()) {
-        declined.add("forms");
+    if (selectedEngines.containsKey("history") && !selectedEngines.get("history")) {
+      declined.add("forms");
     }
 
     String json = jObj.toJSONString();
     long currentTime = System.currentTimeMillis();
     Editor edit = prefs.edit();
     edit.putString(PREF_USER_SELECTED_ENGINES_TO_SYNC, json);
     edit.putString(PREF_DECLINED_ENGINE_NAMES, setToJSONObjectString(declined));
     edit.putLong(PREF_USER_SELECTED_ENGINES_TO_SYNC_TIMESTAMP, currentTime);
--- a/mobile/android/base/sync/config/AccountPickler.java
+++ b/mobile/android/base/sync/config/AccountPickler.java
@@ -166,17 +166,17 @@ public class AccountPickler {
       Logger.warn(LOG_TAG, "Failed to add Android Account; aborting.");
       return null;
     }
 
     Integer version   = json.getIntegerSafely(Constants.JSON_KEY_VERSION);
     Integer timestamp = json.getIntegerSafely(Constants.JSON_KEY_TIMESTAMP);
     if (version == null || timestamp == null) {
       Logger.warn(LOG_TAG, "Did not find version or timestamp in pickle file; ignoring.");
-      version = new Integer(-1);
-      timestamp = new Integer(-1);
+      version = -1;
+      timestamp = -1;
     }
 
     Logger.info(LOG_TAG, "Un-pickled Android account named " + params.username + " (version " + version + ", pickled at " + timestamp + ").");
 
     return account;
   }
 }
--- a/mobile/android/base/sync/config/ConfigurationMigrator.java
+++ b/mobile/android/base/sync/config/ConfigurationMigrator.java
@@ -50,23 +50,23 @@ public class ConfigurationMigrator {
       String fromKey = entry.getKey();
       String toKey = map.get(fromKey);
       if (toKey == null) {
         continue;
       }
 
       Object value = entry.getValue();
       if (value instanceof Boolean) {
-         to.putBoolean(toKey, ((Boolean) value).booleanValue());
+         to.putBoolean(toKey, (Boolean) value);
       } else if (value instanceof Float) {
-         to.putFloat(toKey, ((Float) value).floatValue());
+         to.putFloat(toKey, (Float) value);
       } else if (value instanceof Integer) {
-         to.putInt(toKey, ((Integer) value).intValue());
+         to.putInt(toKey, (Integer) value);
       } else if (value instanceof Long) {
-         to.putLong(toKey, ((Long) value).longValue());
+         to.putLong(toKey, (Long) value);
       } else if (value instanceof String) {
          to.putString(toKey, (String) value);
       } else {
         // Do nothing -- perhaps SharedPreferences accepts types we don't know about.
       }
 
       if (Logger.LOG_PERSONAL_INFORMATION) {
         Logger.debug(LOG_TAG, "Migrated '" + fromKey + "' to '" + toKey + "' (" + value + ").");
--- a/mobile/android/base/sync/repositories/RepositorySessionBundle.java
+++ b/mobile/android/base/sync/repositories/RepositorySessionBundle.java
@@ -32,17 +32,17 @@ public class RepositorySessionBundle {
       return object.getLong(JSON_KEY_TIMESTAMP);
     }
 
     return -1;
   }
 
   public void setTimestamp(long timestamp) {
     Logger.debug(LOG_TAG, "Setting timestamp to " + timestamp + ".");
-    object.put(JSON_KEY_TIMESTAMP, Long.valueOf(timestamp));
+    object.put(JSON_KEY_TIMESTAMP, timestamp);
   }
 
   public void bumpTimestamp(long timestamp) {
     long existing = this.getTimestamp();
     if (timestamp > existing) {
       this.setTimestamp(timestamp);
     } else {
       Logger.debug(LOG_TAG, "Timestamp " + timestamp + " not greater than " + existing + "; not bumping.");
--- a/mobile/android/base/sync/repositories/Server11RepositorySession.java
+++ b/mobile/android/base/sync/repositories/Server11RepositorySession.java
@@ -465,17 +465,17 @@ public class Server11RepositorySession e
         this.handleRequestError(e);
         return;
       }
 
       // Be defensive when logging timestamp.
       if (body.containsKey("modified")) {
         Long modified = body.getTimestamp("modified");
         if (modified != null) {
-          Logger.trace(LOG_TAG, "POST request success. Modified timestamp: " + modified.longValue());
+          Logger.trace(LOG_TAG, "POST request success. Modified timestamp: " + modified);
         } else {
           Logger.warn(LOG_TAG, "POST success body contains malformed 'modified': " + body.toJSONString());
         }
       } else {
         Logger.warn(LOG_TAG, "POST success body does not contain key 'modified': " + body.toJSONString());
       }
 
       try {
--- a/mobile/android/base/sync/repositories/android/AndroidBrowserBookmarksRepositorySession.java
+++ b/mobile/android/base/sync/repositories/android/AndroidBrowserBookmarksRepositorySession.java
@@ -267,17 +267,17 @@ public class AndroidBrowserBookmarksRepo
   }
 
   private long getIDForGUID(String guid) {
     Long id = parentGuidToIDMap.get(guid);
     if (id == null) {
       Logger.warn(LOG_TAG, "Couldn't find local ID for GUID " + guid);
       return -1;
     }
-    return id.longValue();
+    return id;
   }
 
   private String getGUID(Cursor cur) {
     return RepoUtils.getStringFromCursor(cur, "guid");
   }
 
   private long getParentID(Cursor cur) {
     return RepoUtils.getLongFromCursor(cur, BrowserContract.Bookmarks.PARENT);
@@ -359,17 +359,17 @@ public class AndroidBrowserBookmarksRepo
       // This will suffice for taking a jumble of records and indices and
       // producing a sorted sequence that preserves some kind of order --
       // from the abs of the position, falling back on cursor order (that
       // is, creation time and ID).
       // Note that this code is not intended to merge values from two sources!
       boolean changed = false;
       int i = 0;
       for (Entry<Long, ArrayList<String>> entry : guids.entrySet()) {
-        long pos = entry.getKey().longValue();
+        long pos = entry.getKey();
         int atPos = entry.getValue().size();
 
         // If every element has a different index, and the indices are
         // in strict natural order, then changed will be false.
         if (atPos > 1 || pos != i) {
           changed = true;
         }
 
--- a/mobile/android/base/sync/repositories/android/AndroidBrowserRepositorySession.java
+++ b/mobile/android/base/sync/repositories/android/AndroidBrowserRepositorySession.java
@@ -677,17 +677,17 @@ public abstract class AndroidBrowserRepo
     Logger.debug(LOG_TAG, "Existing record does not match incoming record.  Trying to find record by record string.");
     return findByRecordString(recordString);
   }
 
   protected String getGuidForString(String recordString) throws NoGuidForIdException, NullCursorException, ParentNotFoundException {
     if (recordToGuid == null) {
       createRecordToGuidMap();
     }
-    return recordToGuid.get(Integer.valueOf(recordString.hashCode()));
+    return recordToGuid.get(recordString.hashCode());
   }
 
   protected void createRecordToGuidMap() throws NoGuidForIdException, NullCursorException, ParentNotFoundException {
     Logger.info(LOG_TAG, "BEGIN: creating record -> GUID map.");
     recordToGuid = new SparseArray<String>();
 
     // TODO: we should be able to do this entire thing with string concatenations within SQL.
     // Also consider whether it's better to fetch and process every record in the DB into
@@ -697,17 +697,17 @@ public abstract class AndroidBrowserRepo
       if (!cur.moveToFirst()) {
         return;
       }
       while (!cur.isAfterLast()) {
         Record record = retrieveDuringStore(cur);
         if (record != null) {
           final String recordString = buildRecordString(record);
           if (recordString != null) {
-            recordToGuid.put(Integer.valueOf(recordString.hashCode()), record.guid);
+            recordToGuid.put(recordString.hashCode(), record.guid);
           }
         }
         cur.moveToNext();
       }
     } finally {
       cur.close();
     }
     Logger.info(LOG_TAG, "END: creating record -> GUID map.");
@@ -755,17 +755,17 @@ public abstract class AndroidBrowserRepo
   public void putRecordToGuidMap(String recordString, String guid) throws NoGuidForIdException, NullCursorException, ParentNotFoundException {
     if (recordString == null) {
       return;
     }
 
     if (recordToGuid == null) {
       createRecordToGuidMap();
     }
-    recordToGuid.put(Integer.valueOf(recordString.hashCode()), guid);
+    recordToGuid.put(recordString.hashCode(), guid);
   }
 
   protected abstract Record prepareRecord(Record record);
 
   protected void updateBookkeeping(Record record) throws NoGuidForIdException,
                                                  NullCursorException,
                                                  ParentNotFoundException {
     putRecordToGuidMap(buildRecordString(record), record.guid);
--- a/mobile/android/base/sync/repositories/android/BrowserContractHelpers.java
+++ b/mobile/android/base/sync/repositories/android/BrowserContractHelpers.java
@@ -138,15 +138,15 @@ public class BrowserContractHelpers exte
    * @param type a type string, such as "livemark".
    * @return the type code, or -1 if not found.
    */
   public static int typeCodeForString(String type) {
     Integer found = BOOKMARK_TYPE_STRING_TO_CODE.get(type);
     if (found == null) {
       return -1;
     }
-    return found.intValue();
+    return found;
   }
 
   public static boolean isSupportedType(String type) {
     return BOOKMARK_TYPE_STRING_TO_CODE.containsKey(type);
   }
 }
--- a/mobile/android/base/sync/setup/activities/SendTabActivity.java
+++ b/mobile/android/base/sync/setup/activities/SendTabActivity.java
@@ -309,17 +309,17 @@ public class SendTabActivity extends Loc
         sender.sync();
 
         return true;
       }
 
       @Override
       protected void onPostExecute(final Boolean success) {
         // We're allowed to update the UI from here.
-        notifyAndFinish(success.booleanValue());
+        notifyAndFinish(success);
       }
     }.execute();
   }
 
   /**
    * Notify the user about sent tabs status and then finish the activity.
    * <p>
    * "Success" is a bit of a misnomer: we wrote "displayURI" commands to the local
--- a/mobile/android/base/sync/stage/SafeConstrainedServer11Repository.java
+++ b/mobile/android/base/sync/stage/SafeConstrainedServer11Repository.java
@@ -89,18 +89,18 @@ public class SafeConstrainedServer11Repo
         }
 
         Integer c = counts.getCount(collection);
         if (c == null) {
           Logger.info(LOG_TAG, "Fetched counts does not include collection " + collection + "; syncing as usual.");
           return false;
         }
 
-        Logger.info(LOG_TAG, "First sync for " + collection + ": " + c.intValue() + " items.");
-        if (c.intValue() > fetchLimit) {
+        Logger.info(LOG_TAG, "First sync for " + collection + ": " + c + " items.");
+        if (c > fetchLimit) {
           Logger.warn(LOG_TAG, "Too many items to sync safely. Skipping.");
           return true;
         }
       }
       return super.shouldSkip();
     }
   }
 }
--- a/mobile/android/base/sync/stage/ServerSyncStage.java
+++ b/mobile/android/base/sync/stage/ServerSyncStage.java
@@ -120,24 +120,24 @@ public abstract class ServerSyncStage ex
       }
     }
   }
 
   protected EngineSettings getEngineSettings() throws NonObjectJSONException, IOException, ParseException {
     Integer version = getStorageVersion();
     if (version == null) {
       Logger.warn(LOG_TAG, "null storage version for " + this + "; using version 0.");
-      version = Integer.valueOf(0);
+      version = 0;
     }
 
     SynchronizerConfiguration config = this.getConfig();
     if (config == null) {
-      return new EngineSettings(null, version.intValue());
+      return new EngineSettings(null, version);
     }
-    return new EngineSettings(config.syncID, version.intValue());
+    return new EngineSettings(config.syncID, version);
   }
 
   protected abstract String getCollection();
   protected abstract String getEngineName();
   protected abstract Repository getLocalRepository();
   protected abstract RecordFactory getRecordFactory();
 
   // Override this in subclasses.