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

Commit 660551bb authored by Tyler Gunn's avatar Tyler Gunn Committed by Android (Google) Code Review
Browse files

Revert "Update InCallController to support work profiles."

Revert submission 20427263-telecomWorkProfileInCallController

Reason for revert: b/262487224 - Causes a regression initiating an emergency call from the lock screen.
Reverted changes: /q/submissionid:20427263-telecomWorkProfileInCallController

Change-Id: I7651a9d29e13a6d7dd8535694451563464597cb0
parent 6ff642d5
Loading
Loading
Loading
Loading
+0 −20
Original line number Diff line number Diff line
@@ -1617,26 +1617,6 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
        checkIfRttCapable();
    }

    public UserHandle getUserHandleFromTargetPhoneAccount() {
        return mTargetPhoneAccountHandle == null
                ? mCallsManager.getCurrentUserHandle() :
                mTargetPhoneAccountHandle.getUserHandle();
    }

    public PhoneAccount getPhoneAccountFromHandle() {
        if (getTargetPhoneAccount() == null) {
            return null;
        }
        PhoneAccount phoneAccount = mCallsManager.getPhoneAccountRegistrar()
                .getPhoneAccountUnchecked(getTargetPhoneAccount());

        if (phoneAccount == null) {
            return null;
        }

        return phoneAccount;
    }

    public CharSequence getTargetPhoneAccountLabel() {
        if (getTargetPhoneAccount() == null) {
            return null;
+3 −24
Original line number Diff line number Diff line
@@ -17,13 +17,10 @@
package com.android.server.telecom;

import android.annotation.NonNull;
import android.content.Context;
import android.media.IAudioService;
import android.media.ToneGenerator;
import android.os.UserHandle;
import android.telecom.CallAudioState;
import android.telecom.Log;
import android.telecom.PhoneAccount;
import android.telecom.VideoProfile;
import android.util.SparseArray;

@@ -453,34 +450,16 @@ public class CallAudioManager extends CallsManagerListenerBase {
                CallAudioRouteStateMachine.INCLUDE_BLUETOOTH_IN_BASELINE);
    }

    Set<UserHandle> silenceRingers(Context context, UserHandle callingUser) {
        // Store all users from calls that were silenced so that we can silence the
        // InCallServices which are associated with those users.
        Set<UserHandle> userHandles = new HashSet<>();
        boolean allCallSilenced = true;
    void silenceRingers() {
        synchronized (mCallsManager.getLock()) {
            for (Call call : mRingingCalls) {
                PhoneAccount targetPhoneAccount = call.getPhoneAccountFromHandle();
                UserHandle userFromCall = call.getUserHandleFromTargetPhoneAccount();
                // Do not try to silence calls when calling user is different from the phone account
                // user and the account does not have CAPABILITY_MULTI_USER enabled.
                if (!callingUser.equals(userFromCall) && !targetPhoneAccount.
                        hasCapabilities(PhoneAccount.CAPABILITY_MULTI_USER)) {
                    allCallSilenced = false;
                    continue;
                }
                userHandles.add(userFromCall);
                call.silence();
            }

            // If all the calls were silenced, we can stop the ringer.
            if (allCallSilenced) {
            mRinger.stopRinging();
            mRinger.stopCallWaiting();
        }
    }
        return userHandles;
    }

    public boolean isRingtonePlaying() {
        return mRinger.isRinging();
+2 −3
Original line number Diff line number Diff line
@@ -2458,7 +2458,7 @@ public class CallsManager extends Call.ListenerBase
            }
        } else if (mPhoneAccountRegistrar.getCallCapablePhoneAccounts(
                requireCallCapableAccountByHandle ? callHandleScheme : null, false,
                call.getInitiatingUser(), false).isEmpty()) {
                call.getInitiatingUser()).isEmpty()) {
            // If there are no call capable accounts, disconnect the call.
            markCallAsDisconnected(call, new DisconnectCause(DisconnectCause.CANCELED,
                    "No registered PhoneAccounts"));
@@ -2924,8 +2924,7 @@ public class CallsManager extends Call.ListenerBase
        List<PhoneAccountHandle> allAccounts =
                mPhoneAccountRegistrar.getCallCapablePhoneAccounts(handle.getScheme(), false, user,
                        capabilities,
                        isEmergency ? 0 : PhoneAccount.CAPABILITY_EMERGENCY_CALLS_ONLY,
                        isEmergency);
                        isEmergency ? 0 : PhoneAccount.CAPABILITY_EMERGENCY_CALLS_ONLY);
        if (mMaxNumberOfSimultaneouslyActiveSims < 0) {
            mMaxNumberOfSimultaneouslyActiveSims =
                    getTelephonyManager().getMaxNumberOfSimultaneouslyActiveSims();
+1 −1
Original line number Diff line number Diff line
@@ -887,7 +887,7 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                    // an emergency call.
                            mPhoneAccountRegistrar.getCallCapablePhoneAccounts(null /*uriScheme*/,
                            false /*includeDisabledAccounts*/, userHandle, 0 /*capabilities*/,
                            0 /*excludedCapabilities*/, false);
                            0 /*excludedCapabilities*/);
                    PhoneAccountHandle phoneAccountHandle = null;
                    for (PhoneAccountHandle accountHandle : accountHandles) {
                        if(accountHandle.equals(callingPhoneAccountHandle)) {
+1 −14
Original line number Diff line number Diff line
@@ -16,10 +16,8 @@

package com.android.server.telecom;

import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.UserHandle;
import android.telecom.DisconnectCause;
import android.telecom.Log;
import android.telecom.ParcelableConference;
@@ -391,23 +389,12 @@ public class CreateConnectionProcessor implements CreateConnectionResponse {
            // current user.
            // ONLY include phone accounts which are NOT self-managed; we will never consider a self
            // managed phone account for placing an emergency call.
            UserHandle userFromCall = mCall.getUserHandleFromTargetPhoneAccount();
            List<PhoneAccount> allAccounts = mPhoneAccountRegistrar
                    .getAllPhoneAccounts(userFromCall, false)
                    .getAllPhoneAccountsOfCurrentUser()
                    .stream()
                    .filter(act -> !act.hasCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED))
                    .collect(Collectors.toList());

            if (allAccounts.isEmpty()) {
                // Try using phone accounts from other users to place the call (i.e. using an
                // available work sim) given that the current user has the INTERACT_ACROSS_USERS
                // permission.
                allAccounts = mPhoneAccountRegistrar.getAllPhoneAccounts(userFromCall, true)
                        .stream()
                        .filter(act -> !act.hasCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED))
                        .collect(Collectors.toList());
            }

            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
Loading