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

Commit 600cca16 authored by Mohammadinamul Sheik's avatar Mohammadinamul Sheik Committed by Android (Google) Code Review
Browse files

Merge "Force download the dictionaries after the apk package is updated."

parents 3b0c2eb0 3bc3bc79
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -62,4 +62,11 @@ public class DictionaryPackConstants {
     */
    public static final String UPDATE_NOW_INTENT_ACTION = DICTIONARY_DOMAIN
            + ".UPDATE_NOW";

    /**
     * The intent action to inform the dictionary provider to initialize the db
     * and update now.
     */
    public static final String INIT_AND_UPDATE_NOW_INTENT_ACTION = DICTIONARY_DOMAIN
            + ".INIT_AND_UPDATE_NOW";
}
+1 −0
Original line number Diff line number Diff line
@@ -144,6 +144,7 @@
                <action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
                <action android:name="android.intent.action.DATE_CHANGED" />
                <action android:name="com.android.inputmethod.dictionarypack.aosp.UPDATE_NOW" />
                <action android:name="com.android.inputmethod.dictionarypack.aosp.INIT_AND_UPDATE_NOW" />
            </intent-filter>
        </receiver>

+2 −2
Original line number Diff line number Diff line
@@ -25,6 +25,6 @@
    <bool name="allow_over_roaming">false</bool>
    <bool name="dict_downloads_visible_in_download_UI">false</bool>
    <bool name="metadata_downloads_visible_in_download_UI">false</bool>
    <bool name="display_notification_for_auto_update">false</bool>
    <bool name="display_notification_for_user_requested_update">false</bool>
    <bool name="display_notification_for_auto_update">true</bool>
    <bool name="display_notification_for_user_requested_update">true</bool>
</resources>
+1 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ public final class ActionBatch {
            final long downloadId = UpdateHandler.registerDownloadRequest(manager, request, db,
                    mWordList.mId, mWordList.mVersion);
            Log.i(TAG, String.format("Starting the dictionary download with version:"
                            + " %d and Url: %s" + mWordList.mVersion, uri));
                            + " %d and Url: %s", mWordList.mVersion, uri));
            DebugLogUtils.l("Starting download of", uri, "with id", downloadId);
            PrivateLog.log("Starting download of " + uri + ", id : " + downloadId);
        }
+12 −0
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import android.content.SharedPreferences;
public final class CommonPreferences {
    private static final String COMMON_PREFERENCES_NAME = "LatinImeDictPrefs";

    public static final String PREF_FORCE_DOWNLOAD_DICT = "pref_key_force_download_dict";

    public static SharedPreferences getCommonPreferences(final Context context) {
        return context.getSharedPreferences(COMMON_PREFERENCES_NAME, 0);
    }
@@ -37,4 +39,14 @@ public final class CommonPreferences {
        editor.putBoolean(id, false);
        editor.apply();
    }

    public static boolean isForceDownloadDict(Context context) {
        return getCommonPreferences(context).getBoolean(PREF_FORCE_DOWNLOAD_DICT, false);
    }

    public static void setForceDownloadDict(Context context, boolean forceDownload) {
        SharedPreferences.Editor editor = getCommonPreferences(context).edit();
        editor.putBoolean(PREF_FORCE_DOWNLOAD_DICT, forceDownload);
        editor.apply();
    }
}
Loading