Support notion of ECBM for work profiles.
When we have all sims assigned to the work profile and the profile is
paused, the admin would not be able to place or receive any calls going
through those sims. However, when the primary user needs to place a MO
emergency call, we allow them to use the work sim for this boundary
case.
Consequently, this enables ECBM for that sim where any MT non-emergency
calls during the 5 minute period should not be rejected. If the work
profile is disabled, the call needs to be accepted by the primary
profile. EmergencyCallHelper already defines a notion of determining if
we're in ECBM but it's also being tracked for MT emergency calls and is
simply passing it up into ConnectionRequest. Instead, I've added in
logic to keep track of the last MO emergency call while keeping the old
logic intact. This is being leveraged in
CallsManager#processIncomingCallIntent to determine if the phone account
for the incoming call is currrently in ECBM, which would allow the call
to go through to the primary user instead of failing. Note that MO
non-emergency calls should still be rejected.
The logic in InCallController where we determine the user to use in
binding to the ICS needs to be modified to ensure we bind to the
CURRENT_USER (aka primary user) when the work profile is disabled and we
are in ECBM mode. Note that that MO emergency calls will never reach
this line of logic as they would be rejected in the phone account
selection phase so we can ensure that this is scoped to MT calls.
Fixes: 279200068
Test: Manual with work profile enabled to ensure MT/MO emergency calls
and non-emergency calls are routed to work profile dialer.
Test: Manual with work profile disabled to ensure MT non-emergency calls
are rejected when ECBM isn't enabled and allowed when it is
enabled for the 5 minute time period.
Test: Unit tests to ensure we reject the MT non-emergency calls when
ECBM isn't enabled and accept when it is. Addded a test to
ensure the binding to the ICS occurs on the CURRENT_USER.
Change-Id: I4bbcd6a70cbdc206b829af68139fb6a8e218dd43
7 files changed