Use TelecomManager.isInCall instead of TelephonyManager.getCallState

UserManager.canSwitchUsers and UserManager.getUserSwitchability were
using the deprecated method TelephonyManager.getCallState and
comparing the result with TelephonyManager.CALL_STATE_IDLE to findout
whether there is an ongoing telephone call. This CL changes those
methods to use a helper method, which calls TelecomManager.isInCall
instead of the deprecated one.

Also UserInteractor.canSwitchUsers was sometimes failing with a
SecurityException during a user switch and crashing the systemui
process, causing it to restart after the user switch. This change
also saves the user switch flow from the underlying problem.

Bug: 257538981
Test: atest UserManagerTest
Change-Id: I378527db7decc170d385f0f1d89235b6f02649e6
1 file changed