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

Commit e433b815 authored by deqiang chen's avatar deqiang chen
Browse files

Do not add default emergency account when there is no telephony and

use RegisterReceiverAsUser to receiver use switch related events
properly.

Test:  local test. adb shell setprop ril.ecclist 911,122,*911,#911,411.
And then manual test that the bluetooth phone account is chosen for
411 ecall and verify after phone is disconnected, call contacts
are cleared

Bug: 138684166

Change-Id: Ia9d86dc08bbc14cc0b82592473da915666c398fa
parent 1cbe8832
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.telecom;

import android.content.Context;
import android.content.pm.PackageManager;
import android.telecom.DisconnectCause;
import android.telecom.Log;
import android.telecom.ParcelableConnection;
@@ -373,7 +374,8 @@ public class CreateConnectionProcessor implements CreateConnectionResponse {
            List<PhoneAccount> allAccounts = mPhoneAccountRegistrar
                    .getAllPhoneAccountsOfCurrentUser();

            if (allAccounts.isEmpty()) {
            if (allAccounts.isEmpty() && mContext.getPackageManager().hasSystemFeature(
                    PackageManager.FEATURE_TELEPHONY)) {
                // If the list of phone accounts is empty at this point, it means Telephony hasn't
                // registered any phone accounts yet. Add a fallback emergency phone account so
                // that emergency calls can still go through. We create a new ArrayLists here just
+6 −3
Original line number Diff line number Diff line
@@ -316,9 +316,12 @@ public class TelecomSystem {
        mRespondViaSmsManager = new RespondViaSmsManager(mCallsManager, mLock);
        mCallsManager.setRespondViaSmsManager(mRespondViaSmsManager);

        mContext.registerReceiver(mUserSwitchedReceiver, USER_SWITCHED_FILTER);
        mContext.registerReceiver(mUserStartingReceiver, USER_STARTING_FILTER);
        mContext.registerReceiver(mBootCompletedReceiver, BOOT_COMPLETE_FILTER);
        mContext.registerReceiverAsUser(mUserSwitchedReceiver, UserHandle.ALL,
                USER_SWITCHED_FILTER, null, null);
        mContext.registerReceiverAsUser(mUserStartingReceiver, UserHandle.ALL,
                USER_STARTING_FILTER, null, null);
        mContext.registerReceiverAsUser(mBootCompletedReceiver, UserHandle.ALL,
                BOOT_COMPLETE_FILTER, null, null);

        mBluetoothPhoneServiceImpl = bluetoothPhoneServiceImplFactory.makeBluetoothPhoneServiceImpl(
                mContext, mLock, mCallsManager, mPhoneAccountRegistrar);