Update InCallController to support work profiles.
Allow work profiles to place/receive calls using the associated dialer app. The existing code will use the primary profile to query the potential apps to connect to. Instead, we can get the right user from the phone account that is stored in the call. Allow users with across user permission to access phone accounts from other users.
Bug: 255343995
Test: Manual, atest TelecomUnitTests, atest CtsTelecomTestCases
Change-Id: I555a3db44f39e932e7a376d2164d0b979493e213
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index f78a9b9..d58c211 100644
--- a/src/com/android/services/telephony/PstnIncomingCallNotifier.java
+++ b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
@@ -393,8 +393,9 @@
*/
private PhoneAccountHandle findCorrectPhoneAccountHandle() {
TelecomAccountRegistry telecomAccountRegistry = TelecomAccountRegistry.getInstance(null);
- // Check to see if a the SIM PhoneAccountHandle Exists for the Call.
- PhoneAccountHandle handle = PhoneUtils.makePstnPhoneAccountHandle(mPhone);
+ // Check to see if a SIM PhoneAccountHandle Exists for the Call.
+ PhoneAccountHandle handle = telecomAccountRegistry.getPhoneAccountHandleForSubId(
+ mPhone.getSubId());
if (telecomAccountRegistry.hasAccountEntryForPhoneAccount(handle)) {
return handle;
}