Remove BluetoothEventManager#setReceiverHandler
Make BluetoothEventManager fields final and remove the method to
unregister receivers unnecessarily (introduced in b/35415158).
Bug: 113122466
Test: runtest systemui && make RunSettingsLibRoboTests
Change-Id: I8f34ab1a809638959ab4096a829c72b3d1ac3a23
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index 2dd54aa..b2cf305 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -133,6 +133,10 @@
*/
public static final DependencyKey<Looper> BG_LOOPER = new DependencyKey<>("background_looper");
/**
+ * Key for getting a background Handler for background work.
+ */
+ public static final DependencyKey<Handler> BG_HANDLER = new DependencyKey<>("background_handler");
+ /**
* Key for getting a Handler for receiving time tick broadcasts on.
*/
public static final DependencyKey<Handler> TIME_TICK_HANDLER =
@@ -166,6 +170,7 @@
thread.start();
return thread.getLooper();
});
+ mProviders.put(BG_HANDLER, () -> new Handler(getDependency(BG_LOOPER)));
mProviders.put(MAIN_HANDLER, () -> new Handler(Looper.getMainLooper()));
mProviders.put(ActivityStarter.class, () -> new ActivityStarterDelegate());
mProviders.put(ActivityStarterDelegate.class, () ->
@@ -288,7 +293,7 @@
new PluginDependencyProvider(get(PluginManager.class)));
mProviders.put(LocalBluetoothManager.class, () ->
- LocalBluetoothManager.getInstance(mContext, null));
+ LocalBluetoothManager.create(mContext, getDependency(BG_HANDLER)));
mProviders.put(VolumeDialogController.class, () ->
new VolumeDialogControllerImpl(mContext));