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

Commit cf210329 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Ensure self-managed calls do not use work profile initiator fix.

Test: Used work profile test app to reproduce problem.  Confirmed fix
corrects that issue.
Bug: 70895643

Change-Id: Ifd51d3d16c7d35734711ac143d66d1813b68adc3
parent 4832f208
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -127,11 +127,18 @@ public class CallIntentProcessor {
                VideoProfile.STATE_AUDIO_ONLY);
        clientExtras.putInt(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, videoState);

        if (!callsManager.isSelfManaged(phoneAccountHandle,
                (UserHandle) intent.getParcelableExtra(KEY_INITIATING_USER))) {
            boolean fixedInitiatingUser = fixInitiatingUserIfNecessary(context, intent);
        // Show the toast to warn user that it is a personal call though initiated in work profile.
            // Show the toast to warn user that it is a personal call though initiated in work
            // profile.
            if (fixedInitiatingUser) {
                Toast.makeText(context, R.string.toast_personal_call_msg, Toast.LENGTH_LONG).show();
            }
        } else {
            Log.i(CallIntentProcessor.class,
                    "processOutgoingCallIntent: skip initiating user check");
        }

        UserHandle initiatingUser = intent.getParcelableExtra(KEY_INITIATING_USER);

@@ -182,6 +189,9 @@ public class CallIntentProcessor {
                        userManager.getProfileParent(
                                initiatingUser.getIdentifier()).getUserHandle();
                intent.putExtra(KEY_INITIATING_USER, parentUserHandle);

                Log.i(CallIntentProcessor.class, "fixInitiatingUserIfNecessary: no dialer installed"
                        + " for current user; setting initiator to parent %s" + parentUserHandle);
                return true;
            }
        }
+7 −1
Original line number Diff line number Diff line
@@ -1293,7 +1293,13 @@ public class CallsManager extends Call.ListenerBase
        return accounts;
    }

    private boolean isSelfManaged(PhoneAccountHandle targetPhoneAccountHandle,
    /**
     * Determines if a {@link PhoneAccountHandle} is for a self-managed ConnectionService.
     * @param targetPhoneAccountHandle The phone account to check.
     * @param initiatingUser The user associated with the account.
     * @return {@code true} if the phone account is self-managed, {@code false} otherwise.
     */
    public boolean isSelfManaged(PhoneAccountHandle targetPhoneAccountHandle,
            UserHandle initiatingUser) {
        PhoneAccount targetPhoneAccount = mPhoneAccountRegistrar.getPhoneAccount(
                targetPhoneAccountHandle, initiatingUser);