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

Commit 13169c8c authored by Ted Wang's avatar Ted Wang
Browse files

Broadcast Bluetooth Tethering state changed

Bug: 138688805
Test: Manual
Merged-In: I34a8e0556862bebb11e9cc6a099cb87441286754
Change-Id: I34a8e0556862bebb11e9cc6a099cb87441286754
parent d9a570f3
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -61,6 +61,13 @@ public class PanService extends ProfileService {
    private static final boolean DBG = false;
    private static PanService sPanService;

    private static final String ACTION_TETHERING_STATE_CHANGED =
            "android.bluetooth.pan.profile.action.TETHERING_STATE_CHANGED";
    private static final String EXTRA_TETHERING_STATE =
            "android.bluetooth.pan.extra.TETHERING_STATE";
    private static final int TETHERING_STATE_OFF = 1;
    private static final int TETHERING_STATE_ON = 2;

    private static final String BLUETOOTH_IFACE_ADDR_START = "192.168.44.1";
    private static final int BLUETOOTH_MAX_PAN_CONNECTIONS = 5;
    private static final int BLUETOOTH_PREFIX_LENGTH = 24;
@@ -411,6 +418,10 @@ public class PanService extends ProfileService {
            for (BluetoothDevice dev : devList) {
                disconnect(dev);
            }
            Intent intent = new Intent(ACTION_TETHERING_STATE_CHANGED);
            intent.putExtra(EXTRA_TETHERING_STATE,
                    mTetherOn ? TETHERING_STATE_ON : TETHERING_STATE_OFF);
            sendBroadcast(intent, BLUETOOTH_PERM);
        }
    }