Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4663919 authored by jackqdyulei's avatar jackqdyulei
Browse files

Remove DockEventHandler

Intent.ACTION_DOCK_EVENT doesn't have bluetooth device as extra device
any more. DockEventHandler get device null and do nothing for decade.
It's safe to remove it.

Bug: 111803044
Test: test still pass
Change-Id: I41071e0b3bef4b1708c0ee1f2306c17f7d479d3d
parent 9c5f04f9
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
@@ -109,9 +109,6 @@ public class BluetoothEventManager {
        addHandler(BluetoothDevice.ACTION_UUID, new UuidChangedHandler());
        addHandler(BluetoothDevice.ACTION_BATTERY_LEVEL_CHANGED, new BatteryLevelChangedHandler());

        // Dock event broadcasts
        addHandler(Intent.ACTION_DOCK_EVENT, new DockEventHandler());

        // Active device broadcasts
        addHandler(BluetoothA2dp.ACTION_ACTIVE_DEVICE_CHANGED,
                   new ActiveDeviceChangedHandler());
@@ -397,22 +394,6 @@ public class BluetoothEventManager {
        }
    }

    private class DockEventHandler implements Handler {
        public void onReceive(Context context, Intent intent, BluetoothDevice device) {
            // Remove if unpair device upon undocking
            int anythingButUnDocked = Intent.EXTRA_DOCK_STATE_UNDOCKED + 1;
            int state = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, anythingButUnDocked);
            if (state == Intent.EXTRA_DOCK_STATE_UNDOCKED) {
                if (device != null && device.getBondState() == BluetoothDevice.BOND_NONE) {
                    CachedBluetoothDevice cachedDevice = mDeviceManager.findDevice(device);
                    if (cachedDevice != null) {
                        cachedDevice.setJustDiscovered(false);
                    }
                }
            }
        }
    }

    private class BatteryLevelChangedHandler implements Handler {
        public void onReceive(Context context, Intent intent,
                BluetoothDevice device) {