diff --git a/java/src/org/futo/inputmethod/dictionarypack/DictionarySettingsFragment.java b/java/src/org/futo/inputmethod/dictionarypack/DictionarySettingsFragment.java index ca406a947..3b4926e05 100644 --- a/java/src/org/futo/inputmethod/dictionarypack/DictionarySettingsFragment.java +++ b/java/src/org/futo/inputmethod/dictionarypack/DictionarySettingsFragment.java @@ -43,6 +43,8 @@ import android.view.View; import android.view.ViewGroup; import android.view.animation.AnimationUtils; +import androidx.core.content.ContextCompat; + import org.futo.inputmethod.latin.R; import java.util.ArrayList; @@ -138,7 +140,7 @@ public final class DictionarySettingsFragment extends PreferenceFragment final Activity activity = getActivity(); final IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); - getActivity().registerReceiver(mConnectivityChangedReceiver, filter); + ContextCompat.registerReceiver(getContext(), mConnectivityChangedReceiver, filter, ContextCompat.RECEIVER_EXPORTED); refreshNetworkState(); new Thread("onResume") { diff --git a/java/src/org/futo/inputmethod/latin/LatinIMELegacy.java b/java/src/org/futo/inputmethod/latin/LatinIMELegacy.java index 38bced537..34f53851d 100644 --- a/java/src/org/futo/inputmethod/latin/LatinIMELegacy.java +++ b/java/src/org/futo/inputmethod/latin/LatinIMELegacy.java @@ -41,7 +41,6 @@ import android.os.IBinder; import android.os.Message; import android.preference.PreferenceManager; import android.text.InputType; -import android.text.TextUtils; import android.util.Log; import android.util.PrintWriterPrinter; import android.util.Printer; @@ -58,6 +57,7 @@ import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodSubtype; import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; import org.futo.inputmethod.accessibility.AccessibilityUtils; import org.futo.inputmethod.annotations.UsedForTesting; @@ -651,27 +651,27 @@ public class LatinIMELegacy implements KeyboardActionListener, // Register to receive ringer mode change. final IntentFilter filter = new IntentFilter(); filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); - mInputMethodService.registerReceiver(mRingerModeChangeReceiver, filter); + ContextCompat.registerReceiver(mInputMethodService, mRingerModeChangeReceiver, filter, ContextCompat.RECEIVER_EXPORTED); // Register to receive installation and removal of a dictionary pack. final IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED); packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); packageFilter.addDataScheme(SCHEME_PACKAGE); - mInputMethodService.registerReceiver(mDictionaryPackInstallReceiver, packageFilter); + ContextCompat.registerReceiver(mInputMethodService, mDictionaryPackInstallReceiver, packageFilter, ContextCompat.RECEIVER_EXPORTED); final IntentFilter newDictFilter = new IntentFilter(); newDictFilter.addAction(DictionaryPackConstants.NEW_DICTIONARY_INTENT_ACTION); - mInputMethodService.registerReceiver(mDictionaryPackInstallReceiver, newDictFilter); + ContextCompat.registerReceiver(mInputMethodService, mDictionaryPackInstallReceiver, newDictFilter, ContextCompat.RECEIVER_NOT_EXPORTED); final IntentFilter dictDumpFilter = new IntentFilter(); dictDumpFilter.addAction(DictionaryDumpBroadcastReceiver.DICTIONARY_DUMP_INTENT_ACTION); - mInputMethodService.registerReceiver(mDictionaryDumpBroadcastReceiver, dictDumpFilter); + ContextCompat.registerReceiver(mInputMethodService, mDictionaryDumpBroadcastReceiver, dictDumpFilter, ContextCompat.RECEIVER_NOT_EXPORTED); final IntentFilter hideSoftInputFilter = new IntentFilter(); hideSoftInputFilter.addAction(ACTION_HIDE_SOFT_INPUT); - mInputMethodService.registerReceiver(mHideSoftInputReceiver, hideSoftInputFilter, PERMISSION_HIDE_SOFT_INPUT, - null /* scheduler */); + ContextCompat.registerReceiver(mInputMethodService, mHideSoftInputReceiver, hideSoftInputFilter, PERMISSION_HIDE_SOFT_INPUT, + null /* scheduler */, ContextCompat.RECEIVER_NOT_EXPORTED); StatsUtils.onCreate(mSettings.getCurrent(), mRichImm); }