diff options
author | 2010-12-27 20:13:16 +0900 | |
---|---|---|
committer | 2010-12-27 20:13:16 +0900 | |
commit | d12def6dc8ba3a2f47b90e6d5d442f315152c6d4 (patch) | |
tree | 7274b29f518f94d31cd5c995d1b46bfc323de818 /java/src/com/android/inputmethod/latin/LatinIMEUtil.java | |
parent | b80f171623a11bceb99b563594162d0034b9bde8 (diff) | |
parent | bfe2b534457d946645d483e311249787ba4fc3ae (diff) | |
download | latinime-d12def6dc8ba3a2f47b90e6d5d442f315152c6d4.tar.gz latinime-d12def6dc8ba3a2f47b90e6d5d442f315152c6d4.tar.xz latinime-d12def6dc8ba3a2f47b90e6d5d442f315152c6d4.zip |
Merge remote branch 'goog/master' into merge
Conflicts:
java/res/values-cs/strings.xml
java/res/values-da/strings.xml
java/res/values-de/strings.xml
java/res/values-el/strings.xml
java/res/values-es-rUS/strings.xml
java/res/values-es/strings.xml
java/res/values-fr/strings.xml
java/res/values-it/strings.xml
java/res/values-ja/strings.xml
java/res/values-ko/strings.xml
java/res/values-nb/strings.xml
java/res/values-nl/strings.xml
java/res/values-pl/strings.xml
java/res/values-pt-rPT/strings.xml
java/res/values-pt/strings.xml
java/res/values-ru/strings.xml
java/res/values-sv/strings.xml
java/res/values-tr/strings.xml
java/res/values-xlarge/dimens.xml
java/res/values-zh-rCN/strings.xml
java/res/values-zh-rTW/strings.xml
java/res/values/bools.xml
java/res/xml/kbd_qwerty_rows.xml
java/res/xml/method.xml
java/res/xml/prefs.xml
Change-Id: I8768d16965e6e82c14ee742b9ada56438497eb86
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIMEUtil.java')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIMEUtil.java | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java b/java/src/com/android/inputmethod/latin/LatinIMEUtil.java deleted file mode 100644 index 34b52845e..000000000 --- a/java/src/com/android/inputmethod/latin/LatinIMEUtil.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.inputmethod.latin; - -import android.view.inputmethod.InputMethodManager; - -import android.content.Context; -import android.os.AsyncTask; -import android.text.format.DateUtils; -import android.util.Log; - -public class LatinIMEUtil { - - /** - * Cancel an {@link AsyncTask}. - * - * @param mayInterruptIfRunning <tt>true</tt> if the thread executing this - * task should be interrupted; otherwise, in-progress tasks are allowed - * to complete. - */ - public static void cancelTask(AsyncTask<?, ?, ?> task, boolean mayInterruptIfRunning) { - if (task != null && task.getStatus() != AsyncTask.Status.FINISHED) { - task.cancel(mayInterruptIfRunning); - } - } - - public static class GCUtils { - private static final String TAG = "GCUtils"; - 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(TAG, "Sleep was interrupted."); - LatinImeLogger.logOnException(metaData, t); - return false; - } - } - } - } - - public static boolean hasMultipleEnabledIMEs(Context context) { - return ((InputMethodManager) context.getSystemService( - Context.INPUT_METHOD_SERVICE)).getEnabledInputMethodList().size() > 1; - } -} |