mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Set syncAutomatically for sync users
Note: this doesn't mean that sync would happen. It only unblocks users who are already opted into cloud sync Change-Id: I91836efadac89d0429d7f2e9c9190a873a638743
This commit is contained in:
parent
bdc55e77f7
commit
e09da0aeb9
@ -16,8 +16,10 @@
|
||||
|
||||
package com.android.inputmethod.latin;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@ -31,6 +33,8 @@ import android.view.inputmethod.InputMethodSubtype;
|
||||
|
||||
import com.android.inputmethod.dictionarypack.DictionaryPackConstants;
|
||||
import com.android.inputmethod.keyboard.KeyboardLayoutSet;
|
||||
import com.android.inputmethod.latin.settings.LocalSettingsConstants;
|
||||
import com.android.inputmethod.latin.accounts.LoginAccountUtils;
|
||||
import com.android.inputmethod.latin.settings.Settings;
|
||||
import com.android.inputmethod.latin.setup.SetupActivity;
|
||||
import com.android.inputmethod.latin.utils.UncachedInputMethodManagerUtils;
|
||||
@ -77,6 +81,7 @@ public final class SystemBroadcastReceiver extends BroadcastReceiver {
|
||||
richImm.setAdditionalInputMethodSubtypes(additionalSubtypes);
|
||||
toggleAppIcon(context);
|
||||
downloadLatestDictionaries(context);
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// TODO: This is only for dogfood builds. Remove this from the final release.
|
||||
DictionaryFacilitator keyboardFacilitator =
|
||||
DictionaryFacilitatorProvider.getDictionaryFacilitator(false);
|
||||
@ -93,6 +98,16 @@ public final class SystemBroadcastReceiver extends BroadcastReceiver {
|
||||
"" /* prefix */,
|
||||
null /* listener */);
|
||||
}
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
final String syncAccount = prefs.getString(
|
||||
LocalSettingsConstants.PREF_ACCOUNT_NAME, null /* default */);
|
||||
if (syncAccount != null) {
|
||||
ContentResolver.setSyncAutomatically(
|
||||
new Account(syncAccount, LoginAccountUtils.ACCOUNT_TYPE),
|
||||
"com.android.inputmethod.latin.provider",
|
||||
true);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
} else if (Intent.ACTION_BOOT_COMPLETED.equals(intentAction)) {
|
||||
Log.i(TAG, "Boot has been completed");
|
||||
toggleAppIcon(context);
|
||||
|
Loading…
Reference in New Issue
Block a user