Converting LauncherPrefs to dagger
Fixing ENABLE_TWOLINE_ALLAPPS_TOGGLE not properly tied to IDP:
http://recall/-/ep7WJ8pKwCEklUN5J1mAkM
Bug: 361850561
Flag: EXEMPT dagger-migration
Test: atest LauncherPrefsTest FakeLauncherPrefsTest
Change-Id: Iba63d060f4a8c2e31033fca2a4638c559c161338
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index a53238d..5989e4c 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -34,8 +34,6 @@
import android.content.ComponentName;
import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.LauncherApps;
@@ -70,9 +68,6 @@
import com.android.launcher3.util.TraceHelper;
import com.android.launcher3.widget.custom.CustomWidgetManager;
-import java.util.Locale;
-import java.util.Objects;
-
public class LauncherAppState implements SafeCloseable {
public static final String TAG = "LauncherAppState";
@@ -128,22 +123,11 @@
SimpleBroadcastReceiver modelChangeReceiver =
new SimpleBroadcastReceiver(UI_HELPER_EXECUTOR, mModel::onBroadcastIntent);
- final Locale oldLocale = mContext.getResources().getConfiguration().locale;
modelChangeReceiver.register(
mContext,
- () -> {
- // if local has changed before receiver is registered on bg thread,
- // mModel needs to reload.
- Locale newLocale = mContext.getResources().getConfiguration().locale;
- if (!Objects.equals(oldLocale, newLocale)) {
- mModel.forceReload();
- }
- },
- Intent.ACTION_LOCALE_CHANGED,
ACTION_DEVICE_POLICY_RESOURCE_UPDATED);
if (BuildConfig.IS_STUDIO_BUILD) {
- mContext.registerReceiver(modelChangeReceiver, new IntentFilter(ACTION_FORCE_ROLOAD),
- RECEIVER_EXPORTED);
+ modelChangeReceiver.register(mContext, RECEIVER_EXPORTED, ACTION_FORCE_ROLOAD);
}
mOnTerminateCallback.add(() -> modelChangeReceiver.unregisterReceiverSafely(mContext));