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

Commit b952ed1f authored by Chris Manton's avatar Chris Manton
Browse files

Use identity address to check for connection status

Bug: 319471537
Bug: 295010253
Test: m .
Flag: api_get_connection_state_using_identity_address
Change-Id: I0b4b87d10ed670706c3858ab0836e46da9c7dcb5
parent 7977c577
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -401,6 +401,7 @@ public class AdapterService extends Service {
    private volatile boolean mTestModeEnabled = false;

    private MetricsLogger mMetricsLogger;
    private FeatureFlagsImpl mFeatureFlags;

    /**
     * Register a {@link ProfileService} with AdapterService.
@@ -684,9 +685,9 @@ public class AdapterService extends Service {

        mSdpManager = SdpManager.init(this);

        FeatureFlagsImpl featureFlags = new FeatureFlagsImpl();
        mFeatureFlags = new FeatureFlagsImpl();

        mDatabaseManager = new DatabaseManager(this, featureFlags);
        mDatabaseManager = new DatabaseManager(this, mFeatureFlags);
        mDatabaseManager.start(MetadataDatabase.createDatabase(this));

        boolean isAutomotiveDevice =
@@ -702,18 +703,18 @@ public class AdapterService extends Service {
         */
        if (!isAutomotiveDevice && getResources().getBoolean(R.bool.enable_phone_policy)) {
            Log.i(TAG, "Phone policy enabled");
            mPhonePolicy = new PhonePolicy(this, new ServiceFactory(), featureFlags);
            mPhonePolicy = new PhonePolicy(this, new ServiceFactory(), mFeatureFlags);
            mPhonePolicy.start();
        } else {
            Log.i(TAG, "Phone policy disabled");
        }

        if (featureFlags.audioRoutingCentralization()) {
        if (mFeatureFlags.audioRoutingCentralization()) {
            mActiveDeviceManager =
                    new AudioRoutingManager(this, new ServiceFactory(), featureFlags);
                    new AudioRoutingManager(this, new ServiceFactory(), mFeatureFlags);
        } else {
            mActiveDeviceManager =
                    new ActiveDeviceManager(this, new ServiceFactory(), featureFlags);
                    new ActiveDeviceManager(this, new ServiceFactory(), mFeatureFlags);
        }
        mActiveDeviceManager.start();

@@ -6085,6 +6086,12 @@ public class AdapterService extends Service {
    }

    int getConnectionState(BluetoothDevice device) {
        if (mFeatureFlags.apiGetConnectionStateUsingIdentityAddress()) {
            final String identityAddress = device.getIdentityAddress();
            return (identityAddress == null)
                    ? mNativeInterface.getConnectionState(getBytesFromAddress(device.getAddress()))
                    : mNativeInterface.getConnectionState(getBytesFromAddress(identityAddress));
        }
        return mNativeInterface.getConnectionState(getBytesFromAddress(device.getAddress()));
    }