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

Commit d24a3878 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 am:...

Merge "Null check new usages of mPhonePolicy" into main am: bde64600 am: df55c81a am: 4fd784f1 am: f47b8ceb

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2762265



Change-Id: I7c9e933da3035f1ee6b289ad45ccce4b96deb8ab
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 7a59018e f47b8ceb
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) {