Merge "Move util classes to the latin/utils directory"

main
Ken Wakasa 2013-06-24 08:49:06 +00:00 committed by Android (Google) Code Review
commit bc1813186d
130 changed files with 349 additions and 241 deletions

View File

@ -35,8 +35,8 @@ import android.view.inputmethod.EditorInfo;
import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardView; import com.android.inputmethod.keyboard.KeyboardView;
import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.CoordinateUtils; import com.android.inputmethod.latin.utils.CoordinateUtils;
/** /**
* Exposes a virtual view sub-tree for {@link KeyboardView} and generates * Exposes a virtual view sub-tree for {@link KeyboardView} and generates

View File

@ -33,8 +33,8 @@ import android.view.accessibility.AccessibilityManager;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import com.android.inputmethod.compat.SettingsSecureCompatUtils; import com.android.inputmethod.compat.SettingsSecureCompatUtils;
import com.android.inputmethod.latin.InputTypeUtils;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.InputTypeUtils;
public final class AccessibilityUtils { public final class AccessibilityUtils {
private static final String TAG = AccessibilityUtils.class.getSimpleName(); private static final String TAG = AccessibilityUtils.class.getSimpleName();

View File

@ -25,9 +25,9 @@ import android.view.inputmethod.EditorInfo;
import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardId; import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.HashMap; import java.util.HashMap;

View File

@ -23,10 +23,10 @@ import android.text.Spanned;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.style.SuggestionSpan; import android.text.style.SuggestionSpan;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.SuggestionSpanPickedNotificationReceiver; import com.android.inputmethod.latin.SuggestionSpanPickedNotificationReceiver;
import com.android.inputmethod.latin.utils.CollectionUtils;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -28,6 +28,8 @@ import android.util.Log;
import com.android.inputmethod.compat.DownloadManagerCompatUtils; import com.android.inputmethod.compat.DownloadManagerCompatUtils;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.LogUtils;
import com.android.inputmethod.latin.utils.Utils;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Queue; import java.util.Queue;
@ -98,7 +100,7 @@ public final class ActionBatch {
final boolean mForceStartNow; final boolean mForceStartNow;
public StartDownloadAction(final String clientId, public StartDownloadAction(final String clientId,
final WordListMetadata wordList, final boolean forceStartNow) { final WordListMetadata wordList, final boolean forceStartNow) {
Utils.l("New download action for client ", clientId, " : ", wordList); LogUtils.l("New download action for client ", clientId, " : ", wordList);
mClientId = clientId; mClientId = clientId;
mWordList = wordList; mWordList = wordList;
mForceStartNow = forceStartNow; mForceStartNow = forceStartNow;
@ -110,7 +112,7 @@ public final class ActionBatch {
Log.e(TAG, "UpdateAction with a null parameter!"); Log.e(TAG, "UpdateAction with a null parameter!");
return; return;
} }
Utils.l("Downloading word list"); LogUtils.l("Downloading word list");
final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId); final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db, final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db,
mWordList.mId, mWordList.mVersion); mWordList.mId, mWordList.mVersion);
@ -132,7 +134,7 @@ public final class ActionBatch {
+ " for an upgrade action. Fall back to download."); + " for an upgrade action. Fall back to download.");
} }
// Download it. // Download it.
Utils.l("Upgrade word list, downloading", mWordList.mRemoteFilename); LogUtils.l("Upgrade word list, downloading", mWordList.mRemoteFilename);
// TODO: if DownloadManager is disabled or not installed, download by ourselves // TODO: if DownloadManager is disabled or not installed, download by ourselves
if (null == manager) return; if (null == manager) return;
@ -142,7 +144,7 @@ public final class ActionBatch {
// DownloadManager also stupidly cuts the extension to replace with its own that it // DownloadManager also stupidly cuts the extension to replace with its own that it
// gets from the content-type. We need to circumvent this. // gets from the content-type. We need to circumvent this.
final String disambiguator = "#" + System.currentTimeMillis() final String disambiguator = "#" + System.currentTimeMillis()
+ com.android.inputmethod.latin.Utils.getVersionName(context) + ".dict"; + Utils.getVersionName(context) + ".dict";
final Uri uri = Uri.parse(mWordList.mRemoteFilename + disambiguator); final Uri uri = Uri.parse(mWordList.mRemoteFilename + disambiguator);
final Request request = new Request(uri); final Request request = new Request(uri);
@ -178,7 +180,7 @@ public final class ActionBatch {
final long downloadId = UpdateHandler.registerDownloadRequest(manager, request, db, final long downloadId = UpdateHandler.registerDownloadRequest(manager, request, db,
mWordList.mId, mWordList.mVersion); mWordList.mId, mWordList.mVersion);
Utils.l("Starting download of", uri, "with id", downloadId); LogUtils.l("Starting download of", uri, "with id", downloadId);
PrivateLog.log("Starting download of " + uri + ", id : " + downloadId); PrivateLog.log("Starting download of " + uri + ", id : " + downloadId);
} }
} }
@ -195,7 +197,8 @@ public final class ActionBatch {
public InstallAfterDownloadAction(final String clientId, public InstallAfterDownloadAction(final String clientId,
final ContentValues wordListValues) { final ContentValues wordListValues) {
Utils.l("New InstallAfterDownloadAction for client ", clientId, " : ", wordListValues); LogUtils.l("New InstallAfterDownloadAction for client ", clientId, " : ",
wordListValues);
mClientId = clientId; mClientId = clientId;
mWordListValues = wordListValues; mWordListValues = wordListValues;
} }
@ -213,7 +216,7 @@ public final class ActionBatch {
+ " for an InstallAfterDownload action. Bailing out."); + " for an InstallAfterDownload action. Bailing out.");
return; return;
} }
Utils.l("Setting word list as installed"); LogUtils.l("Setting word list as installed");
final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId); final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
MetadataDbHelper.markEntryAsFinishedDownloadingAndInstalled(db, mWordListValues); MetadataDbHelper.markEntryAsFinishedDownloadingAndInstalled(db, mWordListValues);
} }
@ -229,7 +232,7 @@ public final class ActionBatch {
final WordListMetadata mWordList; final WordListMetadata mWordList;
public EnableAction(final String clientId, final WordListMetadata wordList) { public EnableAction(final String clientId, final WordListMetadata wordList) {
Utils.l("New EnableAction for client ", clientId, " : ", wordList); LogUtils.l("New EnableAction for client ", clientId, " : ", wordList);
mClientId = clientId; mClientId = clientId;
mWordList = wordList; mWordList = wordList;
} }
@ -240,7 +243,7 @@ public final class ActionBatch {
Log.e(TAG, "EnableAction with a null parameter!"); Log.e(TAG, "EnableAction with a null parameter!");
return; return;
} }
Utils.l("Enabling word list"); LogUtils.l("Enabling word list");
final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId); final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db, final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db,
mWordList.mId, mWordList.mVersion); mWordList.mId, mWordList.mVersion);
@ -264,7 +267,7 @@ public final class ActionBatch {
// The word list to disable. May not be null. // The word list to disable. May not be null.
final WordListMetadata mWordList; final WordListMetadata mWordList;
public DisableAction(final String clientId, final WordListMetadata wordlist) { public DisableAction(final String clientId, final WordListMetadata wordlist) {
Utils.l("New Disable action for client ", clientId, " : ", wordlist); LogUtils.l("New Disable action for client ", clientId, " : ", wordlist);
mClientId = clientId; mClientId = clientId;
mWordList = wordlist; mWordList = wordlist;
} }
@ -275,7 +278,7 @@ public final class ActionBatch {
Log.e(TAG, "DisableAction with a null word list!"); Log.e(TAG, "DisableAction with a null word list!");
return; return;
} }
Utils.l("Disabling word list : " + mWordList); LogUtils.l("Disabling word list : " + mWordList);
final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId); final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db, final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db,
mWordList.mId, mWordList.mVersion); mWordList.mId, mWordList.mVersion);
@ -311,7 +314,7 @@ public final class ActionBatch {
// The word list to make available. May not be null. // The word list to make available. May not be null.
final WordListMetadata mWordList; final WordListMetadata mWordList;
public MakeAvailableAction(final String clientId, final WordListMetadata wordlist) { public MakeAvailableAction(final String clientId, final WordListMetadata wordlist) {
Utils.l("New MakeAvailable action", clientId, " : ", wordlist); LogUtils.l("New MakeAvailable action", clientId, " : ", wordlist);
mClientId = clientId; mClientId = clientId;
mWordList = wordlist; mWordList = wordlist;
} }
@ -328,7 +331,7 @@ public final class ActionBatch {
Log.e(TAG, "Unexpected state of the word list '" + mWordList.mId + "' " Log.e(TAG, "Unexpected state of the word list '" + mWordList.mId + "' "
+ " for a makeavailable action. Marking as available anyway."); + " for a makeavailable action. Marking as available anyway.");
} }
Utils.l("Making word list available : " + mWordList); LogUtils.l("Making word list available : " + mWordList);
// If mLocalFilename is null, then it's a remote file that hasn't been downloaded // If mLocalFilename is null, then it's a remote file that hasn't been downloaded
// yet, so we set the local filename to the empty string. // yet, so we set the local filename to the empty string.
final ContentValues values = MetadataDbHelper.makeContentValues(0, final ContentValues values = MetadataDbHelper.makeContentValues(0,
@ -360,7 +363,7 @@ public final class ActionBatch {
// The word list to mark pre-installed. May not be null. // The word list to mark pre-installed. May not be null.
final WordListMetadata mWordList; final WordListMetadata mWordList;
public MarkPreInstalledAction(final String clientId, final WordListMetadata wordlist) { public MarkPreInstalledAction(final String clientId, final WordListMetadata wordlist) {
Utils.l("New MarkPreInstalled action", clientId, " : ", wordlist); LogUtils.l("New MarkPreInstalled action", clientId, " : ", wordlist);
mClientId = clientId; mClientId = clientId;
mWordList = wordlist; mWordList = wordlist;
} }
@ -377,7 +380,7 @@ public final class ActionBatch {
Log.e(TAG, "Unexpected state of the word list '" + mWordList.mId + "' " Log.e(TAG, "Unexpected state of the word list '" + mWordList.mId + "' "
+ " for a markpreinstalled action. Marking as preinstalled anyway."); + " for a markpreinstalled action. Marking as preinstalled anyway.");
} }
Utils.l("Marking word list preinstalled : " + mWordList); LogUtils.l("Marking word list preinstalled : " + mWordList);
// This word list is pre-installed : we don't have its file. We should reset // This word list is pre-installed : we don't have its file. We should reset
// the local file name to the empty string so that we don't try to open it // the local file name to the empty string so that we don't try to open it
// accidentally. The remote filename may be set by the application if it so wishes. // accidentally. The remote filename may be set by the application if it so wishes.
@ -401,7 +404,7 @@ public final class ActionBatch {
private final String mClientId; private final String mClientId;
final WordListMetadata mWordList; final WordListMetadata mWordList;
public UpdateDataAction(final String clientId, final WordListMetadata wordlist) { public UpdateDataAction(final String clientId, final WordListMetadata wordlist) {
Utils.l("New UpdateData action for client ", clientId, " : ", wordlist); LogUtils.l("New UpdateData action for client ", clientId, " : ", wordlist);
mClientId = clientId; mClientId = clientId;
mWordList = wordlist; mWordList = wordlist;
} }
@ -419,7 +422,7 @@ public final class ActionBatch {
Log.e(TAG, "Trying to update data about a non-existing word list. Bailing out."); Log.e(TAG, "Trying to update data about a non-existing word list. Bailing out.");
return; return;
} }
Utils.l("Updating data about a word list : " + mWordList); LogUtils.l("Updating data about a word list : " + mWordList);
final ContentValues values = MetadataDbHelper.makeContentValues( final ContentValues values = MetadataDbHelper.makeContentValues(
oldValues.getAsInteger(MetadataDbHelper.PENDINGID_COLUMN), oldValues.getAsInteger(MetadataDbHelper.PENDINGID_COLUMN),
oldValues.getAsInteger(MetadataDbHelper.TYPE_COLUMN), oldValues.getAsInteger(MetadataDbHelper.TYPE_COLUMN),
@ -453,7 +456,7 @@ public final class ActionBatch {
final boolean mHasNewerVersion; final boolean mHasNewerVersion;
public ForgetAction(final String clientId, final WordListMetadata wordlist, public ForgetAction(final String clientId, final WordListMetadata wordlist,
final boolean hasNewerVersion) { final boolean hasNewerVersion) {
Utils.l("New TryRemove action for client ", clientId, " : ", wordlist); LogUtils.l("New TryRemove action for client ", clientId, " : ", wordlist);
mClientId = clientId; mClientId = clientId;
mWordList = wordlist; mWordList = wordlist;
mHasNewerVersion = hasNewerVersion; mHasNewerVersion = hasNewerVersion;
@ -465,7 +468,7 @@ public final class ActionBatch {
Log.e(TAG, "TryRemoveAction with a null word list!"); Log.e(TAG, "TryRemoveAction with a null word list!");
return; return;
} }
Utils.l("Trying to remove word list : " + mWordList); LogUtils.l("Trying to remove word list : " + mWordList);
final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId); final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db, final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db,
mWordList.mId, mWordList.mVersion); mWordList.mId, mWordList.mVersion);
@ -525,7 +528,7 @@ public final class ActionBatch {
// The word list to delete. May not be null. // The word list to delete. May not be null.
final WordListMetadata mWordList; final WordListMetadata mWordList;
public StartDeleteAction(final String clientId, final WordListMetadata wordlist) { public StartDeleteAction(final String clientId, final WordListMetadata wordlist) {
Utils.l("New StartDelete action for client ", clientId, " : ", wordlist); LogUtils.l("New StartDelete action for client ", clientId, " : ", wordlist);
mClientId = clientId; mClientId = clientId;
mWordList = wordlist; mWordList = wordlist;
} }
@ -536,7 +539,7 @@ public final class ActionBatch {
Log.e(TAG, "StartDeleteAction with a null word list!"); Log.e(TAG, "StartDeleteAction with a null word list!");
return; return;
} }
Utils.l("Trying to delete word list : " + mWordList); LogUtils.l("Trying to delete word list : " + mWordList);
final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId); final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db, final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db,
mWordList.mId, mWordList.mVersion); mWordList.mId, mWordList.mVersion);
@ -564,7 +567,7 @@ public final class ActionBatch {
// The word list to delete. May not be null. // The word list to delete. May not be null.
final WordListMetadata mWordList; final WordListMetadata mWordList;
public FinishDeleteAction(final String clientId, final WordListMetadata wordlist) { public FinishDeleteAction(final String clientId, final WordListMetadata wordlist) {
Utils.l("New FinishDelete action for client", clientId, " : ", wordlist); LogUtils.l("New FinishDelete action for client", clientId, " : ", wordlist);
mClientId = clientId; mClientId = clientId;
mWordList = wordlist; mWordList = wordlist;
} }
@ -575,7 +578,7 @@ public final class ActionBatch {
Log.e(TAG, "FinishDeleteAction with a null word list!"); Log.e(TAG, "FinishDeleteAction with a null word list!");
return; return;
} }
Utils.l("Trying to delete word list : " + mWordList); LogUtils.l("Trying to delete word list : " + mWordList);
final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId); final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db, final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db,
mWordList.mId, mWordList.mVersion); mWordList.mId, mWordList.mVersion);
@ -632,7 +635,7 @@ public final class ActionBatch {
* @param reporter a Reporter to send errors to. * @param reporter a Reporter to send errors to.
*/ */
public void execute(final Context context, final ProblemReporter reporter) { public void execute(final Context context, final ProblemReporter reporter) {
Utils.l("Executing a batch of actions"); LogUtils.l("Executing a batch of actions");
Queue<Action> remainingActions = mActions; Queue<Action> remainingActions = mActions;
while (!remainingActions.isEmpty()) { while (!remainingActions.isEmpty()) {
final Action a = remainingActions.poll(); final Action a = remainingActions.poll();

View File

@ -18,7 +18,7 @@ package com.android.inputmethod.dictionarypack;
import android.view.View; import android.view.View;
import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;

View File

@ -31,6 +31,7 @@ import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.LogUtils;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -219,7 +220,7 @@ public final class DictionaryProvider extends ContentProvider {
@Override @Override
public Cursor query(final Uri uri, final String[] projection, final String selection, public Cursor query(final Uri uri, final String[] projection, final String selection,
final String[] selectionArgs, final String sortOrder) { final String[] selectionArgs, final String sortOrder) {
Utils.l("Uri =", uri); LogUtils.l("Uri =", uri);
PrivateLog.log("Query : " + uri); PrivateLog.log("Query : " + uri);
final String clientId = getClientId(uri); final String clientId = getClientId(uri);
final int match = matchUri(uri); final int match = matchUri(uri);
@ -227,7 +228,7 @@ public final class DictionaryProvider extends ContentProvider {
case DICTIONARY_V1_WHOLE_LIST: case DICTIONARY_V1_WHOLE_LIST:
case DICTIONARY_V2_WHOLE_LIST: case DICTIONARY_V2_WHOLE_LIST:
final Cursor c = MetadataDbHelper.queryDictionaries(getContext(), clientId); final Cursor c = MetadataDbHelper.queryDictionaries(getContext(), clientId);
Utils.l("List of dictionaries with count", c.getCount()); LogUtils.l("List of dictionaries with count", c.getCount());
PrivateLog.log("Returned a list of " + c.getCount() + " items"); PrivateLog.log("Returned a list of " + c.getCount() + " items");
return c; return c;
case DICTIONARY_V2_DICT_INFO: case DICTIONARY_V2_DICT_INFO:

View File

@ -25,6 +25,7 @@ import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.LogUtils;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -772,12 +773,12 @@ public class MetadataDbHelper extends SQLiteOpenHelper {
if (TextUtils.isEmpty(valuesClientId) || null == valuesMetadataUri if (TextUtils.isEmpty(valuesClientId) || null == valuesMetadataUri
|| null == valuesMetadataAdditionalId) { || null == valuesMetadataAdditionalId) {
// We need all these columns to be filled in // We need all these columns to be filled in
Utils.l("Missing parameter for updateClientInfo"); LogUtils.l("Missing parameter for updateClientInfo");
return; return;
} }
if (!clientId.equals(valuesClientId)) { if (!clientId.equals(valuesClientId)) {
// Mismatch! The client violates the protocol. // Mismatch! The client violates the protocol.
Utils.l("Received an updateClientInfo request for ", clientId, " but the values " LogUtils.l("Received an updateClientInfo request for ", clientId, " but the values "
+ "contain a different ID : ", valuesClientId); + "contain a different ID : ", valuesClientId);
return; return;
} }
@ -847,7 +848,7 @@ public class MetadataDbHelper extends SQLiteOpenHelper {
final ContentValues r) { final ContentValues r) {
switch (r.getAsInteger(TYPE_COLUMN)) { switch (r.getAsInteger(TYPE_COLUMN)) {
case TYPE_BULK: case TYPE_BULK:
Utils.l("Ended processing a wordlist"); LogUtils.l("Ended processing a wordlist");
// Updating a bulk word list is a three-step operation: // Updating a bulk word list is a three-step operation:
// - Add the new entry to the table // - Add the new entry to the table
// - Remove the old entry from the table // - Remove the old entry from the table
@ -869,7 +870,7 @@ public class MetadataDbHelper extends SQLiteOpenHelper {
// the phone is suddenly cut during an update. // the phone is suddenly cut during an update.
final int filenameIndex = c.getColumnIndex(LOCAL_FILENAME_COLUMN); final int filenameIndex = c.getColumnIndex(LOCAL_FILENAME_COLUMN);
do { do {
Utils.l("Setting for removal", c.getString(filenameIndex)); LogUtils.l("Setting for removal", c.getString(filenameIndex));
filenames.add(c.getString(filenameIndex)); filenames.add(c.getString(filenameIndex));
} while (c.moveToNext()); } while (c.moveToNext());
} }

View File

@ -38,6 +38,8 @@ import android.util.Log;
import com.android.inputmethod.compat.ConnectivityManagerCompatUtils; import com.android.inputmethod.compat.ConnectivityManagerCompatUtils;
import com.android.inputmethod.compat.DownloadManagerCompatUtils; import com.android.inputmethod.compat.DownloadManagerCompatUtils;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.LogUtils;
import com.android.inputmethod.latin.utils.Utils;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -183,8 +185,8 @@ public final class UpdateHandler {
final String clientId = cursor.getString(0); final String clientId = cursor.getString(0);
final String metadataUri = final String metadataUri =
MetadataDbHelper.getMetadataUriAsString(context, clientId); MetadataDbHelper.getMetadataUriAsString(context, clientId);
PrivateLog.log("Update for clientId " + Utils.s(clientId)); PrivateLog.log("Update for clientId " + LogUtils.s(clientId));
Utils.l("Update for clientId", clientId, " which uses URI ", metadataUri); LogUtils.l("Update for clientId", clientId, " which uses URI ", metadataUri);
uris.add(metadataUri); uris.add(metadataUri);
} while (cursor.moveToNext()); } while (cursor.moveToNext());
} finally { } finally {
@ -211,14 +213,14 @@ public final class UpdateHandler {
*/ */
private static void updateClientsWithMetadataUri(final Context context, private static void updateClientsWithMetadataUri(final Context context,
final boolean updateNow, final String metadataUri) { final boolean updateNow, final String metadataUri) {
PrivateLog.log("Update for metadata URI " + Utils.s(metadataUri)); PrivateLog.log("Update for metadata URI " + LogUtils.s(metadataUri));
// Adding a disambiguator to circumvent a bug in older versions of DownloadManager. // Adding a disambiguator to circumvent a bug in older versions of DownloadManager.
// DownloadManager also stupidly cuts the extension to replace with its own that it // DownloadManager also stupidly cuts the extension to replace with its own that it
// gets from the content-type. We need to circumvent this. // gets from the content-type. We need to circumvent this.
final String disambiguator = "#" + System.currentTimeMillis() final String disambiguator = "#" + System.currentTimeMillis()
+ com.android.inputmethod.latin.Utils.getVersionName(context) + ".json"; + Utils.getVersionName(context) + ".json";
final Request metadataRequest = new Request(Uri.parse(metadataUri + disambiguator)); final Request metadataRequest = new Request(Uri.parse(metadataUri + disambiguator));
Utils.l("Request =", metadataRequest); LogUtils.l("Request =", metadataRequest);
final Resources res = context.getResources(); final Resources res = context.getResources();
// By default, download over roaming is allowed and all network types are allowed too. // By default, download over roaming is allowed and all network types are allowed too.
@ -254,7 +256,7 @@ public final class UpdateHandler {
final long downloadId; final long downloadId;
synchronized (sSharedIdProtector) { synchronized (sSharedIdProtector) {
downloadId = manager.enqueue(metadataRequest); downloadId = manager.enqueue(metadataRequest);
Utils.l("Metadata download requested with id", downloadId); LogUtils.l("Metadata download requested with id", downloadId);
// If there is already a download in progress, it's been there for a while and // If there is already a download in progress, it's been there for a while and
// there is probably something wrong with download manager. It's best to just // there is probably something wrong with download manager. It's best to just
// overwrite the id and request it again. If the old one happens to finish // overwrite the id and request it again. If the old one happens to finish
@ -326,11 +328,11 @@ public final class UpdateHandler {
*/ */
public static long registerDownloadRequest(final DownloadManager manager, final Request request, public static long registerDownloadRequest(final DownloadManager manager, final Request request,
final SQLiteDatabase db, final String id, final int version) { final SQLiteDatabase db, final String id, final int version) {
Utils.l("RegisterDownloadRequest for word list id : ", id, ", version ", version); LogUtils.l("RegisterDownloadRequest for word list id : ", id, ", version ", version);
final long downloadId; final long downloadId;
synchronized (sSharedIdProtector) { synchronized (sSharedIdProtector) {
downloadId = manager.enqueue(request); downloadId = manager.enqueue(request);
Utils.l("Download requested with id", downloadId); LogUtils.l("Download requested with id", downloadId);
MetadataDbHelper.markEntryAsDownloading(db, id, version, downloadId); MetadataDbHelper.markEntryAsDownloading(db, id, version, downloadId);
} }
return downloadId; return downloadId;
@ -416,7 +418,7 @@ public final class UpdateHandler {
// Get and check the ID of the file that was downloaded // Get and check the ID of the file that was downloaded
final long fileId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, NOT_AN_ID); final long fileId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, NOT_AN_ID);
PrivateLog.log("Download finished with id " + fileId); PrivateLog.log("Download finished with id " + fileId);
Utils.l("DownloadFinished with id", fileId); LogUtils.l("DownloadFinished with id", fileId);
if (NOT_AN_ID == fileId) return; // Spurious wake-up: ignore if (NOT_AN_ID == fileId) return; // Spurious wake-up: ignore
final DownloadManager manager = final DownloadManager manager =
@ -426,7 +428,7 @@ public final class UpdateHandler {
final ArrayList<DownloadRecord> recordList = final ArrayList<DownloadRecord> recordList =
getDownloadRecordsForCompletedDownloadInfo(context, downloadInfo); getDownloadRecordsForCompletedDownloadInfo(context, downloadInfo);
if (null == recordList) return; // It was someone else's download. if (null == recordList) return; // It was someone else's download.
Utils.l("Received result for download ", fileId); LogUtils.l("Received result for download ", fileId);
// TODO: handle gracefully a null pointer here. This is practically impossible because // TODO: handle gracefully a null pointer here. This is practically impossible because
// we come here only when DownloadManager explicitly called us when it ended a // we come here only when DownloadManager explicitly called us when it ended a
@ -503,7 +505,7 @@ public final class UpdateHandler {
private static void publishUpdateCycleCompletedEvent(final Context context) { private static void publishUpdateCycleCompletedEvent(final Context context) {
// Even if this is not successful, we have to publish the new state. // Even if this is not successful, we have to publish the new state.
PrivateLog.log("Publishing update cycle completed event"); PrivateLog.log("Publishing update cycle completed event");
Utils.l("Publishing update cycle completed event"); LogUtils.l("Publishing update cycle completed event");
for (UpdateEventListener listener : linkedCopyOfList(sUpdateEventListeners)) { for (UpdateEventListener listener : linkedCopyOfList(sUpdateEventListeners)) {
listener.updateCycleCompleted(); listener.updateCycleCompleted();
} }
@ -517,12 +519,12 @@ public final class UpdateHandler {
// {@link handleWordList(Context,InputStream,ContentValues)}. // {@link handleWordList(Context,InputStream,ContentValues)}.
// Handle the downloaded file according to its type // Handle the downloaded file according to its type
if (downloadRecord.isMetadata()) { if (downloadRecord.isMetadata()) {
Utils.l("Data D/L'd is metadata for", downloadRecord.mClientId); LogUtils.l("Data D/L'd is metadata for", downloadRecord.mClientId);
// #handleMetadata() closes its InputStream argument // #handleMetadata() closes its InputStream argument
handleMetadata(context, new ParcelFileDescriptor.AutoCloseInputStream( handleMetadata(context, new ParcelFileDescriptor.AutoCloseInputStream(
manager.openDownloadedFile(fileId)), downloadRecord.mClientId); manager.openDownloadedFile(fileId)), downloadRecord.mClientId);
} else { } else {
Utils.l("Data D/L'd is a word list"); LogUtils.l("Data D/L'd is a word list");
final int wordListStatus = downloadRecord.mAttributes.getAsInteger( final int wordListStatus = downloadRecord.mAttributes.getAsInteger(
MetadataDbHelper.STATUS_COLUMN); MetadataDbHelper.STATUS_COLUMN);
if (MetadataDbHelper.STATUS_DOWNLOADING == wordListStatus) { if (MetadataDbHelper.STATUS_DOWNLOADING == wordListStatus) {
@ -582,7 +584,7 @@ public final class UpdateHandler {
*/ */
private static void handleMetadata(final Context context, final InputStream stream, private static void handleMetadata(final Context context, final InputStream stream,
final String clientId) throws IOException, BadFormatException { final String clientId) throws IOException, BadFormatException {
Utils.l("Entering handleMetadata"); LogUtils.l("Entering handleMetadata");
final List<WordListMetadata> newMetadata; final List<WordListMetadata> newMetadata;
final InputStreamReader reader = new InputStreamReader(stream); final InputStreamReader reader = new InputStreamReader(stream);
try { try {
@ -592,7 +594,7 @@ public final class UpdateHandler {
reader.close(); reader.close();
} }
Utils.l("Downloaded metadata :", newMetadata); LogUtils.l("Downloaded metadata :", newMetadata);
PrivateLog.log("Downloaded metadata\n" + newMetadata); PrivateLog.log("Downloaded metadata\n" + newMetadata);
final ActionBatch actions = computeUpgradeTo(context, clientId, newMetadata); final ActionBatch actions = computeUpgradeTo(context, clientId, newMetadata);
@ -617,7 +619,7 @@ public final class UpdateHandler {
// DownloadManager does not have the ability to put the file directly where we want // DownloadManager does not have the ability to put the file directly where we want
// it, so we had it download to a temporary place. Now we move it. It will be deleted // it, so we had it download to a temporary place. Now we move it. It will be deleted
// automatically by DownloadManager. // automatically by DownloadManager.
Utils.l("Downloaded a new word list :", downloadRecord.mAttributes.getAsString( LogUtils.l("Downloaded a new word list :", downloadRecord.mAttributes.getAsString(
MetadataDbHelper.DESCRIPTION_COLUMN), "for", downloadRecord.mClientId); MetadataDbHelper.DESCRIPTION_COLUMN), "for", downloadRecord.mClientId);
PrivateLog.log("Downloaded a new word list with description : " PrivateLog.log("Downloaded a new word list with description : "
+ downloadRecord.mAttributes.getAsString(MetadataDbHelper.DESCRIPTION_COLUMN) + downloadRecord.mAttributes.getAsString(MetadataDbHelper.DESCRIPTION_COLUMN)
@ -676,9 +678,9 @@ public final class UpdateHandler {
*/ */
private static void copyFile(final InputStream in, final OutputStream out) private static void copyFile(final InputStream in, final OutputStream out)
throws IOException { throws IOException {
Utils.l("Copying files"); LogUtils.l("Copying files");
if (!(in instanceof FileInputStream) || !(out instanceof FileOutputStream)) { if (!(in instanceof FileInputStream) || !(out instanceof FileOutputStream)) {
Utils.l("Not the right types"); LogUtils.l("Not the right types");
copyFileFallback(in, out); copyFileFallback(in, out);
} else { } else {
try { try {
@ -687,7 +689,7 @@ public final class UpdateHandler {
sourceChannel.transferTo(0, Integer.MAX_VALUE, destinationChannel); sourceChannel.transferTo(0, Integer.MAX_VALUE, destinationChannel);
} catch (IOException e) { } catch (IOException e) {
// Can't work with channels, or something went wrong. Copy by hand. // Can't work with channels, or something went wrong. Copy by hand.
Utils.l("Won't work"); LogUtils.l("Won't work");
copyFileFallback(in, out); copyFileFallback(in, out);
} }
} }
@ -702,7 +704,7 @@ public final class UpdateHandler {
*/ */
private static void copyFileFallback(final InputStream in, final OutputStream out) private static void copyFileFallback(final InputStream in, final OutputStream out)
throws IOException { throws IOException {
Utils.l("Falling back to slow copy"); LogUtils.l("Falling back to slow copy");
final byte[] buffer = new byte[FILE_COPY_BUFFER_SIZE]; final byte[] buffer = new byte[FILE_COPY_BUFFER_SIZE];
for (int readBytes = in.read(buffer); readBytes >= 0; readBytes = in.read(buffer)) for (int readBytes = in.read(buffer); readBytes >= 0; readBytes = in.read(buffer))
out.write(buffer, 0, readBytes); out.write(buffer, 0, readBytes);
@ -717,10 +719,10 @@ public final class UpdateHandler {
*/ */
private static String getTempFileName(final Context context, final String locale) private static String getTempFileName(final Context context, final String locale)
throws IOException { throws IOException {
Utils.l("Entering openTempFileOutput"); LogUtils.l("Entering openTempFileOutput");
final File dir = context.getFilesDir(); final File dir = context.getFilesDir();
final File f = File.createTempFile(locale + "___", DICT_FILE_SUFFIX, dir); final File f = File.createTempFile(locale + "___", DICT_FILE_SUFFIX, dir);
Utils.l("File name is", f.getName()); LogUtils.l("File name is", f.getName());
return f.getName(); return f.getName();
} }
@ -741,7 +743,7 @@ public final class UpdateHandler {
final String clientId, List<WordListMetadata> from, List<WordListMetadata> to) { final String clientId, List<WordListMetadata> from, List<WordListMetadata> to) {
final ActionBatch actions = new ActionBatch(); final ActionBatch actions = new ActionBatch();
// Upgrade existing word lists // Upgrade existing word lists
Utils.l("Comparing dictionaries"); LogUtils.l("Comparing dictionaries");
final Set<String> wordListIds = new TreeSet<String>(); final Set<String> wordListIds = new TreeSet<String>();
// TODO: Can these be null? // TODO: Can these be null?
if (null == from) from = new ArrayList<WordListMetadata>(); if (null == from) from = new ArrayList<WordListMetadata>();
@ -756,7 +758,7 @@ public final class UpdateHandler {
final WordListMetadata newInfo = null == metadataInfo final WordListMetadata newInfo = null == metadataInfo
|| metadataInfo.mFormatVersion > MAXIMUM_SUPPORTED_FORMAT_VERSION || metadataInfo.mFormatVersion > MAXIMUM_SUPPORTED_FORMAT_VERSION
? null : metadataInfo; ? null : metadataInfo;
Utils.l("Considering updating ", id, "currentInfo =", currentInfo); LogUtils.l("Considering updating ", id, "currentInfo =", currentInfo);
if (null == currentInfo && null == newInfo) { if (null == currentInfo && null == newInfo) {
// This may happen if a new word list appeared that we can't handle. // This may happen if a new word list appeared that we can't handle.

View File

@ -19,9 +19,9 @@ package com.android.inputmethod.event;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.KeyEvent; import android.view.KeyEvent;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.LatinIME; import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -41,7 +41,7 @@ import com.android.inputmethod.keyboard.internal.KeyboardRow;
import com.android.inputmethod.keyboard.internal.MoreKeySpec; import com.android.inputmethod.keyboard.internal.MoreKeySpec;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.StringUtils; import com.android.inputmethod.latin.utils.StringUtils;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;

View File

@ -21,8 +21,8 @@ import android.util.SparseArray;
import com.android.inputmethod.keyboard.internal.KeyVisualAttributes; import com.android.inputmethod.keyboard.internal.KeyVisualAttributes;
import com.android.inputmethod.keyboard.internal.KeyboardIconsSet; import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.keyboard.internal.KeyboardParams; import com.android.inputmethod.keyboard.internal.KeyboardParams;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.utils.CollectionUtils;
/** /**
* Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard * Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard

View File

@ -25,8 +25,8 @@ import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.compat.EditorInfoCompatUtils; import com.android.inputmethod.compat.EditorInfoCompatUtils;
import com.android.inputmethod.latin.InputTypeUtils;
import com.android.inputmethod.latin.SubtypeLocale; import com.android.inputmethod.latin.SubtypeLocale;
import com.android.inputmethod.latin.utils.InputTypeUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale; import java.util.Locale;

View File

@ -42,15 +42,15 @@ import com.android.inputmethod.keyboard.internal.KeyboardBuilder;
import com.android.inputmethod.keyboard.internal.KeyboardParams; import com.android.inputmethod.keyboard.internal.KeyboardParams;
import com.android.inputmethod.keyboard.internal.KeysCache; import com.android.inputmethod.keyboard.internal.KeysCache;
import com.android.inputmethod.latin.AdditionalSubtype; import com.android.inputmethod.latin.AdditionalSubtype;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.InputAttributes; import com.android.inputmethod.latin.InputAttributes;
import com.android.inputmethod.latin.InputTypeUtils;
import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResourceUtils;
import com.android.inputmethod.latin.SubtypeLocale; import com.android.inputmethod.latin.SubtypeLocale;
import com.android.inputmethod.latin.SubtypeSwitcher; import com.android.inputmethod.latin.SubtypeSwitcher;
import com.android.inputmethod.latin.XmlParseUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.InputTypeUtils;
import com.android.inputmethod.latin.utils.ResourceUtils;
import com.android.inputmethod.latin.utils.XmlParseUtils;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;

View File

@ -32,11 +32,11 @@ import android.view.View;
import com.android.inputmethod.keyboard.internal.KeyDrawParams; import com.android.inputmethod.keyboard.internal.KeyDrawParams;
import com.android.inputmethod.keyboard.internal.KeyVisualAttributes; import com.android.inputmethod.keyboard.internal.KeyVisualAttributes;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.research.ResearchLogger; import com.android.inputmethod.research.ResearchLogger;
import java.util.HashSet; import java.util.HashSet;

View File

@ -58,21 +58,21 @@ import com.android.inputmethod.keyboard.internal.PreviewPlacerView;
import com.android.inputmethod.keyboard.internal.SlidingKeyInputPreview; import com.android.inputmethod.keyboard.internal.SlidingKeyInputPreview;
import com.android.inputmethod.keyboard.internal.TouchScreenRegulator; import com.android.inputmethod.keyboard.internal.TouchScreenRegulator;
import com.android.inputmethod.latin.AudioAndHapticFeedbackManager; import com.android.inputmethod.latin.AudioAndHapticFeedbackManager;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.CoordinateUtils;
import com.android.inputmethod.latin.DebugSettings; import com.android.inputmethod.latin.DebugSettings;
import com.android.inputmethod.latin.LatinIME; import com.android.inputmethod.latin.LatinIME;
import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResourceUtils;
import com.android.inputmethod.latin.Settings; import com.android.inputmethod.latin.Settings;
import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
import com.android.inputmethod.latin.StringUtils;
import com.android.inputmethod.latin.SubtypeLocale; import com.android.inputmethod.latin.SubtypeLocale;
import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.Utils.UsabilityStudyLogUtils;
import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.CoordinateUtils;
import com.android.inputmethod.latin.utils.ResourceUtils;
import com.android.inputmethod.latin.utils.StaticInnerHandlerWrapper;
import com.android.inputmethod.latin.utils.StringUtils;
import com.android.inputmethod.latin.utils.Utils.UsabilityStudyLogUtils;
import com.android.inputmethod.research.ResearchLogger; import com.android.inputmethod.research.ResearchLogger;
import java.util.Locale; import java.util.Locale;

View File

@ -28,7 +28,7 @@ import com.android.inputmethod.keyboard.internal.KeyboardIconsSet;
import com.android.inputmethod.keyboard.internal.KeyboardParams; import com.android.inputmethod.keyboard.internal.KeyboardParams;
import com.android.inputmethod.keyboard.internal.MoreKeySpec; import com.android.inputmethod.keyboard.internal.MoreKeySpec;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.StringUtils; import com.android.inputmethod.latin.utils.StringUtils;
public final class MoreKeysKeyboard extends Keyboard { public final class MoreKeysKeyboard extends Keyboard {
private final int mDefaultKeyCoordX; private final int mDefaultKeyCoordX;

View File

@ -23,8 +23,8 @@ import android.view.MotionEvent;
import android.view.View; import android.view.View;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.CoordinateUtils;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.CoordinateUtils;
/** /**
* A view that renders a virtual {@link MoreKeysKeyboard}. It handles rendering of keys and * A view that renders a virtual {@link MoreKeysKeyboard}. It handles rendering of keys and

View File

@ -27,13 +27,13 @@ import com.android.inputmethod.keyboard.internal.GestureStroke.GestureStrokePara
import com.android.inputmethod.keyboard.internal.GestureStrokeWithPreviewPoints; import com.android.inputmethod.keyboard.internal.GestureStrokeWithPreviewPoints;
import com.android.inputmethod.keyboard.internal.GestureStrokeWithPreviewPoints.GestureStrokePreviewParams; import com.android.inputmethod.keyboard.internal.GestureStrokeWithPreviewPoints.GestureStrokePreviewParams;
import com.android.inputmethod.keyboard.internal.PointerTrackerQueue; import com.android.inputmethod.keyboard.internal.PointerTrackerQueue;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.CoordinateUtils;
import com.android.inputmethod.latin.InputPointers; import com.android.inputmethod.latin.InputPointers;
import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.CoordinateUtils;
import com.android.inputmethod.research.ResearchLogger; import com.android.inputmethod.research.ResearchLogger;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -22,7 +22,7 @@ import android.util.Log;
import com.android.inputmethod.keyboard.internal.TouchPositionCorrection; import com.android.inputmethod.keyboard.internal.TouchPositionCorrection;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.JniUtils; import com.android.inputmethod.latin.utils.JniUtils;
import java.util.Arrays; import java.util.Arrays;

View File

@ -21,7 +21,7 @@ import android.graphics.Rect;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.util.SparseArray; import android.util.SparseArray;
import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
public final class TypefaceUtils { public final class TypefaceUtils {
private TypefaceUtils() { private TypefaceUtils() {

View File

@ -26,9 +26,9 @@ import android.text.TextUtils;
import android.view.View; import android.view.View;
import com.android.inputmethod.keyboard.PointerTracker; import com.android.inputmethod.keyboard.PointerTracker;
import com.android.inputmethod.latin.CoordinateUtils;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.utils.CoordinateUtils;
/** /**
* The class for single gesture preview text. The class for multiple gesture preview text will be * The class for single gesture preview text. The class for multiple gesture preview text will be

View File

@ -21,8 +21,8 @@ import android.util.Log;
import com.android.inputmethod.latin.InputPointers; import com.android.inputmethod.latin.InputPointers;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResizableIntArray; import com.android.inputmethod.latin.utils.ResizableIntArray;
import com.android.inputmethod.latin.ResourceUtils; import com.android.inputmethod.latin.utils.ResourceUtils;
public class GestureStroke { public class GestureStroke {
private static final String TAG = GestureStroke.class.getSimpleName(); private static final String TAG = GestureStroke.class.getSimpleName();

View File

@ -19,7 +19,7 @@ package com.android.inputmethod.keyboard.internal;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResizableIntArray; import com.android.inputmethod.latin.utils.ResizableIntArray;
public final class GestureStrokeWithPreviewPoints extends GestureStroke { public final class GestureStrokeWithPreviewPoints extends GestureStroke {
public static final int PREVIEW_CAPACITY = 256; public static final int PREVIEW_CAPACITY = 256;

View File

@ -26,7 +26,7 @@ import android.os.SystemClock;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResizableIntArray; import com.android.inputmethod.latin.utils.ResizableIntArray;
/* /*
* @attr ref R.styleable#MainKeyboardView_gestureTrailFadeoutStartDelay * @attr ref R.styleable#MainKeyboardView_gestureTrailFadeoutStartDelay

View File

@ -30,8 +30,8 @@ import android.view.View;
import com.android.inputmethod.keyboard.PointerTracker; import com.android.inputmethod.keyboard.PointerTracker;
import com.android.inputmethod.keyboard.internal.GestureTrail.Params; import com.android.inputmethod.keyboard.internal.GestureTrail.Params;
import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.StaticInnerHandlerWrapper; import com.android.inputmethod.latin.utils.StaticInnerHandlerWrapper;
/** /**
* Draw gesture trail preview graphics during gesture. * Draw gesture trail preview graphics during gesture.

View File

@ -18,7 +18,7 @@ package com.android.inputmethod.keyboard.internal;
import android.graphics.Typeface; import android.graphics.Typeface;
import com.android.inputmethod.latin.ResourceUtils; import com.android.inputmethod.latin.utils.ResourceUtils;
public final class KeyDrawParams { public final class KeyDrawParams {
public Typeface mTypeface; public Typeface mTypeface;

View File

@ -21,10 +21,10 @@ import static com.android.inputmethod.latin.Constants.CODE_UNSPECIFIED;
import android.text.TextUtils; import android.text.TextUtils;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.StringUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -20,9 +20,9 @@ import android.content.res.TypedArray;
import android.util.Log; import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.XmlParseUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.XmlParseUtils;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;

View File

@ -21,7 +21,7 @@ import android.graphics.Typeface;
import android.util.SparseIntArray; import android.util.SparseIntArray;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResourceUtils; import com.android.inputmethod.latin.utils.ResourceUtils;
public final class KeyVisualAttributes { public final class KeyVisualAttributes {
public final Typeface mTypeface; public final Typeface mTypeface;

View File

@ -29,12 +29,12 @@ import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.keyboard.KeyboardId; import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.latin.LocaleUtils.RunInLocale;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResourceUtils;
import com.android.inputmethod.latin.StringUtils;
import com.android.inputmethod.latin.SubtypeLocale; import com.android.inputmethod.latin.SubtypeLocale;
import com.android.inputmethod.latin.XmlParseUtils; import com.android.inputmethod.latin.utils.LocaleUtils.RunInLocale;
import com.android.inputmethod.latin.utils.ResourceUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import com.android.inputmethod.latin.utils.XmlParseUtils;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;

View File

@ -16,8 +16,8 @@
package com.android.inputmethod.keyboard.internal; package com.android.inputmethod.keyboard.internal;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.HashMap; import java.util.HashMap;

View File

@ -22,8 +22,8 @@ import android.graphics.drawable.Drawable;
import android.util.Log; import android.util.Log;
import android.util.SparseIntArray; import android.util.SparseIntArray;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.HashMap; import java.util.HashMap;

View File

@ -20,8 +20,8 @@ import android.util.SparseIntArray;
import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.KeyboardId; import com.android.inputmethod.keyboard.KeyboardId;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.TreeSet; import java.util.TreeSet;

View File

@ -23,7 +23,7 @@ import android.util.Xml;
import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResourceUtils; import com.android.inputmethod.latin.utils.ResourceUtils;
import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser;

View File

@ -20,7 +20,7 @@ import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.RecapitalizeStatus; import com.android.inputmethod.latin.utils.RecapitalizeStatus;
/** /**
* Keyboard state machine. * Keyboard state machine.

View File

@ -20,7 +20,7 @@ import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.HashMap; import java.util.HashMap;

View File

@ -17,7 +17,7 @@
package com.android.inputmethod.keyboard.internal; package com.android.inputmethod.keyboard.internal;
import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.HashMap; import java.util.HashMap;

View File

@ -19,7 +19,7 @@ package com.android.inputmethod.keyboard.internal;
import android.text.TextUtils; import android.text.TextUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.StringUtils; import com.android.inputmethod.latin.utils.StringUtils;
import java.util.Locale; import java.util.Locale;

View File

@ -18,7 +18,7 @@ package com.android.inputmethod.keyboard.internal;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -24,8 +24,8 @@ import android.graphics.PorterDuffXfermode;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.CoordinateUtils; import com.android.inputmethod.latin.utils.CoordinateUtils;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -23,8 +23,8 @@ import android.graphics.Path;
import android.view.View; import android.view.View;
import com.android.inputmethod.keyboard.PointerTracker; import com.android.inputmethod.keyboard.PointerTracker;
import com.android.inputmethod.latin.CoordinateUtils;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.CoordinateUtils;
/** /**
* Draw rubber band preview graphics during sliding key input. * Draw rubber band preview graphics during sliding key input.

View File

@ -23,8 +23,8 @@ import android.view.MotionEvent;
import com.android.inputmethod.keyboard.MainKeyboardView; import com.android.inputmethod.keyboard.MainKeyboardView;
import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResourceUtils;
import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.utils.ResourceUtils;
import com.android.inputmethod.research.ResearchLogger; import com.android.inputmethod.research.ResearchLogger;
public final class TouchScreenRegulator { public final class TouchScreenRegulator {

View File

@ -25,6 +25,9 @@ import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
public final class AdditionalSubtype { public final class AdditionalSubtype {

View File

@ -44,6 +44,9 @@ import android.widget.Spinner;
import android.widget.SpinnerAdapter; import android.widget.SpinnerAdapter;
import android.widget.Toast; import android.widget.Toast;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.IntentUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.TreeSet; import java.util.TreeSet;

View File

@ -21,6 +21,10 @@ import android.util.SparseArray;
import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.keyboard.ProximityInfo;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.utils.AdditionalFeaturesSettingUtils;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.JniUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -28,7 +28,10 @@ import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.dictionarypack.DictionaryPackConstants; import com.android.inputmethod.dictionarypack.DictionaryPackConstants;
import com.android.inputmethod.latin.DictionaryInfoUtils.DictionaryInfo; import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.DictionaryInfoUtils;
import com.android.inputmethod.latin.utils.DictionaryInfoUtils.DictionaryInfo;
import com.android.inputmethod.latin.utils.MetadataFileUriGetter;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;

View File

@ -16,10 +16,6 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.makedict.BinaryDictInputOutput;
import com.android.inputmethod.latin.makedict.FormatSpec;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
@ -27,6 +23,13 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.AssetFileDescriptor; import android.content.res.AssetFileDescriptor;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.makedict.BinaryDictInputOutput;
import com.android.inputmethod.latin.makedict.FormatSpec;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.DictionaryInfoUtils;
import com.android.inputmethod.latin.utils.LocaleUtils;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
@ -39,7 +42,7 @@ import java.util.Locale;
/** /**
* Helper class to get the address of a mmap'able dictionary file. * Helper class to get the address of a mmap'able dictionary file.
*/ */
final class BinaryDictionaryGetter { final public class BinaryDictionaryGetter {
/** /**
* Used for Log actions from this class * Used for Log actions from this class

View File

@ -30,6 +30,8 @@ import android.provider.ContactsContract.Contacts;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.latin.utils.StringUtils;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;

View File

@ -29,6 +29,7 @@ import android.preference.PreferenceScreen;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.keyboard.KeyboardSwitcher; import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.latin.utils.Utils;
import com.android.inputmethod.research.ResearchLogger; import com.android.inputmethod.research.ResearchLogger;
public final class DebugSettings extends PreferenceFragment public final class DebugSettings extends PreferenceFragment

View File

@ -16,6 +16,8 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import com.android.inputmethod.latin.utils.JniUtils;
import java.util.Locale; import java.util.Locale;
public final class DicTraverseSession { public final class DicTraverseSession {

View File

@ -16,10 +16,11 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import android.util.Log;
import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.keyboard.ProximityInfo;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.utils.CollectionUtils;
import android.util.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;

View File

@ -22,6 +22,8 @@ import android.content.res.Resources;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.DictionaryInfoUtils;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -17,6 +17,7 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import com.android.inputmethod.dictionarypack.DictionaryPackConstants; import com.android.inputmethod.dictionarypack.DictionaryPackConstants;
import com.android.inputmethod.latin.utils.TargetPackageInfoGetterTask;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;

View File

@ -28,6 +28,7 @@ import com.android.inputmethod.latin.makedict.FusionDictionary;
import com.android.inputmethod.latin.makedict.FusionDictionary.Node; import com.android.inputmethod.latin.makedict.FusionDictionary.Node;
import com.android.inputmethod.latin.makedict.FusionDictionary.WeightedString; import com.android.inputmethod.latin.makedict.FusionDictionary.WeightedString;
import com.android.inputmethod.latin.makedict.UnsupportedFormatException; import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
import com.android.inputmethod.latin.utils.CollectionUtils;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;

View File

@ -22,7 +22,8 @@ import android.util.Log;
import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.keyboard.ProximityInfo;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.UserHistoryForgettingCurveUtils.ForgettingCurveParams; import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.UserHistoryForgettingCurveUtils.ForgettingCurveParams;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;

View File

@ -23,6 +23,9 @@ import android.content.DialogInterface.OnClickListener;
import android.os.Environment; import android.os.Environment;
import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.DictionaryInfoUtils;
import com.android.inputmethod.latin.utils.LocaleUtils;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;

View File

@ -20,6 +20,9 @@ import android.text.InputType;
import android.util.Log; import android.util.Log;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import com.android.inputmethod.latin.utils.InputTypeUtils;
import com.android.inputmethod.latin.utils.StringUtils;
/** /**
* Class to hold attributes of the input field. * Class to hold attributes of the input field.
*/ */

View File

@ -17,6 +17,7 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.latin.utils.ResizableIntArray;
import android.util.Log; import android.util.Log;

View File

@ -16,6 +16,8 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import com.android.inputmethod.latin.utils.StringUtils;
import android.text.TextUtils; import android.text.TextUtils;
/** /**

View File

@ -76,9 +76,19 @@ import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.MainKeyboardView; import com.android.inputmethod.keyboard.MainKeyboardView;
import com.android.inputmethod.latin.RichInputConnection.Range; import com.android.inputmethod.latin.RichInputConnection.Range;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.Utils.Stats;
import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.suggestions.SuggestionStripView; import com.android.inputmethod.latin.suggestions.SuggestionStripView;
import com.android.inputmethod.latin.utils.CapsModeUtils;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.CompletionInfoUtils;
import com.android.inputmethod.latin.utils.InputTypeUtils;
import com.android.inputmethod.latin.utils.IntentUtils;
import com.android.inputmethod.latin.utils.PositionalInfoForUserDictPendingAddition;
import com.android.inputmethod.latin.utils.RecapitalizeStatus;
import com.android.inputmethod.latin.utils.StaticInnerHandlerWrapper;
import com.android.inputmethod.latin.utils.TargetPackageInfoGetterTask;
import com.android.inputmethod.latin.utils.Utils;
import com.android.inputmethod.latin.utils.Utils.Stats;
import com.android.inputmethod.research.ResearchLogger; import com.android.inputmethod.research.ResearchLogger;
import java.io.FileDescriptor; import java.io.FileDescriptor;

View File

@ -16,6 +16,8 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import com.android.inputmethod.latin.utils.AdditionalFeaturesSettingUtils;
public class NativeSuggestOptions { public class NativeSuggestOptions {
// Need to update suggest_options.h when you add, remove or reorder options. // Need to update suggest_options.h when you add, remove or reorder options.
private static final int IS_GESTURE = 0; private static final int IS_GESTURE = 0;

View File

@ -27,6 +27,9 @@ import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputConnection;
import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.utils.CapsModeUtils;
import com.android.inputmethod.latin.utils.LogUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import com.android.inputmethod.research.ResearchLogger; import com.android.inputmethod.research.ResearchLogger;
import java.util.Locale; import java.util.Locale;
@ -104,7 +107,7 @@ public final class RichInputConnection {
+ "\nActual text = " + reference.length() + " " + reference; + "\nActual text = " + reference.length() + " " + reference;
((LatinIME)mParent).debugDumpStateAndCrashWithException(context); ((LatinIME)mParent).debugDumpStateAndCrashWithException(context);
} else { } else {
Log.e(TAG, Utils.getStackTrace(2)); Log.e(TAG, LogUtils.getStackTrace(2));
Log.e(TAG, "Exp <> Actual : " + mCurrentCursorPosition + " <> " + et.selectionStart); Log.e(TAG, "Exp <> Actual : " + mCurrentCursorPosition + " <> " + et.selectionStart);
} }
} }
@ -153,7 +156,7 @@ public final class RichInputConnection {
if (mNestLevel != 1) { if (mNestLevel != 1) {
// TODO: exception instead // TODO: exception instead
Log.e(TAG, "Batch edit level incorrect : " + mNestLevel); Log.e(TAG, "Batch edit level incorrect : " + mNestLevel);
Log.e(TAG, Utils.getStackTrace(4)); Log.e(TAG, LogUtils.getStackTrace(4));
} }
} }

View File

@ -28,6 +28,7 @@ import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.compat.InputMethodManagerCompatWrapper; import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;

View File

@ -23,7 +23,9 @@ import android.content.res.Resources;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.latin.LocaleUtils.RunInLocale; import com.android.inputmethod.latin.utils.LocaleUtils;
import com.android.inputmethod.latin.utils.LocaleUtils.RunInLocale;
import com.android.inputmethod.latin.utils.ResourceUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;

View File

@ -35,16 +35,19 @@ import android.preference.PreferenceScreen;
import android.util.Log; import android.util.Log;
import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype;
import java.util.TreeSet;
import com.android.inputmethod.dictionarypack.DictionarySettingsActivity; import com.android.inputmethod.dictionarypack.DictionarySettingsActivity;
import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.setup.LauncherIconVisibilityManager; import com.android.inputmethod.latin.setup.LauncherIconVisibilityManager;
import com.android.inputmethod.latin.userdictionary.UserDictionaryList; import com.android.inputmethod.latin.userdictionary.UserDictionaryList;
import com.android.inputmethod.latin.userdictionary.UserDictionarySettings; import com.android.inputmethod.latin.userdictionary.UserDictionarySettings;
import com.android.inputmethod.latin.utils.AdditionalFeaturesSettingUtils;
import com.android.inputmethod.latin.utils.FeedbackUtils;
import com.android.inputmethod.latin.utils.Utils;
import com.android.inputmethod.research.ResearchLogger; import com.android.inputmethod.research.ResearchLogger;
import com.android.inputmethodcommon.InputMethodSettingsFragment; import com.android.inputmethodcommon.InputMethodSettingsFragment;
import java.util.TreeSet;
public final class SettingsFragment extends InputMethodSettingsFragment public final class SettingsFragment extends InputMethodSettingsFragment
implements SharedPreferences.OnSharedPreferenceChangeListener { implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = SettingsFragment.class.getSimpleName(); private static final String TAG = SettingsFragment.class.getSimpleName();

View File

@ -24,6 +24,10 @@ import android.view.inputmethod.EditorInfo;
import com.android.inputmethod.keyboard.internal.KeySpecParser; import com.android.inputmethod.keyboard.internal.KeySpecParser;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.utils.AdditionalFeaturesSettingUtils;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.InputTypeUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -25,7 +25,11 @@ import android.os.Build;
import android.util.Log; import android.util.Log;
import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.latin.LocaleUtils.RunInLocale; import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.LocaleUtils;
import com.android.inputmethod.latin.utils.LocaleUtils.RunInLocale;
import com.android.inputmethod.latin.utils.LogUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
@ -238,7 +242,7 @@ public final class SubtypeLocale {
+ " nameResId=" + subtype.getNameResId() + " nameResId=" + subtype.getNameResId()
+ " locale=" + subtype.getLocale() + " locale=" + subtype.getLocale()
+ " extra=" + subtype.getExtraValue() + " extra=" + subtype.getExtraValue()
+ "\n" + Utils.getStackTrace()); + "\n" + LogUtils.getStackTrace());
return ""; return "";
} }
} }

View File

@ -22,6 +22,9 @@ import android.text.TextUtils;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.keyboard.ProximityInfo;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.utils.BoundedTreeSet;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;

View File

@ -19,6 +19,9 @@ package com.android.inputmethod.latin;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.CompletionInfo;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;

View File

@ -28,6 +28,7 @@ import android.provider.UserDictionary.Words;
import android.text.TextUtils; import android.text.TextUtils;
import com.android.inputmethod.compat.UserDictionaryCompatUtils; import com.android.inputmethod.compat.UserDictionaryCompatUtils;
import com.android.inputmethod.latin.utils.LocaleUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale; import java.util.Locale;

View File

@ -24,10 +24,13 @@ import android.util.Log;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.keyboard.ProximityInfo;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.UserHistoryDictIOUtils.BigramDictionaryInterface;
import com.android.inputmethod.latin.UserHistoryDictIOUtils.OnAddWordListener;
import com.android.inputmethod.latin.UserHistoryForgettingCurveUtils.ForgettingCurveParams;
import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions; import com.android.inputmethod.latin.makedict.FormatSpec.FormatOptions;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils;
import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils.BigramDictionaryInterface;
import com.android.inputmethod.latin.utils.UserHistoryDictIOUtils.OnAddWordListener;
import com.android.inputmethod.latin.utils.UserHistoryForgettingCurveUtils;
import com.android.inputmethod.latin.utils.UserHistoryForgettingCurveUtils.ForgettingCurveParams;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;

View File

@ -19,6 +19,7 @@ package com.android.inputmethod.latin;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Set; import java.util.Set;

View File

@ -35,10 +35,10 @@ import android.widget.VideoView;
import com.android.inputmethod.compat.TextViewCompatUtils; import com.android.inputmethod.compat.TextViewCompatUtils;
import com.android.inputmethod.compat.ViewCompatUtils; import com.android.inputmethod.compat.ViewCompatUtils;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SettingsActivity; import com.android.inputmethod.latin.SettingsActivity;
import com.android.inputmethod.latin.StaticInnerHandlerWrapper; import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.StaticInnerHandlerWrapper;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -25,17 +25,17 @@ import android.view.textservice.SuggestionsInfo;
import com.android.inputmethod.keyboard.KeyboardLayoutSet; import com.android.inputmethod.keyboard.KeyboardLayoutSet;
import com.android.inputmethod.latin.BinaryDictionary; import com.android.inputmethod.latin.BinaryDictionary;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.ContactsBinaryDictionary; import com.android.inputmethod.latin.ContactsBinaryDictionary;
import com.android.inputmethod.latin.Dictionary; import com.android.inputmethod.latin.Dictionary;
import com.android.inputmethod.latin.DictionaryCollection; import com.android.inputmethod.latin.DictionaryCollection;
import com.android.inputmethod.latin.DictionaryFactory; import com.android.inputmethod.latin.DictionaryFactory;
import com.android.inputmethod.latin.LocaleUtils;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.StringUtils;
import com.android.inputmethod.latin.SynchronouslyLoadedContactsBinaryDictionary; import com.android.inputmethod.latin.SynchronouslyLoadedContactsBinaryDictionary;
import com.android.inputmethod.latin.SynchronouslyLoadedUserBinaryDictionary; import com.android.inputmethod.latin.SynchronouslyLoadedUserBinaryDictionary;
import com.android.inputmethod.latin.UserBinaryDictionary; import com.android.inputmethod.latin.UserBinaryDictionary;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.latin.utils.LocaleUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -23,7 +23,7 @@ import android.view.textservice.SentenceSuggestionsInfo;
import android.view.textservice.SuggestionsInfo; import android.view.textservice.SuggestionsInfo;
import android.view.textservice.TextInfo; import android.view.textservice.TextInfo;
import com.android.inputmethod.latin.CollectionUtils; import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -30,11 +30,11 @@ import android.view.textservice.TextInfo;
import com.android.inputmethod.compat.SuggestionsInfoCompatUtils; import com.android.inputmethod.compat.SuggestionsInfoCompatUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.Dictionary; import com.android.inputmethod.latin.Dictionary;
import com.android.inputmethod.latin.LocaleUtils;
import com.android.inputmethod.latin.StringUtils;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.WordComposer; import com.android.inputmethod.latin.WordComposer;
import com.android.inputmethod.latin.spellcheck.AndroidSpellCheckerService.SuggestionsGatherer; import com.android.inputmethod.latin.spellcheck.AndroidSpellCheckerService.SuggestionsGatherer;
import com.android.inputmethod.latin.utils.LocaleUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;

View File

@ -19,10 +19,10 @@ package com.android.inputmethod.latin.spellcheck;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.keyboard.ProximityInfo; import com.android.inputmethod.keyboard.ProximityInfo;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Dictionary; import com.android.inputmethod.latin.Dictionary;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.WordComposer; import com.android.inputmethod.latin.WordComposer;
import com.android.inputmethod.latin.utils.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;

View File

@ -21,7 +21,7 @@ import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.Utils; import com.android.inputmethod.latin.utils.Utils;
/** /**
* Preference screen. * Preference screen.

View File

@ -31,7 +31,7 @@ import com.android.inputmethod.keyboard.internal.KeyboardParams;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.Utils; import com.android.inputmethod.latin.utils.Utils;
public final class MoreSuggestions extends Keyboard { public final class MoreSuggestions extends Keyboard {
public static final int SUGGESTION_CODE_BASE = 1024; public static final int SUGGESTION_CODE_BASE = 1024;

View File

@ -49,9 +49,9 @@ import com.android.inputmethod.keyboard.ViewLayoutUtils;
import com.android.inputmethod.latin.AutoCorrection; import com.android.inputmethod.latin.AutoCorrection;
import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.ResourceUtils;
import com.android.inputmethod.latin.SuggestedWords; import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.Utils; import com.android.inputmethod.latin.utils.ResourceUtils;
import com.android.inputmethod.latin.utils.Utils;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -34,7 +34,6 @@ import com.android.inputmethod.keyboard.KeyboardSwitcher;
import com.android.inputmethod.keyboard.MainKeyboardView; import com.android.inputmethod.keyboard.MainKeyboardView;
import com.android.inputmethod.keyboard.MoreKeysPanel; import com.android.inputmethod.keyboard.MoreKeysPanel;
import com.android.inputmethod.latin.AudioAndHapticFeedbackManager; import com.android.inputmethod.latin.AudioAndHapticFeedbackManager;
import com.android.inputmethod.latin.CollectionUtils;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.LatinImeLogger; import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.R;
@ -42,6 +41,7 @@ import com.android.inputmethod.latin.SuggestedWords;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;
import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.define.ProductionFlag;
import com.android.inputmethod.latin.suggestions.MoreSuggestions.MoreSuggestionsListener; import com.android.inputmethod.latin.suggestions.MoreSuggestions.MoreSuggestionsListener;
import com.android.inputmethod.latin.utils.CollectionUtils;
import com.android.inputmethod.research.ResearchLogger; import com.android.inputmethod.research.ResearchLogger;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -16,10 +16,6 @@
package com.android.inputmethod.latin.userdictionary; package com.android.inputmethod.latin.userdictionary;
import com.android.inputmethod.compat.UserDictionaryCompatUtils;
import com.android.inputmethod.latin.LocaleUtils;
import com.android.inputmethod.latin.R;
import android.app.Activity; import android.app.Activity;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
@ -30,6 +26,10 @@ import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import com.android.inputmethod.compat.UserDictionaryCompatUtils;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.LocaleUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale; import java.util.Locale;
import java.util.TreeSet; import java.util.TreeSet;

View File

@ -16,9 +16,6 @@
package com.android.inputmethod.latin.userdictionary; package com.android.inputmethod.latin.userdictionary;
import com.android.inputmethod.latin.LocaleUtils;
import com.android.inputmethod.latin.R;
import android.app.Activity; import android.app.Activity;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
@ -29,6 +26,9 @@ import android.preference.PreferenceGroup;
import android.provider.UserDictionary; import android.provider.UserDictionary;
import android.text.TextUtils; import android.text.TextUtils;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.LocaleUtils;
import java.util.Locale; import java.util.Locale;
import java.util.TreeSet; import java.util.TreeSet;

View File

@ -14,13 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import com.android.inputmethodcommon.InputMethodSettingsFragment;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import com.android.inputmethod.latin.Settings;
import com.android.inputmethodcommon.InputMethodSettingsFragment;
/** /**
* Utility class for managing additional features settings. * Utility class for managing additional features settings.
*/ */

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo;

View File

@ -14,11 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import android.text.InputType; import android.text.InputType;
import android.text.TextUtils; import android.text.TextUtils;
import com.android.inputmethod.latin.Constants;
import com.android.inputmethod.latin.WordComposer;
import java.util.Locale; import java.util.Locale;
public final class CapsModeUtils { public final class CapsModeUtils {

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import android.util.SparseArray; import android.util.SparseArray;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.inputmethod.CompletionInfo; import android.view.inputmethod.CompletionInfo;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
public final class CoordinateUtils { public final class CoordinateUtils {
private static final int INDEX_X = 0; private static final int INDEX_X = 0;

View File

@ -17,7 +17,6 @@
package com.android.inputmethod.latin.utils; package com.android.inputmethod.latin.utils;
import com.android.inputmethod.annotations.UsedForTesting; import com.android.inputmethod.annotations.UsedForTesting;
import com.android.inputmethod.latin.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.Context; import android.content.Context;
@ -23,6 +23,9 @@ import android.content.res.Resources;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.latin.AssetFileAddress;
import com.android.inputmethod.latin.BinaryDictionaryGetter;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.makedict.BinaryDictIOUtils; import com.android.inputmethod.latin.makedict.BinaryDictIOUtils;
import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader; import com.android.inputmethod.latin.makedict.FormatSpec.FileHeader;
import com.android.inputmethod.latin.makedict.UnsupportedFormatException; import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
@ -38,9 +41,7 @@ import java.util.Locale;
*/ */
public class DictionaryInfoUtils { public class DictionaryInfoUtils {
private static final String TAG = DictionaryInfoUtils.class.getSimpleName(); private static final String TAG = DictionaryInfoUtils.class.getSimpleName();
// This class must be located in the same package as LatinIME.java. private static final String RESOURCE_PACKAGE_NAME = R.class.getPackage().getName();
private static final String RESOURCE_PACKAGE_NAME =
DictionaryInfoUtils.class.getPackage().getName();
private static final String DEFAULT_MAIN_DICT = "main"; private static final String DEFAULT_MAIN_DICT = "main";
private static final String MAIN_DICT_PREFIX = "main_"; private static final String MAIN_DICT_PREFIX = "main_";
// 6 digits - unicode is limited to 21 bits // 6 digits - unicode is limited to 21 bits

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import android.text.InputType; import android.text.InputType;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import android.content.Intent; import android.content.Intent;
import android.text.TextUtils; import android.text.TextUtils;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import android.util.Log; import android.util.Log;

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
@ -166,6 +166,7 @@ public final class LocaleUtils {
static final Object sLockForRunInLocale = new Object(); static final Object sLockForRunInLocale = new Object();
// TODO: Make this an external class
public abstract static class RunInLocale<T> { public abstract static class RunInLocale<T> {
protected abstract T job(Resources res); protected abstract T job(Resources res);

View File

@ -14,16 +14,18 @@
* the License. * the License.
*/ */
package com.android.inputmethod.dictionarypack; package com.android.inputmethod.latin.utils;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.latin.LatinImeLogger;
/** /**
* A class for various utility methods, especially debugging. * A class for logging and debugging utility methods.
*/ */
public final class Utils { public final class LogUtils {
private final static String TAG = Utils.class.getSimpleName() + ":DEBUG --"; private final static String TAG = LogUtils.class.getSimpleName();
private final static boolean DEBUG = DictionaryProvider.DEBUG; private final static boolean sDBG = LatinImeLogger.sDBG;
/** /**
* Calls .toString() on its non-null argument or returns "null" * Calls .toString() on its non-null argument or returns "null"
@ -39,13 +41,22 @@ public final class Utils {
* @return a readable, carriage-return-separated string for the current stack trace. * @return a readable, carriage-return-separated string for the current stack trace.
*/ */
public static String getStackTrace() { public static String getStackTrace() {
return getStackTrace(Integer.MAX_VALUE - 1);
}
/**
* Get the string representation of the current stack trace, for debugging purposes.
* @param limit the maximum number of stack frames to be returned.
* @return a readable, carriage-return-separated string for the current stack trace.
*/
public static String getStackTrace(final int limit) {
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
try { try {
throw new RuntimeException(); throw new RuntimeException();
} catch (RuntimeException e) { } catch (final RuntimeException e) {
StackTraceElement[] frames = e.getStackTrace(); final StackTraceElement[] frames = e.getStackTrace();
// Start at 1 because the first frame is here and we don't care about it // Start at 1 because the first frame is here and we don't care about it
for (int j = 1; j < frames.length; ++j) { for (int j = 1; j < frames.length && j < limit + 1; ++j) {
sb.append(frames[j].toString() + "\n"); sb.append(frames[j].toString() + "\n");
} }
} }
@ -75,7 +86,7 @@ public final class Utils {
* @param args the stuff to send to the log * @param args the stuff to send to the log
*/ */
public static void l(final Object... args) { public static void l(final Object... args) {
if (!DEBUG) return; if (!sDBG) return;
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
for (final Object o : args) { for (final Object o : args) {
sb.append(s(o).toString()); sb.append(s(o).toString());
@ -92,7 +103,7 @@ public final class Utils {
* @param args the stuff to send to the log * @param args the stuff to send to the log
*/ */
public static void r(final Object... args) { public static void r(final Object... args) {
if (!DEBUG) return; if (!sDBG) return;
final StringBuilder sb = new StringBuilder("\u001B[31m"); final StringBuilder sb = new StringBuilder("\u001B[31m");
for (final Object o : args) { for (final Object o : args) {
sb.append(s(o).toString()); sb.append(s(o).toString());

View File

@ -14,7 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import com.android.inputmethod.latin.R;
import android.content.Context; import android.content.Context;

View File

@ -14,10 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.inputmethod.latin; package com.android.inputmethod.latin.utils;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import com.android.inputmethod.latin.RichInputConnection;
import java.util.Locale; import java.util.Locale;
/** /**

Some files were not shown because too many files have changed in this diff Show More