Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12ef7d37 authored by Ken Wakasa's avatar Ken Wakasa Committed by Android (Google) Code Review
Browse files

Merge "Cleanup under the utils package"

parents 81c5c3ce 03118a27
Loading
Loading
Loading
Loading
+24 −24
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ import android.util.Log;

import com.android.inputmethod.compat.DownloadManagerCompatUtils;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.LogUtils;
import com.android.inputmethod.latin.utils.DebugLogUtils;
import com.android.inputmethod.latin.utils.Utils;

import java.util.LinkedList;
@@ -100,7 +100,7 @@ public final class ActionBatch {
        final boolean mForceStartNow;
        public StartDownloadAction(final String clientId,
                final WordListMetadata wordList, final boolean forceStartNow) {
            LogUtils.l("New download action for client ", clientId, " : ", wordList);
            DebugLogUtils.l("New download action for client ", clientId, " : ", wordList);
            mClientId = clientId;
            mWordList = wordList;
            mForceStartNow = forceStartNow;
@@ -112,7 +112,7 @@ public final class ActionBatch {
                Log.e(TAG, "UpdateAction with a null parameter!");
                return;
            }
            LogUtils.l("Downloading word list");
            DebugLogUtils.l("Downloading word list");
            final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
            final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db,
                    mWordList.mId, mWordList.mVersion);
@@ -134,7 +134,7 @@ public final class ActionBatch {
                        + " for an upgrade action. Fall back to download.");
            }
            // Download it.
            LogUtils.l("Upgrade word list, downloading", mWordList.mRemoteFilename);
            DebugLogUtils.l("Upgrade word list, downloading", mWordList.mRemoteFilename);

            // TODO: if DownloadManager is disabled or not installed, download by ourselves
            if (null == manager) return;
@@ -180,7 +180,7 @@ public final class ActionBatch {

            final long downloadId = UpdateHandler.registerDownloadRequest(manager, request, db,
                    mWordList.mId, mWordList.mVersion);
            LogUtils.l("Starting download of", uri, "with id", downloadId);
            DebugLogUtils.l("Starting download of", uri, "with id", downloadId);
            PrivateLog.log("Starting download of " + uri + ", id : " + downloadId);
        }
    }
@@ -197,7 +197,7 @@ public final class ActionBatch {

        public InstallAfterDownloadAction(final String clientId,
                final ContentValues wordListValues) {
            LogUtils.l("New InstallAfterDownloadAction for client ", clientId, " : ",
            DebugLogUtils.l("New InstallAfterDownloadAction for client ", clientId, " : ",
                    wordListValues);
            mClientId = clientId;
            mWordListValues = wordListValues;
@@ -216,7 +216,7 @@ public final class ActionBatch {
                        + " for an InstallAfterDownload action. Bailing out.");
                return;
            }
            LogUtils.l("Setting word list as installed");
            DebugLogUtils.l("Setting word list as installed");
            final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
            MetadataDbHelper.markEntryAsFinishedDownloadingAndInstalled(db, mWordListValues);
        }
@@ -232,7 +232,7 @@ public final class ActionBatch {
        final WordListMetadata mWordList;

        public EnableAction(final String clientId, final WordListMetadata wordList) {
            LogUtils.l("New EnableAction for client ", clientId, " : ", wordList);
            DebugLogUtils.l("New EnableAction for client ", clientId, " : ", wordList);
            mClientId = clientId;
            mWordList = wordList;
        }
@@ -243,7 +243,7 @@ public final class ActionBatch {
                Log.e(TAG, "EnableAction with a null parameter!");
                return;
            }
            LogUtils.l("Enabling word list");
            DebugLogUtils.l("Enabling word list");
            final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
            final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db,
                    mWordList.mId, mWordList.mVersion);
@@ -267,7 +267,7 @@ public final class ActionBatch {
        // The word list to disable. May not be null.
        final WordListMetadata mWordList;
        public DisableAction(final String clientId, final WordListMetadata wordlist) {
            LogUtils.l("New Disable action for client ", clientId, " : ", wordlist);
            DebugLogUtils.l("New Disable action for client ", clientId, " : ", wordlist);
            mClientId = clientId;
            mWordList = wordlist;
        }
@@ -278,7 +278,7 @@ public final class ActionBatch {
                Log.e(TAG, "DisableAction with a null word list!");
                return;
            }
            LogUtils.l("Disabling word list : " + mWordList);
            DebugLogUtils.l("Disabling word list : " + mWordList);
            final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
            final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db,
                    mWordList.mId, mWordList.mVersion);
@@ -314,7 +314,7 @@ public final class ActionBatch {
        // The word list to make available. May not be null.
        final WordListMetadata mWordList;
        public MakeAvailableAction(final String clientId, final WordListMetadata wordlist) {
            LogUtils.l("New MakeAvailable action", clientId, " : ", wordlist);
            DebugLogUtils.l("New MakeAvailable action", clientId, " : ", wordlist);
            mClientId = clientId;
            mWordList = wordlist;
        }
@@ -331,7 +331,7 @@ public final class ActionBatch {
                Log.e(TAG, "Unexpected state of the word list '" + mWordList.mId + "' "
                        + " for a makeavailable action. Marking as available anyway.");
            }
            LogUtils.l("Making word list available : " + mWordList);
            DebugLogUtils.l("Making word list available : " + mWordList);
            // 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.
            final ContentValues values = MetadataDbHelper.makeContentValues(0,
@@ -363,7 +363,7 @@ public final class ActionBatch {
        // The word list to mark pre-installed. May not be null.
        final WordListMetadata mWordList;
        public MarkPreInstalledAction(final String clientId, final WordListMetadata wordlist) {
            LogUtils.l("New MarkPreInstalled action", clientId, " : ", wordlist);
            DebugLogUtils.l("New MarkPreInstalled action", clientId, " : ", wordlist);
            mClientId = clientId;
            mWordList = wordlist;
        }
@@ -380,7 +380,7 @@ public final class ActionBatch {
                Log.e(TAG, "Unexpected state of the word list '" + mWordList.mId + "' "
                        + " for a markpreinstalled action. Marking as preinstalled anyway.");
            }
            LogUtils.l("Marking word list preinstalled : " + mWordList);
            DebugLogUtils.l("Marking word list preinstalled : " + mWordList);
            // 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
            // accidentally. The remote filename may be set by the application if it so wishes.
@@ -404,7 +404,7 @@ public final class ActionBatch {
        private final String mClientId;
        final WordListMetadata mWordList;
        public UpdateDataAction(final String clientId, final WordListMetadata wordlist) {
            LogUtils.l("New UpdateData action for client ", clientId, " : ", wordlist);
            DebugLogUtils.l("New UpdateData action for client ", clientId, " : ", wordlist);
            mClientId = clientId;
            mWordList = wordlist;
        }
@@ -422,7 +422,7 @@ public final class ActionBatch {
                Log.e(TAG, "Trying to update data about a non-existing word list. Bailing out.");
                return;
            }
            LogUtils.l("Updating data about a word list : " + mWordList);
            DebugLogUtils.l("Updating data about a word list : " + mWordList);
            final ContentValues values = MetadataDbHelper.makeContentValues(
                    oldValues.getAsInteger(MetadataDbHelper.PENDINGID_COLUMN),
                    oldValues.getAsInteger(MetadataDbHelper.TYPE_COLUMN),
@@ -456,7 +456,7 @@ public final class ActionBatch {
        final boolean mHasNewerVersion;
        public ForgetAction(final String clientId, final WordListMetadata wordlist,
                final boolean hasNewerVersion) {
            LogUtils.l("New TryRemove action for client ", clientId, " : ", wordlist);
            DebugLogUtils.l("New TryRemove action for client ", clientId, " : ", wordlist);
            mClientId = clientId;
            mWordList = wordlist;
            mHasNewerVersion = hasNewerVersion;
@@ -468,7 +468,7 @@ public final class ActionBatch {
                Log.e(TAG, "TryRemoveAction with a null word list!");
                return;
            }
            LogUtils.l("Trying to remove word list : " + mWordList);
            DebugLogUtils.l("Trying to remove word list : " + mWordList);
            final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
            final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db,
                    mWordList.mId, mWordList.mVersion);
@@ -528,7 +528,7 @@ public final class ActionBatch {
        // The word list to delete. May not be null.
        final WordListMetadata mWordList;
        public StartDeleteAction(final String clientId, final WordListMetadata wordlist) {
            LogUtils.l("New StartDelete action for client ", clientId, " : ", wordlist);
            DebugLogUtils.l("New StartDelete action for client ", clientId, " : ", wordlist);
            mClientId = clientId;
            mWordList = wordlist;
        }
@@ -539,7 +539,7 @@ public final class ActionBatch {
                Log.e(TAG, "StartDeleteAction with a null word list!");
                return;
            }
            LogUtils.l("Trying to delete word list : " + mWordList);
            DebugLogUtils.l("Trying to delete word list : " + mWordList);
            final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
            final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db,
                    mWordList.mId, mWordList.mVersion);
@@ -567,7 +567,7 @@ public final class ActionBatch {
        // The word list to delete. May not be null.
        final WordListMetadata mWordList;
        public FinishDeleteAction(final String clientId, final WordListMetadata wordlist) {
            LogUtils.l("New FinishDelete action for client", clientId, " : ", wordlist);
            DebugLogUtils.l("New FinishDelete action for client", clientId, " : ", wordlist);
            mClientId = clientId;
            mWordList = wordlist;
        }
@@ -578,7 +578,7 @@ public final class ActionBatch {
                Log.e(TAG, "FinishDeleteAction with a null word list!");
                return;
            }
            LogUtils.l("Trying to delete word list : " + mWordList);
            DebugLogUtils.l("Trying to delete word list : " + mWordList);
            final SQLiteDatabase db = MetadataDbHelper.getDb(context, mClientId);
            final ContentValues values = MetadataDbHelper.getContentValuesByWordListId(db,
                    mWordList.mId, mWordList.mVersion);
@@ -635,7 +635,7 @@ public final class ActionBatch {
     * @param reporter a Reporter to send errors to.
     */
    public void execute(final Context context, final ProblemReporter reporter) {
        LogUtils.l("Executing a batch of actions");
        DebugLogUtils.l("Executing a batch of actions");
        Queue<Action> remainingActions = mActions;
        while (!remainingActions.isEmpty()) {
            final Action a = remainingActions.poll();
+3 −3
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ import android.text.TextUtils;
import android.util.Log;

import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.LogUtils;
import com.android.inputmethod.latin.utils.DebugLogUtils;

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

import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.utils.LogUtils;
import com.android.inputmethod.latin.utils.DebugLogUtils;

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

import java.io.File;
@@ -185,8 +185,8 @@ public final class UpdateHandler {
                final String clientId = cursor.getString(0);
                final String metadataUri =
                        MetadataDbHelper.getMetadataUriAsString(context, clientId);
                PrivateLog.log("Update for clientId " + LogUtils.s(clientId));
                LogUtils.l("Update for clientId", clientId, " which uses URI ", metadataUri);
                PrivateLog.log("Update for clientId " + DebugLogUtils.s(clientId));
                DebugLogUtils.l("Update for clientId", clientId, " which uses URI ", metadataUri);
                uris.add(metadataUri);
            } while (cursor.moveToNext());
        } finally {
@@ -213,14 +213,14 @@ public final class UpdateHandler {
     */
    private static void updateClientsWithMetadataUri(final Context context,
            final boolean updateNow, final String metadataUri) {
        PrivateLog.log("Update for metadata URI " + LogUtils.s(metadataUri));
        PrivateLog.log("Update for metadata URI " + DebugLogUtils.s(metadataUri));
        // 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
        // gets from the content-type. We need to circumvent this.
        final String disambiguator = "#" + System.currentTimeMillis()
                + Utils.getVersionName(context) + ".json";
        final Request metadataRequest = new Request(Uri.parse(metadataUri + disambiguator));
        LogUtils.l("Request =", metadataRequest);
        DebugLogUtils.l("Request =", metadataRequest);

        final Resources res = context.getResources();
        // By default, download over roaming is allowed and all network types are allowed too.
@@ -256,7 +256,7 @@ public final class UpdateHandler {
        final long downloadId;
        synchronized (sSharedIdProtector) {
            downloadId = manager.enqueue(metadataRequest);
            LogUtils.l("Metadata download requested with id", downloadId);
            DebugLogUtils.l("Metadata download requested with id", downloadId);
            // 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
            // overwrite the id and request it again. If the old one happens to finish
@@ -328,11 +328,11 @@ public final class UpdateHandler {
     */
    public static long registerDownloadRequest(final DownloadManager manager, final Request request,
            final SQLiteDatabase db, final String id, final int version) {
        LogUtils.l("RegisterDownloadRequest for word list id : ", id, ", version ", version);
        DebugLogUtils.l("RegisterDownloadRequest for word list id : ", id, ", version ", version);
        final long downloadId;
        synchronized (sSharedIdProtector) {
            downloadId = manager.enqueue(request);
            LogUtils.l("Download requested with id", downloadId);
            DebugLogUtils.l("Download requested with id", downloadId);
            MetadataDbHelper.markEntryAsDownloading(db, id, version, downloadId);
        }
        return downloadId;
@@ -418,7 +418,7 @@ public final class UpdateHandler {
        // Get and check the ID of the file that was downloaded
        final long fileId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, NOT_AN_ID);
        PrivateLog.log("Download finished with id " + fileId);
        LogUtils.l("DownloadFinished with id", fileId);
        DebugLogUtils.l("DownloadFinished with id", fileId);
        if (NOT_AN_ID == fileId) return; // Spurious wake-up: ignore

        final DownloadManager manager =
@@ -428,7 +428,7 @@ public final class UpdateHandler {
        final ArrayList<DownloadRecord> recordList =
                getDownloadRecordsForCompletedDownloadInfo(context, downloadInfo);
        if (null == recordList) return; // It was someone else's download.
        LogUtils.l("Received result for download ", fileId);
        DebugLogUtils.l("Received result for download ", fileId);

        // 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
@@ -505,7 +505,7 @@ public final class UpdateHandler {
    private static void publishUpdateCycleCompletedEvent(final Context context) {
        // Even if this is not successful, we have to publish the new state.
        PrivateLog.log("Publishing update cycle completed event");
        LogUtils.l("Publishing update cycle completed event");
        DebugLogUtils.l("Publishing update cycle completed event");
        for (UpdateEventListener listener : linkedCopyOfList(sUpdateEventListeners)) {
            listener.updateCycleCompleted();
        }
@@ -519,12 +519,12 @@ public final class UpdateHandler {
            // {@link handleWordList(Context,InputStream,ContentValues)}.
            // Handle the downloaded file according to its type
            if (downloadRecord.isMetadata()) {
                LogUtils.l("Data D/L'd is metadata for", downloadRecord.mClientId);
                DebugLogUtils.l("Data D/L'd is metadata for", downloadRecord.mClientId);
                // #handleMetadata() closes its InputStream argument
                handleMetadata(context, new ParcelFileDescriptor.AutoCloseInputStream(
                        manager.openDownloadedFile(fileId)), downloadRecord.mClientId);
            } else {
                LogUtils.l("Data D/L'd is a word list");
                DebugLogUtils.l("Data D/L'd is a word list");
                final int wordListStatus = downloadRecord.mAttributes.getAsInteger(
                        MetadataDbHelper.STATUS_COLUMN);
                if (MetadataDbHelper.STATUS_DOWNLOADING == wordListStatus) {
@@ -584,7 +584,7 @@ public final class UpdateHandler {
     */
    private static void handleMetadata(final Context context, final InputStream stream,
            final String clientId) throws IOException, BadFormatException {
        LogUtils.l("Entering handleMetadata");
        DebugLogUtils.l("Entering handleMetadata");
        final List<WordListMetadata> newMetadata;
        final InputStreamReader reader = new InputStreamReader(stream);
        try {
@@ -594,7 +594,7 @@ public final class UpdateHandler {
            reader.close();
        }

        LogUtils.l("Downloaded metadata :", newMetadata);
        DebugLogUtils.l("Downloaded metadata :", newMetadata);
        PrivateLog.log("Downloaded metadata\n" + newMetadata);

        final ActionBatch actions = computeUpgradeTo(context, clientId, newMetadata);
@@ -619,7 +619,7 @@ public final class UpdateHandler {
        // 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
        // automatically by DownloadManager.
        LogUtils.l("Downloaded a new word list :", downloadRecord.mAttributes.getAsString(
        DebugLogUtils.l("Downloaded a new word list :", downloadRecord.mAttributes.getAsString(
                MetadataDbHelper.DESCRIPTION_COLUMN), "for", downloadRecord.mClientId);
        PrivateLog.log("Downloaded a new word list with description : "
                + downloadRecord.mAttributes.getAsString(MetadataDbHelper.DESCRIPTION_COLUMN)
@@ -678,9 +678,9 @@ public final class UpdateHandler {
     */
    private static void copyFile(final InputStream in, final OutputStream out)
            throws IOException {
        LogUtils.l("Copying files");
        DebugLogUtils.l("Copying files");
        if (!(in instanceof FileInputStream) || !(out instanceof FileOutputStream)) {
            LogUtils.l("Not the right types");
            DebugLogUtils.l("Not the right types");
            copyFileFallback(in, out);
        } else {
            try {
@@ -689,7 +689,7 @@ public final class UpdateHandler {
                sourceChannel.transferTo(0, Integer.MAX_VALUE, destinationChannel);
            } catch (IOException e) {
                // Can't work with channels, or something went wrong. Copy by hand.
                LogUtils.l("Won't work");
                DebugLogUtils.l("Won't work");
                copyFileFallback(in, out);
            }
        }
@@ -704,7 +704,7 @@ public final class UpdateHandler {
     */
    private static void copyFileFallback(final InputStream in, final OutputStream out)
            throws IOException {
        LogUtils.l("Falling back to slow copy");
        DebugLogUtils.l("Falling back to slow copy");
        final byte[] buffer = new byte[FILE_COPY_BUFFER_SIZE];
        for (int readBytes = in.read(buffer); readBytes >= 0; readBytes = in.read(buffer))
            out.write(buffer, 0, readBytes);
@@ -719,10 +719,10 @@ public final class UpdateHandler {
     */
    private static String getTempFileName(final Context context, final String locale)
            throws IOException {
        LogUtils.l("Entering openTempFileOutput");
        DebugLogUtils.l("Entering openTempFileOutput");
        final File dir = context.getFilesDir();
        final File f = File.createTempFile(locale + "___", DICT_FILE_SUFFIX, dir);
        LogUtils.l("File name is", f.getName());
        DebugLogUtils.l("File name is", f.getName());
        return f.getName();
    }

@@ -743,7 +743,7 @@ public final class UpdateHandler {
            final String clientId, List<WordListMetadata> from, List<WordListMetadata> to) {
        final ActionBatch actions = new ActionBatch();
        // Upgrade existing word lists
        LogUtils.l("Comparing dictionaries");
        DebugLogUtils.l("Comparing dictionaries");
        final Set<String> wordListIds = new TreeSet<String>();
        // TODO: Can these be null?
        if (null == from) from = new ArrayList<WordListMetadata>();
@@ -758,7 +758,7 @@ public final class UpdateHandler {
            final WordListMetadata newInfo = null == metadataInfo
                    || metadataInfo.mFormatVersion > MAXIMUM_SUPPORTED_FORMAT_VERSION
                            ? null : metadataInfo;
            LogUtils.l("Considering updating ", id, "currentInfo =", currentInfo);
            DebugLogUtils.l("Considering updating ", id, "currentInfo =", currentInfo);

            if (null == currentInfo && null == newInfo) {
                // This may happen if a new word list appeared that we can't handle.
+3 −3
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ import android.view.inputmethod.InputConnection;

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.DebugLogUtils;
import com.android.inputmethod.latin.utils.StringUtils;
import com.android.inputmethod.research.ResearchLogger;

@@ -107,7 +107,7 @@ public final class RichInputConnection {
                    + "\nActual text = " + reference.length() + " " + reference;
            ((LatinIME)mParent).debugDumpStateAndCrashWithException(context);
        } else {
            Log.e(TAG, LogUtils.getStackTrace(2));
            Log.e(TAG, DebugLogUtils.getStackTrace(2));
            Log.e(TAG, "Exp <> Actual : " + mCurrentCursorPosition + " <> " + et.selectionStart);
        }
    }
@@ -156,7 +156,7 @@ public final class RichInputConnection {
        if (mNestLevel != 1) {
            // TODO: exception instead
            Log.e(TAG, "Batch edit level incorrect : " + mNestLevel);
            Log.e(TAG, LogUtils.getStackTrace(4));
            Log.e(TAG, DebugLogUtils.getStackTrace(4));
        }
    }

Loading