Enforce consistent user retrieval for ICS updates. am: 29b87774c1
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telecomm/+/23480081
Change-Id: Ie559cb5eb9fda76c54addca68dde40ca60a9147e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 7b0b697..dd8e7e8 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -362,7 +362,7 @@
private PhoneAccountHandle mRemotePhoneAccountHandle;
- private UserHandle mInitiatingUser;
+ private UserHandle mAssociatedUser;
private final Handler mHandler = new Handler(Looper.getMainLooper());
@@ -830,8 +830,8 @@
? PhoneNumberUtils.extractPostDialPortion(handle.getSchemeSpecificPart()) : "";
mGatewayInfo = gatewayInfo;
setConnectionManagerPhoneAccount(connectionManagerPhoneAccountHandle);
- setTargetPhoneAccount(targetPhoneAccountHandle);
mCallDirection = callDirection;
+ setTargetPhoneAccount(targetPhoneAccountHandle);
mIsConference = isConference;
mShouldAttachToExistingConnection = shouldAttachToExistingConnection
|| callDirection == CALL_DIRECTION_INCOMING;
@@ -1005,7 +1005,7 @@
s.append("]");
s.append(isIncoming() ? "(MT - incoming)" : "(MO - outgoing)");
s.append("(User=");
- s.append(getInitiatingUser());
+ s.append(getAssociatedUser());
s.append(")");
s.append("\n\t");
@@ -1732,15 +1732,13 @@
mCallStateChangedAtomWriter.setUid(
accountHandle.getComponentName().getPackageName(),
mContext.getPackageManager());
+ // Set the associated user for the call for MT calls based on the target phone account.
+ if (isIncoming() && !accountHandle.getUserHandle().equals(mAssociatedUser)) {
+ setAssociatedUser(accountHandle.getUserHandle());
+ }
}
}
- public UserHandle getUserHandleFromTargetPhoneAccount() {
- return mTargetPhoneAccountHandle == null
- ? mCallsManager.getCurrentUserHandle() :
- mTargetPhoneAccountHandle.getUserHandle();
- }
-
public PhoneAccount getPhoneAccountFromHandle() {
if (getTargetPhoneAccount() == null) {
return null;
@@ -1985,7 +1983,7 @@
if (phoneAccount != null) {
final UserHandle userHandle;
if (phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_MULTI_USER)) {
- userHandle = mInitiatingUser;
+ userHandle = mAssociatedUser;
} else {
userHandle = mTargetPhoneAccountHandle.getUserHandle();
}
@@ -4017,19 +4015,26 @@
}
/**
- * @return user handle of user initiating the outgoing call.
+ * It's possible that the target phone account isn't set when a user hasn't selected a
+ * default sim to place a call. Instead of using the user from the target phone account to
+ * associate the user with a call, we'll use mAssociatedUser instead. For MT calls, we will
+ * continue to use the target phone account user (as it's always set) and for MO calls, we will
+ * use the initiating user instead.
+ *
+ * @return user handle of user associated with the call.
*/
- public UserHandle getInitiatingUser() {
- return mInitiatingUser;
+ public UserHandle getAssociatedUser() {
+ return mAssociatedUser;
}
/**
- * Set the user handle of user initiating the outgoing call.
- * @param initiatingUser
+ * Set the user handle of user associated with the call.
+ * @param associatedUser
*/
- public void setInitiatingUser(UserHandle initiatingUser) {
- Preconditions.checkNotNull(initiatingUser);
- mInitiatingUser = initiatingUser;
+ public void setAssociatedUser(UserHandle associatedUser) {
+ Log.i(this, "Setting associated user for call");
+ Preconditions.checkNotNull(associatedUser);
+ mAssociatedUser = associatedUser;
}
static int getStateFromConnectionState(int state) {
diff --git a/src/com/android/server/telecom/CallAudioManager.java b/src/com/android/server/telecom/CallAudioManager.java
index f52a966..ff76b9e 100644
--- a/src/com/android/server/telecom/CallAudioManager.java
+++ b/src/com/android/server/telecom/CallAudioManager.java
@@ -497,7 +497,7 @@
boolean allCallSilenced = true;
synchronized (mCallsManager.getLock()) {
for (Call call : mRingingCalls) {
- UserHandle userFromCall = call.getUserHandleFromTargetPhoneAccount();
+ UserHandle userFromCall = call.getAssociatedUser();
// Do not try to silence calls when calling user is different from the phone account
// user, the account does not have CAPABILITY_MULTI_USER enabled, or if the user
// does not have the INTERACT_ACROSS_USERS permission enabled.
diff --git a/src/com/android/server/telecom/CallLogManager.java b/src/com/android/server/telecom/CallLogManager.java
index a7bbf84..3005656 100644
--- a/src/com/android/server/telecom/CallLogManager.java
+++ b/src/com/android/server/telecom/CallLogManager.java
@@ -324,7 +324,7 @@
}
PhoneAccount phoneAccount = mPhoneAccountRegistrar.getPhoneAccountUnchecked(accountHandle);
- UserHandle initiatingUser = call.getInitiatingUser();
+ UserHandle initiatingUser = call.getAssociatedUser();
if (phoneAccount != null &&
phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_MULTI_USER)) {
if (initiatingUser != null &&
diff --git a/src/com/android/server/telecom/CallStreamingController.java b/src/com/android/server/telecom/CallStreamingController.java
index 0cf5120..1323633 100644
--- a/src/com/android/server/telecom/CallStreamingController.java
+++ b/src/com/android/server/telecom/CallStreamingController.java
@@ -182,7 +182,7 @@
super(mTelecomLock);
mWrapper = wrapper;
mCall = call;
- mUserHandle = mCall.getInitiatingUser();
+ mUserHandle = mCall.getAssociatedUser();
mContext = context;
}
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 70ebbb8..eb86ad0 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -736,7 +736,7 @@
public void onSuccessfulOutgoingCall(Call call, int callState) {
Log.v(this, "onSuccessfulOutgoingCall, %s", call);
call.setPostCallPackageName(getRoleManagerAdapter().getDefaultCallScreeningApp(
- call.getUserHandleFromTargetPhoneAccount()));
+ call.getAssociatedUser()));
setCallState(call, callState, "successful outgoing call");
if (!mCalls.contains(call)) {
@@ -800,7 +800,7 @@
private IncomingCallFilterGraph setUpCallFilterGraph(Call incomingCall) {
incomingCall.setIsUsingCallFiltering(true);
String carrierPackageName = getCarrierPackageName();
- UserHandle userHandle = incomingCall.getUserHandleFromTargetPhoneAccount();
+ UserHandle userHandle = incomingCall.getAssociatedUser();
String defaultDialerPackageName = TelecomManager.from(mContext).
getDefaultDialerPackage(userHandle);
String userChosenPackageName = getRoleManagerAdapter().
@@ -922,7 +922,7 @@
if (result.shouldAllowCall) {
incomingCall.setPostCallPackageName(
getRoleManagerAdapter().getDefaultCallScreeningApp(
- incomingCall.getUserHandleFromTargetPhoneAccount()
+ incomingCall.getAssociatedUser()
));
Log.i(this, "onCallFilteringComplete: allow call.");
@@ -1431,7 +1431,7 @@
}
}
// Incoming address was set via EXTRA_INCOMING_CALL_ADDRESS above.
- call.setInitiatingUser(phoneAccountHandle.getUserHandle());
+ call.setAssociatedUser(phoneAccountHandle.getUserHandle());
}
// Ensure new calls related to self-managed calls/connections are set as such. This will
@@ -1558,7 +1558,7 @@
// Check if the target phone account is possibly in ECBM.
call.setIsInECBM(getEmergencyCallHelper()
.isLastOutgoingEmergencyCallPAH(call.getTargetPhoneAccount()));
- if (mUserManager.isQuietModeEnabled(call.getUserHandleFromTargetPhoneAccount())
+ if (mUserManager.isQuietModeEnabled(call.getAssociatedUser())
&& !call.isEmergencyCall() && !call.isInECBM()) {
Log.d(TAG, "Rejecting non-emergency call because the owner %s is not running.",
phoneAccountHandle.getUserHandle());
@@ -1635,6 +1635,8 @@
mToastFactory);
call.initAnalytics();
+ // For unknown calls, base the associated user off of the target phone account handle.
+ call.setAssociatedUser(phoneAccountHandle.getUserHandle());
setIntentExtrasAndStartTime(call, extras);
call.addListener(this);
notifyStartCreateConnection(call);
@@ -1798,7 +1800,7 @@
|| phoneAccountExtra.getBoolean(
PhoneAccount.EXTRA_ADD_SELF_MANAGED_CALLS_TO_INCALLSERVICE, true));
}
- call.setInitiatingUser(initiatingUser);
+ call.setAssociatedUser(initiatingUser);
isReusedCall = false;
} else {
isReusedCall = true;
@@ -2074,7 +2076,7 @@
(callPhoneAccountHandlePair, uriCallerInfoPair) -> {
Call theCall = callPhoneAccountHandlePair.first;
UserHandle userHandleForCallScreening = theCall.
- getUserHandleFromTargetPhoneAccount();
+ getAssociatedUser();
boolean isInContacts = uriCallerInfoPair.second != null
&& uriCallerInfoPair.second.contactExists;
Log.d(CallsManager.this, "outgoingCallIdStage: isInContacts=%s",
@@ -2309,7 +2311,7 @@
// Find the user chosen call screening app.
String callScreeningApp =
mRoleManagerAdapter.getDefaultCallScreeningApp(
- theCall.getUserHandleFromTargetPhoneAccount());
+ theCall.getAssociatedUser());
CompletableFuture future =
new CallScreeningServiceHelper(mContext,
@@ -2473,7 +2475,7 @@
&& !phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_MULTI_USER)) {
// Note that mCurrentUserHandle may not actually be the current user, i.e.
// in the case of work profiles
- UserHandle currentUserHandle = call.getUserHandleFromTargetPhoneAccount();
+ UserHandle currentUserHandle = call.getAssociatedUser();
// Check if the phoneAccountHandle belongs to the current user
if (phoneAccountHandle != null &&
!phoneAccountHandle.getUserHandle().equals(currentUserHandle)) {
@@ -2756,7 +2758,7 @@
// Auto-enable speakerphone if the originating intent specified to do so, if the call
// is a video call, of if using speaker when docked
PhoneAccount account = mPhoneAccountRegistrar.getPhoneAccount(
- call.getTargetPhoneAccount(), call.getInitiatingUser());
+ call.getTargetPhoneAccount(), call.getAssociatedUser());
boolean allowVideo = false;
if (account != null) {
allowVideo = account.hasCapabilities(PhoneAccount.CAPABILITY_VIDEO_CALLING);
@@ -2818,7 +2820,7 @@
}
} else if (mPhoneAccountRegistrar.getCallCapablePhoneAccounts(
requireCallCapableAccountByHandle ? callHandleScheme : null, false,
- call.getInitiatingUser(), false).isEmpty()) {
+ call.getAssociatedUser(), false).isEmpty()) {
// If there are no call capable accounts, disconnect the call.
markCallAsDisconnected(call, new DisconnectCause(DisconnectCause.CANCELED,
"No registered PhoneAccounts"));
@@ -3439,7 +3441,7 @@
} else {
if (setDefault) {
mPhoneAccountRegistrar
- .setUserSelectedOutgoingPhoneAccount(account, call.getInitiatingUser());
+ .setUserSelectedOutgoingPhoneAccount(account, call.getAssociatedUser());
}
if (mPendingAccountSelection != null) {
@@ -4145,6 +4147,8 @@
call.setVideoProvider(parcelableConference.getVideoProvider());
call.setStatusHints(parcelableConference.getStatusHints());
call.putConnectionServiceExtras(parcelableConference.getExtras());
+ // For conference calls, set the associated user from the target phone account user handle.
+ call.setAssociatedUser(phoneAccount.getUserHandle());
// In case this Conference was added via a ConnectionManager, keep track of the original
// Connection ID as created by the originating ConnectionService.
Bundle extras = parcelableConference.getExtras();
@@ -5182,6 +5186,9 @@
call.setHandle(connection.getHandle(), connection.getHandlePresentation());
call.setCallerDisplayName(connection.getCallerDisplayName(),
connection.getCallerDisplayNamePresentation());
+ // For existing connections, use the phone account user handle to determine the user
+ // association with the call.
+ call.setAssociatedUser(connection.getPhoneAccount().getUserHandle());
call.addListener(this);
call.putConnectionServiceExtras(connection.getExtras());
@@ -5831,7 +5838,9 @@
if (isSelfManaged) {
call.setIsVoipAudioMode(true);
}
- call.setInitiatingUser(getCurrentUserHandle());
+ // Set associated user based on the existing call as it doesn't make sense to handover calls
+ // across user profiles.
+ call.setAssociatedUser(handoverFromCall.getAssociatedUser());
// Ensure we don't try to place an outgoing call with video if video is not
// supported.
@@ -6065,6 +6074,9 @@
fromCall.setHandoverDestinationCall(call);
call.setHandoverSourceCall(fromCall);
call.setHandoverState(HandoverState.HANDOVER_TO_STARTED);
+ // Set associated user based on the existing call as it doesn't make sense to handover calls
+ // across user profiles.
+ call.setAssociatedUser(fromCall.getAssociatedUser());
fromCall.setHandoverState(HandoverState.HANDOVER_FROM_STARTED);
if (isSpeakerEnabledForVideoCalls() && VideoProfile.isVideo(videoState)) {
@@ -6351,7 +6363,7 @@
* @return {@code true} if call is visible to the calling user
*/
boolean isCallVisibleForUser(Call call, UserHandle userHandle) {
- return call.getUserHandleFromTargetPhoneAccount().equals(userHandle)
+ return call.getAssociatedUser().equals(userHandle)
|| call.getPhoneAccountFromHandle()
.hasCapabilities(PhoneAccount.CAPABILITY_MULTI_USER);
}
diff --git a/src/com/android/server/telecom/CreateConnectionProcessor.java b/src/com/android/server/telecom/CreateConnectionProcessor.java
index 6702f03..19691c1 100644
--- a/src/com/android/server/telecom/CreateConnectionProcessor.java
+++ b/src/com/android/server/telecom/CreateConnectionProcessor.java
@@ -391,7 +391,7 @@
// 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();
+ UserHandle userFromCall = mCall.getAssociatedUser();
List<PhoneAccount> allAccounts = mPhoneAccountRegistrar
.getAllPhoneAccounts(userFromCall, false)
.stream()
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index c44227d..8e10614 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -1707,6 +1707,11 @@
return mInCallServices;
}
+ @VisibleForTesting
+ public Map<UserHandle, CarSwappingInCallServiceConnection> getInCallServiceConnections() {
+ return mInCallServiceConnections;
+ }
+
void silenceRinger(Set<UserHandle> userHandles) {
userHandles.forEach(userHandle -> {
if (mInCallServices.containsKey(userHandle)) {
@@ -2865,7 +2870,7 @@
if (call == null) {
return mCallsManager.getCurrentUserHandle();
} else {
- UserHandle userFromCall = call.getUserHandleFromTargetPhoneAccount();
+ UserHandle userFromCall = call.getAssociatedUser();
UserManager userManager = mContext.getSystemService(UserManager.class);
// Emergency call should never be blocked, so if the user associated with call is in
// quite mode, use the primary user for the emergency call.
diff --git a/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java b/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java
index 8426d1f..3b402b1 100644
--- a/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java
+++ b/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java
@@ -382,14 +382,14 @@
* broadcasting.
*/
callRedirectionWithService = callRedirectionProcessor
- .canMakeCallRedirectionWithServiceAsUser(mCall.getInitiatingUser());
+ .canMakeCallRedirectionWithServiceAsUser(mCall.getAssociatedUser());
if (callRedirectionWithService) {
- callRedirectionProcessor.performCallRedirection(mCall.getInitiatingUser());
+ callRedirectionProcessor.performCallRedirection(mCall.getAssociatedUser());
}
}
if (disposition.sendBroadcast) {
- UserHandle targetUser = mCall.getInitiatingUser();
+ UserHandle targetUser = mCall.getAssociatedUser();
Log.i(this, "Sending NewOutgoingCallBroadcast for %s to %s", mCall, targetUser);
broadcastIntent(mIntent, disposition.number,
!disposition.callImmediately && !callRedirectionWithService, targetUser);
diff --git a/src/com/android/server/telecom/PhoneAccountRegistrar.java b/src/com/android/server/telecom/PhoneAccountRegistrar.java
index 11b0f4d..acf07e3 100644
--- a/src/com/android/server/telecom/PhoneAccountRegistrar.java
+++ b/src/com/android/server/telecom/PhoneAccountRegistrar.java
@@ -563,10 +563,7 @@
if (call == null) {
return null;
}
- UserHandle userHandle = call.getInitiatingUser();
- if (userHandle == null) {
- userHandle = call.getTargetPhoneAccount().getUserHandle();
- }
+ UserHandle userHandle = call.getAssociatedUser();
PhoneAccountHandle targetPhoneAccount = call.getTargetPhoneAccount();
Log.d(this, "getSimCallManagerFromCall: callId=%s, targetPhac=%s",
call.getId(), targetPhoneAccount);
diff --git a/src/com/android/server/telecom/Ringer.java b/src/com/android/server/telecom/Ringer.java
index 45fb2af..1710604 100644
--- a/src/com/android/server/telecom/Ringer.java
+++ b/src/com/android/server/telecom/Ringer.java
@@ -552,7 +552,7 @@
}
if (mInCallController.doesConnectedDialerSupportRinging(
- call.getUserHandleFromTargetPhoneAccount())) {
+ call.getAssociatedUser())) {
Log.addEvent(call, LogUtils.Events.SKIP_RINGING, "Dialer handles");
return;
}
@@ -689,10 +689,10 @@
boolean isTheaterModeOn = mSystemSettingsUtil.isTheaterModeOn(mContext);
timer.record("isTheaterModeOn");
boolean letDialerHandleRinging = mInCallController.doesConnectedDialerSupportRinging(
- call.getUserHandleFromTargetPhoneAccount());
+ call.getAssociatedUser());
timer.record("letDialerHandleRinging");
boolean isWorkProfileInQuietMode =
- isProfileInQuietMode(call.getUserHandleFromTargetPhoneAccount());
+ isProfileInQuietMode(call.getAssociatedUser());
timer.record("isWorkProfileInQuietMode");
Log.i(this, "startRinging timings: " + timer);
diff --git a/src/com/android/server/telecom/RingtoneFactory.java b/src/com/android/server/telecom/RingtoneFactory.java
index 309c86e..6bcfb4c 100644
--- a/src/com/android/server/telecom/RingtoneFactory.java
+++ b/src/com/android/server/telecom/RingtoneFactory.java
@@ -75,7 +75,7 @@
// or the default ringtone of the receiving user.
Context userContext = isWorkContact(incomingCall) ?
getWorkProfileContextForUser(mCallsManager.getCurrentUserHandle()) :
- getContextForUserHandle(incomingCall.getUserHandleFromTargetPhoneAccount());
+ getContextForUserHandle(incomingCall.getAssociatedUser());
Uri ringtoneUri = incomingCall.getRingtone();
Ringtone ringtone = null;
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index ca42b57..f33b185 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -2173,7 +2173,7 @@
|| call.getState() == CallState.DISCONNECTING) {
mCallsManager.markCallAsRemoved(call);
}
- userHandles.add(call.getUserHandleFromTargetPhoneAccount());
+ userHandles.add(call.getAssociatedUser());
}
for (UserHandle userHandle : userHandles) {
mCallsManager.getInCallController().unbindFromServices(userHandle);
diff --git a/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java b/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java
index f542fa2..f07c0aa 100644
--- a/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java
+++ b/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java
@@ -319,7 +319,7 @@
CallScreeningServiceConnection connection = new CallScreeningServiceConnection(
resultFuture);
if (!CallScreeningServiceHelper.bindCallScreeningService(mContext,
- mCall.getUserHandleFromTargetPhoneAccount(), mPackageName, connection)) {
+ mCall.getAssociatedUser(), mPackageName, connection)) {
Log.i(this, "Call screening service binding failed.");
resultFuture.complete(mPriorStageResult);
} else {
diff --git a/src/com/android/server/telecom/ui/AudioProcessingNotification.java b/src/com/android/server/telecom/ui/AudioProcessingNotification.java
index e38178e..952bee8 100644
--- a/src/com/android/server/telecom/ui/AudioProcessingNotification.java
+++ b/src/com/android/server/telecom/ui/AudioProcessingNotification.java
@@ -54,7 +54,7 @@
} else if (oldState == CallState.AUDIO_PROCESSING
&& newState != CallState.AUDIO_PROCESSING) {
cancelAudioProcessingNotification(
- call.getUserHandleFromTargetPhoneAccount());
+ call.getAssociatedUser());
}
}
@@ -69,7 +69,7 @@
public void onCallRemoved(Call call) {
if (call == mCallInAudioProcessing) {
cancelAudioProcessingNotification(
- call.getUserHandleFromTargetPhoneAccount());
+ call.getAssociatedUser());
}
}
@@ -80,7 +80,7 @@
*/
private void showAudioProcessingNotification(Call call) {
Log.i(this, "showAudioProcessingNotification for user = %s",
- call.getUserHandleFromTargetPhoneAccount());
+ call.getAssociatedUser());
mCallInAudioProcessing = call;
Notification.Builder builder = new Notification.Builder(mContext,
@@ -97,7 +97,7 @@
Notification notification = builder.build();
mNotificationManager.notifyAsUser(NOTIFICATION_TAG, AUDIO_PROCESSING_NOTIFICATION_ID,
- notification, mCallInAudioProcessing.getUserHandleFromTargetPhoneAccount());
+ notification, mCallInAudioProcessing.getAssociatedUser());
}
/** Cancels the audio processing notification. */
diff --git a/src/com/android/server/telecom/ui/CallStreamingNotification.java b/src/com/android/server/telecom/ui/CallStreamingNotification.java
index 3f09bb1..8414047 100644
--- a/src/com/android/server/telecom/ui/CallStreamingNotification.java
+++ b/src/com/android/server/telecom/ui/CallStreamingNotification.java
@@ -157,7 +157,7 @@
Log.e(this, e, "enqueueStreamingNotification: Couldn't build avatar icon");
}
showStreamingNotification(call.getId(),
- call.getUserHandleFromTargetPhoneAccount(), call.getCallerDisplayName(),
+ call.getAssociatedUser(), call.getCallerDisplayName(),
call.getHandle(), contactPhotoIcon,
call.getTargetPhoneAccount().getComponentName().getPackageName(),
call.getConnectTimeMillis());
diff --git a/src/com/android/server/telecom/ui/DisconnectedCallNotifier.java b/src/com/android/server/telecom/ui/DisconnectedCallNotifier.java
index 66f9fe4..1604285 100644
--- a/src/com/android/server/telecom/ui/DisconnectedCallNotifier.java
+++ b/src/com/android/server/telecom/ui/DisconnectedCallNotifier.java
@@ -143,8 +143,7 @@
DisconnectCause.REASON_EMERGENCY_CALL_PLACED.equals(cause.getReason())) {
// Clear any existing notification.
clearNotification(mCallsManager.getCurrentUserHandle());
- UserHandle userHandle = call.getTargetPhoneAccount() != null ?
- call.getTargetPhoneAccount().getUserHandle() : call.getInitiatingUser();
+ UserHandle userHandle = call.getAssociatedUser();
// As a last resort, use the current user to display the notification.
if (userHandle == null) userHandle = mCallsManager.getCurrentUserHandle();
mPendingCallNotification = new CallInfo(userHandle, call.getHandle(),
diff --git a/src/com/android/server/telecom/ui/IncomingCallNotifier.java b/src/com/android/server/telecom/ui/IncomingCallNotifier.java
index 3b188d4..d419163 100644
--- a/src/com/android/server/telecom/ui/IncomingCallNotifier.java
+++ b/src/com/android/server/telecom/ui/IncomingCallNotifier.java
@@ -168,19 +168,19 @@
} else if (hadIncomingCall && !hasIncomingCall) {
previousIncomingCall.removeListener(mCallListener);
hideIncomingCallNotification(
- previousIncomingCall.getUserHandleFromTargetPhoneAccount());
+ previousIncomingCall.getAssociatedUser());
}
}
}
private void showIncomingCallNotification(Call call) {
Log.i(this, "showIncomingCallNotification showCall = %s for user = %s",
- call, call.getUserHandleFromTargetPhoneAccount());
+ call, call.getAssociatedUser());
Notification.Builder builder = getNotificationBuilder(call,
mCallsManagerProxy.getActiveCall());
mNotificationManager.notifyAsUser(NOTIFICATION_TAG, NOTIFICATION_INCOMING_CALL,
- builder.build(), call.getUserHandleFromTargetPhoneAccount());
+ builder.build(), call.getAssociatedUser());
}
private void hideIncomingCallNotification(UserHandle userHandle) {
diff --git a/tests/src/com/android/server/telecom/tests/CallLogManagerTest.java b/tests/src/com/android/server/telecom/tests/CallLogManagerTest.java
index b9f5667..9466220 100644
--- a/tests/src/com/android/server/telecom/tests/CallLogManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallLogManagerTest.java
@@ -1062,7 +1062,7 @@
when(fakeCall.getVideoStateHistory()).thenReturn(callVideoState);
when(fakeCall.getPostDialDigits()).thenReturn(postDialDigits);
when(fakeCall.getViaNumber()).thenReturn(viaNumber);
- when(fakeCall.getInitiatingUser()).thenReturn(initiatingUser);
+ when(fakeCall.getAssociatedUser()).thenReturn(initiatingUser);
when(fakeCall.getCallDataUsage()).thenReturn(callDataUsage);
when(fakeCall.isEmergencyCall()).thenReturn(
phoneAccountHandle.equals(EMERGENCY_ACCT_HANDLE));
diff --git a/tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java b/tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java
index d95a0e2..4d8d497 100644
--- a/tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java
@@ -129,7 +129,7 @@
when(mCallsManager.getCurrentUserHandle()).thenReturn(UserHandle.CURRENT);
when(mCall.getId()).thenReturn(CALL_ID);
- when(mCall.getUserHandleFromTargetPhoneAccount()).
+ when(mCall.getAssociatedUser()).
thenReturn(PA_HANDLE.getUserHandle());
when(mContext.getPackageManager()).thenReturn(mPackageManager);
when(mContext.getSystemService(TelecomManager.class))
diff --git a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
index 8a7d22c..7f252bc 100644
--- a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
@@ -2473,7 +2473,7 @@
public void testPostCallPackageNameSetOnSuccessfulOutgoingCall() throws Exception {
Call outgoingCall = addSpyCall(CallState.NEW);
when(mCallsManager.getRoleManagerAdapter().getDefaultCallScreeningApp(
- outgoingCall.getUserHandleFromTargetPhoneAccount()))
+ outgoingCall.getAssociatedUser()))
.thenReturn(DEFAULT_CALL_SCREENING_APP);
assertNull(outgoingCall.getPostCallPackageName());
mCallsManager.onSuccessfulOutgoingCall(outgoingCall, CallState.CONNECTING);
diff --git a/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java b/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
index cba383d..0927b80 100755
--- a/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
+++ b/tests/src/com/android/server/telecom/tests/ConnectionServiceFixture.java
@@ -70,6 +70,8 @@
public CountDownLatch mExtrasLock = new CountDownLatch(1);
static int NOT_SPECIFIED = 0;
public static final String STATUS_HINTS_EXTRA = "updateStatusHints";
+ public static final PhoneAccountHandle TEST_PHONE_ACCOUNT_HANDLE =
+ new PhoneAccountHandle(new ComponentName("pkg", "cls"), "test");
/**
* Implementation of ConnectionService that performs no-ops for tasks normally meant for
@@ -196,7 +198,7 @@
public class FakeConference extends Conference {
public FakeConference() {
- super(null);
+ super(TEST_PHONE_ACCOUNT_HANDLE);
setConnectionCapabilities(
Connection.CAPABILITY_SUPPORT_HOLD
| Connection.CAPABILITY_HOLD
diff --git a/tests/src/com/android/server/telecom/tests/CreateConnectionProcessorTest.java b/tests/src/com/android/server/telecom/tests/CreateConnectionProcessorTest.java
index dbcab66..8a85a87 100644
--- a/tests/src/com/android/server/telecom/tests/CreateConnectionProcessorTest.java
+++ b/tests/src/com/android/server/telecom/tests/CreateConnectionProcessorTest.java
@@ -144,7 +144,7 @@
});
when(mMockAccountRegistrar.getAllPhoneAccounts(any(UserHandle.class), anyBoolean()))
.thenReturn(phoneAccounts);
- when(mMockCall.getUserHandleFromTargetPhoneAccount()).
+ when(mMockCall.getAssociatedUser()).
thenReturn(Binder.getCallingUserHandle());
}
diff --git a/tests/src/com/android/server/telecom/tests/DisconnectedCallNotifierTest.java b/tests/src/com/android/server/telecom/tests/DisconnectedCallNotifierTest.java
index 2cdc23a..05c5071 100644
--- a/tests/src/com/android/server/telecom/tests/DisconnectedCallNotifierTest.java
+++ b/tests/src/com/android/server/telecom/tests/DisconnectedCallNotifierTest.java
@@ -151,6 +151,7 @@
when(call.getDisconnectCause()).thenReturn(cause);
when(call.getTargetPhoneAccount()).thenReturn(PHONE_ACCOUNT_HANDLE);
when(call.getHandle()).thenReturn(TEL_CALL_HANDLE);
+ when(call.getAssociatedUser()).thenReturn(PHONE_ACCOUNT_HANDLE.getUserHandle());
return call;
}
}
diff --git a/tests/src/com/android/server/telecom/tests/InCallControllerTests.java b/tests/src/com/android/server/telecom/tests/InCallControllerTests.java
index d87ce7b..2f3e4bf 100644
--- a/tests/src/com/android/server/telecom/tests/InCallControllerTests.java
+++ b/tests/src/com/android/server/telecom/tests/InCallControllerTests.java
@@ -22,6 +22,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -35,6 +36,7 @@
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
@@ -210,7 +212,7 @@
super.setUp();
MockitoAnnotations.initMocks(this);
when(mMockCall.getAnalytics()).thenReturn(new Analytics.CallInfo());
- when(mMockCall.getUserHandleFromTargetPhoneAccount()).thenReturn(mUserHandle);
+ when(mMockCall.getAssociatedUser()).thenReturn(mUserHandle);
when(mMockCall.getId()).thenReturn("TC@1");
doReturn(mMockResources).when(mMockContext).getResources();
doReturn(mMockAppOpsManager).when(mMockContext).getSystemService(AppOpsManager.class);
@@ -422,6 +424,7 @@
when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
when(mMockCallsManager.isInEmergencyCall()).thenReturn(false);
when(mMockCall.isIncoming()).thenReturn(false);
+ when(mMockCall.getAssociatedUser()).thenReturn(mUserHandle);
when(mMockCall.getTargetPhoneAccount()).thenReturn(PA_HANDLE);
when(mMockCall.getIntentExtras()).thenReturn(callExtras);
when(mMockCall.isExternalCall()).thenReturn(false);
@@ -459,6 +462,7 @@
when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
when(mMockCallsManager.isInEmergencyCall()).thenReturn(false);
when(mMockCall.isIncoming()).thenReturn(false);
+ when(mMockCall.getAssociatedUser()).thenReturn(mUserHandle);
when(mMockCall.getTargetPhoneAccount()).thenReturn(PA_HANDLE);
when(mMockCall.getIntentExtras()).thenReturn(callExtras);
when(mMockCall.isExternalCall()).thenReturn(false);
@@ -515,6 +519,7 @@
.thenReturn(mMockUserManager);
when(mMockUserManager.isQuietModeEnabled(any(UserHandle.class))).thenReturn(false);
when(mMockCall.isIncoming()).thenReturn(false);
+ when(mMockCall.getAssociatedUser()).thenReturn(mUserHandle);
when(mMockCall.getTargetPhoneAccount()).thenReturn(PA_HANDLE);
when(mMockCall.getIntentExtras()).thenReturn(callExtras);
when(mMockCall.isExternalCall()).thenReturn(false);
@@ -581,7 +586,8 @@
when(mMockCallsManager.getCurrentUserHandle()).thenReturn(mUserHandle);
when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
when(mMockCall.isEmergencyCall()).thenReturn(true);
- when(mMockCall.getUserHandleFromTargetPhoneAccount()).thenReturn(DUMMY_USER_HANDLE);
+ when(mMockCall.isIncoming()).thenReturn(true);
+ when(mMockCall.getAssociatedUser()).thenReturn(DUMMY_USER_HANDLE);
when(mMockContext.getSystemService(eq(UserManager.class)))
.thenReturn(mMockUserManager);
when(mMockUserManager.isQuietModeEnabled(any(UserHandle.class))).thenReturn(true);
@@ -609,7 +615,8 @@
when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
when(mMockCall.isEmergencyCall()).thenReturn(false);
when(mMockCall.isInECBM()).thenReturn(true);
- when(mMockCall.getUserHandleFromTargetPhoneAccount()).thenReturn(DUMMY_USER_HANDLE);
+ when(mMockCall.isIncoming()).thenReturn(true);
+ when(mMockCall.getAssociatedUser()).thenReturn(DUMMY_USER_HANDLE);
when(mMockContext.getSystemService(eq(UserManager.class)))
.thenReturn(mMockUserManager);
when(mMockUserManager.isQuietModeEnabled(any(UserHandle.class))).thenReturn(true);
@@ -636,7 +643,7 @@
when(mMockCallsManager.getCurrentUserHandle()).thenReturn(mUserHandle);
when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
when(mMockCall.isEmergencyCall()).thenReturn(true);
- when(mMockCall.getUserHandleFromTargetPhoneAccount()).thenReturn(DUMMY_USER_HANDLE);
+ when(mMockCall.getAssociatedUser()).thenReturn(DUMMY_USER_HANDLE);
when(mMockContext.getSystemService(eq(UserManager.class)))
.thenReturn(mMockUserManager);
when(mMockUserManager.isQuietModeEnabled(any(UserHandle.class))).thenReturn(false);
@@ -675,6 +682,7 @@
.thenReturn(mMockUserManager);
when(mMockUserManager.isQuietModeEnabled(any(UserHandle.class))).thenReturn(false);
when(mMockCall.isIncoming()).thenReturn(false);
+ when(mMockCall.getAssociatedUser()).thenReturn(mUserHandle);
when(mMockCall.getTargetPhoneAccount()).thenReturn(PA_HANDLE);
when(mMockCall.getIntentExtras()).thenReturn(callExtras);
when(mMockCall.isExternalCall()).thenReturn(false);
@@ -761,6 +769,7 @@
when(mMockCallsManager.getAudioState()).thenReturn(null);
when(mMockCallsManager.canAddCall()).thenReturn(false);
when(mMockCall.isIncoming()).thenReturn(false);
+ when(mMockCall.getAssociatedUser()).thenReturn(mUserHandle);
when(mMockCall.getTargetPhoneAccount()).thenReturn(PA_HANDLE);
when(mMockCall.getIntentExtras()).thenReturn(callExtras);
when(mMockCall.isExternalCall()).thenReturn(false);
@@ -841,6 +850,7 @@
when(mMockCallsManager.isInEmergencyCall()).thenReturn(false);
when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
when(mMockCall.isIncoming()).thenReturn(false);
+ when(mMockCall.getAssociatedUser()).thenReturn(mUserHandle);
when(mMockCall.isExternalCall()).thenReturn(false);
when(mMockCall.getTargetPhoneAccount()).thenReturn(PA_HANDLE);
when(mMockCallsManager.getCurrentUserHandle()).thenReturn(mUserHandle);
@@ -953,6 +963,7 @@
when(mMockCall.getTargetPhoneAccount()).thenReturn(PA_HANDLE);
when(mMockCall.getIntentExtras()).thenReturn(callExtras);
when(mMockCall.isExternalCall()).thenReturn(false);
+ when(mMockCall.getAssociatedUser()).thenReturn(mUserHandle);
when(mDefaultDialerCache.getDefaultDialerApplication(CURRENT_USER_ID))
.thenReturn(DEF_PKG);
ArgumentCaptor<ServiceConnection> serviceConnectionCaptor =
@@ -1059,6 +1070,7 @@
.thenReturn(mMockUserManager);
when(mMockUserManager.isQuietModeEnabled(any(UserHandle.class))).thenReturn(false);
when(mMockCall.isIncoming()).thenReturn(false);
+ when(mMockCall.getAssociatedUser()).thenReturn(mUserHandle);
when(mMockCall.getTargetPhoneAccount()).thenReturn(PA_HANDLE);
when(mMockCall.getIntentExtras()).thenReturn(callExtras);
when(mMockCall.isExternalCall()).thenReturn(false);
@@ -1510,6 +1522,7 @@
when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
when(mMockCallsManager.isInEmergencyCall()).thenReturn(false);
when(mMockCall.isIncoming()).thenReturn(false);
+ when(mMockCall.getAssociatedUser()).thenReturn(mUserHandle);
when(mMockCall.isExternalCall()).thenReturn(false);
when(mMockCall.getTargetPhoneAccount()).thenReturn(PA_HANDLE);
when(mDefaultDialerCache.getDefaultDialerApplication(CURRENT_USER_ID)).thenReturn(DEF_PKG);
@@ -1744,6 +1757,56 @@
eq(UserHandle.CURRENT));
}
+ @Test
+ public void testGetUserFromCall_TargetPhoneAccountNotSet() throws Exception {
+ setupMocks(false /* isExternalCall */);
+ setupMockPackageManager(true /* default */, true /* system */, false /* external calls */);
+ UserHandle testUser = new UserHandle(10);
+
+ when(mMockCall.getTargetPhoneAccount()).thenReturn(null);
+ when(mMockCall.getAssociatedUser()).thenReturn(testUser);
+
+ // Bind to ICS. The mapping should've been inserted with the testUser as the key.
+ mInCallController.bindToServices(mMockCall);
+ assertTrue(mInCallController.getInCallServiceConnections().containsKey(testUser));
+
+ // Set the target phone account. Simulates the flow when the user has chosen which sim to
+ // place the call on.
+ when(mMockCall.getTargetPhoneAccount()).thenReturn(PA_HANDLE);
+
+ // Remove the call. This invokes getUserFromCall to remove the ICS mapping.
+ when(mMockCallsManager.getCalls()).thenReturn(Collections.emptyList());
+ mInCallController.onCallRemoved(mMockCall);
+ waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);
+
+ // Verify that the mapping was properly removed.
+ assertNull(mInCallController.getInCallServiceConnections().get(testUser));
+ }
+
+ @Test
+ public void testGetUserFromCall_IncomingCall() throws Exception {
+ setupMocks(false /* isExternalCall */);
+ setupMockPackageManager(true /* default */, true /* system */, false /* external calls */);
+ // Explicitly test on a different user to avoid interference with current user.
+ UserHandle testUser = new UserHandle(10);
+
+ // Set user handle in target phone account to test user
+ when(mMockCall.getAssociatedUser()).thenReturn(testUser);
+ when(mMockCall.isIncoming()).thenReturn(true);
+
+ // Bind to ICS. The mapping should've been inserted with the testUser as the key.
+ mInCallController.bindToServices(mMockCall);
+ assertTrue(mInCallController.getInCallServiceConnections().containsKey(testUser));
+
+ // Remove the call. This invokes getUserFromCall to remove the ICS mapping.
+ when(mMockCallsManager.getCalls()).thenReturn(Collections.emptyList());
+ mInCallController.onCallRemoved(mMockCall);
+ waitForHandlerAction(new Handler(Looper.getMainLooper()), TEST_TIMEOUT);
+
+ // Verify that the mapping was properly removed.
+ assertNull(mInCallController.getInCallServiceConnections().get(testUser));
+ }
+
private void setupMocksForWorkProfileTest() {
when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
when(mMockCallsManager.isInEmergencyCall()).thenReturn(false);
@@ -1761,7 +1824,7 @@
when(mMockChildUserInfo.getUserHandle()).thenReturn(mChildUserHandle);
when(mMockUserInfo.isManagedProfile()).thenReturn(false);
when(mMockChildUserInfo.isManagedProfile()).thenReturn(true);
- when(mMockChildUserCall.getUserHandleFromTargetPhoneAccount()).thenReturn(mChildUserHandle);
+ when(mMockChildUserCall.getAssociatedUser()).thenReturn(mChildUserHandle);
when(mMockCallsManager.getCurrentUserHandle()).thenReturn(mChildUserHandle);
when(mMockUserManager.getProfileParent(mChildUserHandle.getIdentifier())).thenReturn(
mMockUserInfo);
@@ -1804,7 +1867,6 @@
//check if queryIntentServices was also called with parent user handle
assertTrue("no query parent user handle",
userIds.contains(mParentUserHandle.getIdentifier()));
-
}
private void setupMocks(boolean isExternalCall) {
@@ -1816,6 +1878,7 @@
when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
when(mMockCallsManager.isInEmergencyCall()).thenReturn(false);
when(mMockCall.isIncoming()).thenReturn(false);
+ when(mMockCall.getAssociatedUser()).thenReturn(mUserHandle);
when(mMockCall.getTargetPhoneAccount()).thenReturn(PA_HANDLE);
when(mDefaultDialerCache.getDefaultDialerApplication(CURRENT_USER_ID)).thenReturn(DEF_PKG);
when(mMockContext.bindServiceAsUser(any(Intent.class), any(ServiceConnection.class),
diff --git a/tests/src/com/android/server/telecom/tests/IncomingCallNotifierTest.java b/tests/src/com/android/server/telecom/tests/IncomingCallNotifierTest.java
index a38de94..914fdc5 100644
--- a/tests/src/com/android/server/telecom/tests/IncomingCallNotifierTest.java
+++ b/tests/src/com/android/server/telecom/tests/IncomingCallNotifierTest.java
@@ -75,7 +75,7 @@
when(mAudioCall.getVideoState()).thenReturn(VideoProfile.STATE_AUDIO_ONLY);
when(mAudioCall.getTargetPhoneAccountLabel()).thenReturn("Bar");
- when(mAudioCall.getUserHandleFromTargetPhoneAccount()).
+ when(mAudioCall.getAssociatedUser()).
thenReturn(UserHandle.CURRENT);
when(mVideoCall.getVideoState()).thenReturn(VideoProfile.STATE_BIDIRECTIONAL);
when(mVideoCall.getTargetPhoneAccountLabel()).thenReturn("Bar");
@@ -84,7 +84,7 @@
when(mRingingCall.getState()).thenReturn(CallState.RINGING);
when(mRingingCall.getVideoState()).thenReturn(VideoProfile.STATE_AUDIO_ONLY);
when(mRingingCall.getTargetPhoneAccountLabel()).thenReturn("Foo");
- when(mRingingCall.getUserHandleFromTargetPhoneAccount()).
+ when(mRingingCall.getAssociatedUser()).
thenReturn(UserHandle.CURRENT);
when(mRingingCall.getHandoverState()).thenReturn(HandoverState.HANDOVER_NONE);
}
diff --git a/tests/src/com/android/server/telecom/tests/MissedInformationTest.java b/tests/src/com/android/server/telecom/tests/MissedInformationTest.java
index 8ea2739..4af3de3 100644
--- a/tests/src/com/android/server/telecom/tests/MissedInformationTest.java
+++ b/tests/src/com/android/server/telecom/tests/MissedInformationTest.java
@@ -150,7 +150,7 @@
public void testEmergencyCallPlacing() throws Exception {
Analytics.dumpToParcelableAnalytics();
setUpEmergencyCall();
- when(mEmergencyCall.getUserHandleFromTargetPhoneAccount()).
+ when(mEmergencyCall.getAssociatedUser()).
thenReturn(mPhoneAccountA0.getAccountHandle().getUserHandle());
mCallsManager.addCall(mEmergencyCall);
assertTrue(mCallsManager.isInEmergencyCall());
diff --git a/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java b/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java
index f2bcf18..33acd98 100644
--- a/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java
+++ b/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java
@@ -101,7 +101,7 @@
@Before
public void setUp() throws Exception {
super.setUp();
- when(mCall.getInitiatingUser()).thenReturn(UserHandle.CURRENT);
+ when(mCall.getAssociatedUser()).thenReturn(UserHandle.CURRENT);
when(mCallsManager.getLock()).thenReturn(new TelecomSystem.SyncRoot() { });
when(mCallsManager.getSystemStateHelper()).thenReturn(mSystemStateHelper);
when(mCallsManager.getCurrentUserHandle()).thenReturn(mUserHandle);
diff --git a/tests/src/com/android/server/telecom/tests/RingerTest.java b/tests/src/com/android/server/telecom/tests/RingerTest.java
index a02415c..a4adf77 100644
--- a/tests/src/com/android/server/telecom/tests/RingerTest.java
+++ b/tests/src/com/android/server/telecom/tests/RingerTest.java
@@ -123,8 +123,8 @@
when(mockRingtoneFactory.hasHapticChannels(any(Ringtone.class))).thenReturn(false);
when(mockCall1.getState()).thenReturn(CallState.RINGING);
when(mockCall2.getState()).thenReturn(CallState.RINGING);
- when(mockCall1.getUserHandleFromTargetPhoneAccount()).thenReturn(PA_HANDLE.getUserHandle());
- when(mockCall2.getUserHandleFromTargetPhoneAccount()).thenReturn(PA_HANDLE.getUserHandle());
+ when(mockCall1.getAssociatedUser()).thenReturn(PA_HANDLE.getUserHandle());
+ when(mockCall2.getAssociatedUser()).thenReturn(PA_HANDLE.getUserHandle());
createRingerUnderTest();
}