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

Commit 64a34f12 authored by Myles Watson's avatar Myles Watson
Browse files

Check the result of getBluetoothServiceManager

Bug: 216233593
Test: atest BluetoothInstrumentationTests
Tag: #stability
Ignore-AOSP-First: not in AOSP
Change-Id: Ieb201a04928ddb3d3572c88173abbe7a8306c64b
parent c9385295
Loading
Loading
Loading
Loading
+15 −10
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.content.AttributionSource;
import android.content.Context;
import android.os.Binder;
import android.os.BluetoothServiceManager;
import android.os.Build;
import android.os.IBinder;
import android.os.ParcelUuid;
@@ -836,10 +837,14 @@ public final class BluetoothAdapter {

    /** {@hide} */
    public static BluetoothAdapter createAdapter(AttributionSource attributionSource) {
        BluetoothServiceManager manager =
                BluetoothFrameworkInitializer.getBluetoothServiceManager();
        if (manager == null) {
            Log.e(TAG, "BluetoothServiceManager is null");
            return null;
        }
        IBluetoothManager service = IBluetoothManager.Stub.asInterface(
          BluetoothFrameworkInitializer.getBluetoothServiceManager()
              .getBluetoothManagerServiceRegisterer()
              .get());
                manager.getBluetoothManagerServiceRegisterer().get());
        if (service != null) {
            return new BluetoothAdapter(service, attributionSource);
        } else {