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

Commit d0d9b895 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Adapter: re-order init to prevent null exception" into main

parents 04ca92c7 d2d8fa18
Loading
Loading
Loading
Loading
+9 −15
Original line number Original line Diff line number Diff line
@@ -1092,12 +1092,6 @@ public final class BluetoothAdapter {
    BluetoothAdapter(IBluetoothManager managerService, AttributionSource attributionSource) {
    BluetoothAdapter(IBluetoothManager managerService, AttributionSource attributionSource) {
        mManagerService = requireNonNull(managerService);
        mManagerService = requireNonNull(managerService);
        mAttributionSource = requireNonNull(attributionSource);
        mAttributionSource = requireNonNull(attributionSource);
        mServiceLock.writeLock().lock();
        try {
            mService = getBluetoothService(mManagerCallback);
        } finally {
            mServiceLock.writeLock().unlock();
        }


        Consumer<IBluetooth> registerQualityReportCallbackConsumer =
        Consumer<IBluetooth> registerQualityReportCallbackConsumer =
                (IBluetooth service) -> {
                (IBluetooth service) -> {
@@ -1165,6 +1159,13 @@ public final class BluetoothAdapter {
                new CallbackWrapper(
                new CallbackWrapper(
                        registerBluetoothConnectionCallbackConsumer,
                        registerBluetoothConnectionCallbackConsumer,
                        unregisterBluetoothConnectionCallbackConsumer);
                        unregisterBluetoothConnectionCallbackConsumer);

        mServiceLock.writeLock().lock();
        try {
            mService = registerBlueoothManagerCallback(mManagerCallback);
        } finally {
            mServiceLock.writeLock().unlock();
        }
    }
    }


    /**
    /**
@@ -4211,15 +4212,8 @@ public final class BluetoothAdapter {
        }
        }
    }
    }


    /**
    /** Registers a IBluetoothManagerCallback and returns the cached service proxy object. */
     * Registers a IBluetoothManagerCallback and returns the cached Bluetooth service proxy object.
    IBluetooth registerBlueoothManagerCallback(IBluetoothManagerCallback cb) {
     *
     * <p>TODO: rename this API to registerBlueoothManagerCallback or something? the current name
     * does not match what it does very well.
     *
     * <p>/ @UnsupportedAppUsage /*package
     */
    IBluetooth getBluetoothService(IBluetoothManagerCallback cb) {
        requireNonNull(cb);
        requireNonNull(cb);
        if (Flags.getProfileUseLock()) {
        if (Flags.getProfileUseLock()) {
            sServiceLock.writeLock().lock();
            sServiceLock.writeLock().lock();