mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
launcher3: Improve SimpleBroadcastReceiver.
Unless explicitly annotated, parameters in java are by default nullable. There are a few cases where a null context may be passed to the unregisterReceiverSafely function of SimpleBroadcastReceiver. To mitigate misuses or incorrect contexts being passed for register vs unregister, keep the context as a strong reference in the constructor. Also added NonNull annotations for any public callsites to enforce behavior. Bug: 395019017, 395966395 Flag: NONE - bug fixed Test: manual - presubmit Change-Id: Ie371fa45cadceaf51cf184b446df9123ef27c337
This commit is contained in:
@@ -300,10 +300,10 @@ public class InvariantDeviceProfile {
|
||||
lifeCycle.addCloseable(() -> prefs.removeListener(prefListener,
|
||||
FIXED_LANDSCAPE_MODE, ENABLE_TWOLINE_ALLAPPS_TOGGLE));
|
||||
|
||||
SimpleBroadcastReceiver localeReceiver = new SimpleBroadcastReceiver(
|
||||
SimpleBroadcastReceiver localeReceiver = new SimpleBroadcastReceiver(context,
|
||||
MAIN_EXECUTOR, i -> onConfigChanged(context));
|
||||
localeReceiver.register(context, Intent.ACTION_LOCALE_CHANGED);
|
||||
lifeCycle.addCloseable(() -> localeReceiver.unregisterReceiverSafely(context));
|
||||
localeReceiver.register(Intent.ACTION_LOCALE_CHANGED);
|
||||
lifeCycle.addCloseable(() -> localeReceiver.unregisterReceiverSafely());
|
||||
}
|
||||
|
||||
private String initGrid(Context context, String gridName) {
|
||||
|
||||
Reference in New Issue
Block a user