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

Commit 94c51577 authored by William Escande's avatar William Escande
Browse files

Adapter: remove dead code ServiceLifecycleCallback

Test: atest FrameworkBluetoothTests
Test: atest ServiceBluetoothTests
Bug: 291815510
Change-Id: I8c363a64968c853e3c992ca11e0d65513e43a8aa
parent 4f4c8b95
Loading
Loading
Loading
Loading
+0 −54
Original line number Diff line number Diff line
@@ -4289,60 +4289,6 @@ public final class BluetoothAdapter {
        void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord);
    }

    /**
     * Register a callback to receive events whenever the bluetooth stack goes down and back up,
     * e.g. in the event the bluetooth is turned off/on via settings.
     *
     * If the bluetooth stack is currently up, there will not be an initial callback call.
     * You can use the return value as an indication of this being the case.
     *
     * Callbacks will be delivered on a binder thread.
     *
     * @return whether bluetooth is already up currently
     *
     * @hide
     */
    @RequiresNoPermission
    public boolean registerServiceLifecycleCallback(@NonNull ServiceLifecycleCallback callback) {
        return getBluetoothService(callback.mRemote) != null;
    }

    /**
     * Unregister a callback registered via {@link #registerServiceLifecycleCallback}
     *
     * @hide
     */
    @RequiresNoPermission
    public void unregisterServiceLifecycleCallback(@NonNull ServiceLifecycleCallback callback) {
        removeServiceStateCallback(callback.mRemote);
    }

    /**
     * A callback for {@link #registerServiceLifecycleCallback}
     *
     * @hide
     */
    public abstract static class ServiceLifecycleCallback {

        /** Called when the bluetooth stack is up */
        public abstract void onBluetoothServiceUp();

        /** Called when the bluetooth stack is down */
        public abstract void onBluetoothServiceDown();

        IBluetoothManagerCallback mRemote = new IBluetoothManagerCallback.Stub() {
            @Override
            public void onBluetoothServiceUp(IBluetooth bluetoothService) {
                ServiceLifecycleCallback.this.onBluetoothServiceUp();
            }

            @Override
            public void onBluetoothServiceDown() {
                ServiceLifecycleCallback.this.onBluetoothServiceDown();
            }
        };
    }

    /**
     * Starts a scan for Bluetooth LE devices.
     *