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

Commit f47b8ceb 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

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



Change-Id: Ie063daff0f054c239814574b1b1932c7030625a6
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 75b3f87a 4fd784f1
Loading
Loading
Loading
Loading
+12 −4
Original line number Original line Diff line number Diff line
@@ -360,7 +360,9 @@ public class AdapterService extends Service {
    private UserManager mUserManager;
    private UserManager mUserManager;
    private CompanionDeviceManager mCompanionDeviceManager;
    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 ActiveDeviceManager mActiveDeviceManager;
    private DatabaseManager mDatabaseManager;
    private DatabaseManager mDatabaseManager;
    private SilenceDeviceManager mSilenceDeviceManager;
    private SilenceDeviceManager mSilenceDeviceManager;
@@ -6920,8 +6922,10 @@ public class AdapterService extends Service {


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


    /**
    /**
     * Notify GATT of a Bluetooth profile's connection state change for a given {@link
     * 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(
    public void handleProfileConnectionStateChange(
            int profile, BluetoothDevice device, int fromState, int toState) {
            int profile, BluetoothDevice device, int fromState, int toState) {
        if (mPhonePolicy != null) {
            mPhonePolicy.profileConnectionStateChanged(profile, device, fromState, toState);
            mPhonePolicy.profileConnectionStateChanged(profile, device, fromState, toState);
        }
        }
    }


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


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