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

Commit a47b98df authored by Yuyang Huang's avatar Yuyang Huang
Browse files

check mTelecomManager is null before get phone account

Bug: 284910717
Change-Id: I05d70f86b7fe2ef1354b559be1d61d8197d4a018
Test: atest BluetoothInCallServiceTest
parent 23225492
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -514,7 +514,11 @@ public class BluetoothInCallService extends InCallService {
                }
            }
            if (TextUtils.isEmpty(address)) {
                if (mTelephonyManager == null) {
                    address = null;
                } else {
                    address = mTelephonyManager.getLine1Number();
                }
                if (address == null) address = "";
            }
            return address;
@@ -1436,6 +1440,10 @@ public class BluetoothInCallService extends InCallService {

            if (account == null) {
                // Second, Try to get the label for the default Phone Account.
                if (mTelecomManager == null) {
                    Log.w(TAG, "mTelecomManager is null");
                    return null;
                }
                List<PhoneAccountHandle> handles =
                        mTelecomManager.getPhoneAccountsSupportingScheme(PhoneAccount.SCHEME_TEL);
                while (handles.iterator().hasNext()) {