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

Commit cfe6d0e7 authored by Roopa Sattiraju's avatar Roopa Sattiraju Committed by Automerger Merge Worker
Browse files

Merge "Null check new usages of mPhonePolicy" into main am: bde64600

parents b038c444 bde64600
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -360,7 +360,9 @@ public class AdapterService extends Service {
    private UserManager mUserManager;
    private CompanionDeviceManager mCompanionDeviceManager;

    private PhonePolicy mPhonePolicy;
    // Phone Policy is not used on all devices. Ensure you null check before using it
    @Nullable private PhonePolicy mPhonePolicy;

    private ActiveDeviceManager mActiveDeviceManager;
    private DatabaseManager mDatabaseManager;
    private SilenceDeviceManager mSilenceDeviceManager;
@@ -6920,8 +6922,10 @@ public class AdapterService extends Service {

    /** Update PhonePolicy when new {@link BluetoothDevice} creates an ACL connection. */
    public void updatePhonePolicyOnAclConnect(BluetoothDevice device) {
        if (mPhonePolicy != null) {
            mPhonePolicy.handleAclConnected(device);
        }
    }

    /**
     * Notify GATT of a Bluetooth profile's connection state change for a given {@link
@@ -6943,15 +6947,19 @@ public class AdapterService extends Service {
     */
    public void handleProfileConnectionStateChange(
            int profile, BluetoothDevice device, int fromState, int toState) {
        if (mPhonePolicy != null) {
            mPhonePolicy.profileConnectionStateChanged(profile, device, fromState, toState);
        }
    }

    /** Handle Bluetooth app state when active device changes for a given {@code profile}. */
    public void handleActiveDeviceChange(int profile, BluetoothDevice device) {
        mActiveDeviceManager.profileActiveDeviceChanged(profile, device);
        mSilenceDeviceManager.profileActiveDeviceChanged(profile, device);
        if (mPhonePolicy != null) {
            mPhonePolicy.profileActiveDeviceChanged(profile, device);
        }
    }

    static int convertScanModeToHal(int mode) {
        switch (mode) {