diff options
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Utils.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Utils.java | 44 |
1 files changed, 3 insertions, 41 deletions
diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java index c6b5c338b..fc7a42100 100644 --- a/java/src/com/android/inputmethod/latin/Utils.java +++ b/java/src/com/android/inputmethod/latin/Utils.java @@ -65,44 +65,6 @@ public class Utils { } } - public static class GCUtils { - private static final String GC_TAG = GCUtils.class.getSimpleName(); - public static final int GC_TRY_COUNT = 2; - // GC_TRY_LOOP_MAX is used for the hard limit of GC wait, - // GC_TRY_LOOP_MAX should be greater than GC_TRY_COUNT. - public static final int GC_TRY_LOOP_MAX = 5; - private static final long GC_INTERVAL = DateUtils.SECOND_IN_MILLIS; - private static GCUtils sInstance = new GCUtils(); - private int mGCTryCount = 0; - - public static GCUtils getInstance() { - return sInstance; - } - - public void reset() { - mGCTryCount = 0; - } - - public boolean tryGCOrWait(String metaData, Throwable t) { - if (mGCTryCount == 0) { - System.gc(); - } - if (++mGCTryCount > GC_TRY_COUNT) { - LatinImeLogger.logOnException(metaData, t); - return false; - } else { - try { - Thread.sleep(GC_INTERVAL); - return true; - } catch (InterruptedException e) { - Log.e(GC_TAG, "Sleep was interrupted."); - LatinImeLogger.logOnException(metaData, t); - return false; - } - } - } - } - /* package */ static class RingCharBuffer { private static RingCharBuffer sRingCharBuffer = new RingCharBuffer(); private static final char PLACEHOLDER_DELIMITER_CHAR = '\uFFFC'; @@ -477,7 +439,7 @@ public class Utils { private static final String HARDWARE_PREFIX = Build.HARDWARE + ","; private static final HashMap<String, String> sDeviceOverrideValueMap = - new HashMap<String, String>(); + CollectionUtils.newHashMap(); public static String getDeviceOverrideValue(Resources res, int overrideResId, String defValue) { final int orientation = res.getConfiguration().orientation; @@ -495,7 +457,7 @@ public class Utils { return sDeviceOverrideValueMap.get(key); } - private static final HashMap<String, Long> EMPTY_LT_HASH_MAP = new HashMap<String, Long>(); + private static final HashMap<String, Long> EMPTY_LT_HASH_MAP = CollectionUtils.newHashMap(); private static final String LOCALE_AND_TIME_STR_SEPARATER = ","; public static HashMap<String, Long> localeAndTimeStrToHashMap(String str) { if (TextUtils.isEmpty(str)) { @@ -506,7 +468,7 @@ public class Utils { if (N < 2 || N % 2 != 0) { return EMPTY_LT_HASH_MAP; } - final HashMap<String, Long> retval = new HashMap<String, Long>(); + final HashMap<String, Long> retval = CollectionUtils.newHashMap(); for (int i = 0; i < N / 2; ++i) { final String localeStr = ss[i * 2]; final long time = Long.valueOf(ss[i * 2 + 1]); |