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

Commit bde64600 authored by Roopa Sattiraju's avatar Roopa Sattiraju Committed by Gerrit Code Review
Browse files

Merge "Null check new usages of mPhonePolicy" into main

parents ee4d56d3 8c39eec6
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -358,7 +358,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;
@@ -6905,8 +6907,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
@@ -6928,15 +6932,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) {