Merge "Import translations. DO NOT MERGE ANYWHERE" into udc-qpr-dev
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 4d2f273..77570c3 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -1572,7 +1572,14 @@
// Check if the target phone account is possibly in ECBM.
call.setIsInECBM(getEmergencyCallHelper()
.isLastOutgoingEmergencyCallPAH(call.getTargetPhoneAccount()));
- if (mUserManager.isQuietModeEnabled(call.getAssociatedUser())
+ // If the phone account user profile is paused or the call isn't visible to the secondary/
+ // guest user, reject the non-emergency incoming call. When the current user is the admin,
+ // we need to allow the calls to go through if the work profile isn't paused. We should
+ // always allow emergency calls and also allow non-emergency calls when ECBM is active for
+ // the phone account.
+ if ((mUserManager.isQuietModeEnabled(call.getAssociatedUser())
+ || (!mUserManager.isUserAdmin(mCurrentUserHandle.getIdentifier())
+ && !isCallVisibleForUser(call, mCurrentUserHandle)))
&& !call.isEmergencyCall() && !call.isInECBM()) {
Log.d(TAG, "Rejecting non-emergency call because the owner %s is not running.",
phoneAccountHandle.getUserHandle());
diff --git a/src/com/android/server/telecom/HeadsetMediaButton.java b/src/com/android/server/telecom/HeadsetMediaButton.java
index 8e9caff..7458f54 100644
--- a/src/com/android/server/telecom/HeadsetMediaButton.java
+++ b/src/com/android/server/telecom/HeadsetMediaButton.java
@@ -23,16 +23,11 @@
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
-import android.telecom.CallAudioState;
-import android.telecom.CallEndpoint;
import android.telecom.Log;
-import android.util.ArraySet;
import android.view.KeyEvent;
import com.android.internal.annotations.VisibleForTesting;
-import java.util.Set;
-
/**
* Static class to handle listening to the headset media buttons.
*/
@@ -154,10 +149,8 @@
private final Context mContext;
private final CallsManager mCallsManager;
private final TelecomSystem.SyncRoot mLock;
- private final Set<Call> mCalls = new ArraySet<>();
private MediaSessionAdapter mSession;
private KeyEvent mLastHookEvent;
- private @CallEndpoint.EndpointType int mCurrentEndpointType;
/**
* Constructor used for testing purposes to initialize a {@link HeadsetMediaButton} with a
@@ -219,7 +212,7 @@
return mCallsManager.onMediaButton(LONG_PRESS);
} else if (event.getAction() == KeyEvent.ACTION_UP) {
// We should not judge SHORT_PRESS by ACTION_UP event repeatCount, because it always
- // returns 0.
+ // return 0.
// Actually ACTION_DOWN event repeatCount only increases when LONG_PRESS performed.
if (mLastHookEvent != null && mLastHookEvent.getRepeatCount() == 0) {
return mCallsManager.onMediaButton(SHORT_PRESS);
@@ -233,70 +226,50 @@
return true;
}
- @Override
- public void onCallEndpointChanged(CallEndpoint callEndpoint) {
- mCurrentEndpointType = callEndpoint.getEndpointType();
- Log.i(this, "onCallEndpointChanged: endPoint=%s", callEndpoint);
- maybeChangeSessionState();
- }
-
/** ${inheritDoc} */
@Override
public void onCallAdded(Call call) {
- handleCallAddition(call);
+ if (call.isExternalCall()) {
+ return;
+ }
+ handleCallAddition();
}
/**
* Triggers session activation due to call addition.
*/
- private void handleCallAddition(Call call) {
- mCalls.add(call);
- maybeChangeSessionState();
+ private void handleCallAddition() {
+ mMediaSessionHandler.obtainMessage(MSG_MEDIA_SESSION_SET_ACTIVE, 1, 0).sendToTarget();
+ }
+
+ /** ${inheritDoc} */
+ @Override
+ public void onCallRemoved(Call call) {
+ if (call.isExternalCall()) {
+ return;
+ }
+ handleCallRemoval();
}
/**
- * Based on whether there are tracked calls and the audio is routed to a wired headset,
- * potentially activate or deactive the media session.
+ * Triggers session deactivation due to call removal.
*/
- private void maybeChangeSessionState() {
- boolean hasNonExternalCalls = !mCalls.isEmpty()
- && mCalls.stream().anyMatch(c -> !c.isExternalCall());
- if (hasNonExternalCalls && mCurrentEndpointType == CallEndpoint.TYPE_WIRED_HEADSET) {
- Log.i(this, "maybeChangeSessionState: hasCalls=%b, currentEndpointType=%s, ACTIVATE",
- hasNonExternalCalls, CallEndpoint.endpointTypeToString(mCurrentEndpointType));
- mMediaSessionHandler.obtainMessage(MSG_MEDIA_SESSION_SET_ACTIVE, 1, 0).sendToTarget();
- } else {
- Log.i(this, "maybeChangeSessionState: hasCalls=%b, currentEndpointType=%s, DEACTIVATE",
- hasNonExternalCalls, CallEndpoint.endpointTypeToString(mCurrentEndpointType));
+ private void handleCallRemoval() {
+ if (!mCallsManager.hasAnyCalls()) {
mMediaSessionHandler.obtainMessage(MSG_MEDIA_SESSION_SET_ACTIVE, 0, 0).sendToTarget();
}
}
/** ${inheritDoc} */
@Override
- public void onCallRemoved(Call call) {
- handleCallRemoval(call);
- }
-
- /**
- * Triggers session deactivation due to call removal.
- */
- private void handleCallRemoval(Call call) {
- // If we were tracking the call, potentially change session state.
- if (mCalls.remove(call)) {
- if (mCalls.isEmpty()) {
- // When there are no calls, don't cache that we previously had a wired headset
- // connected; we'll be updated on the next call.
- mCurrentEndpointType = CallEndpoint.TYPE_UNKNOWN;
- }
- maybeChangeSessionState();
- }
- }
-
- /** ${inheritDoc} */
- @Override
public void onExternalCallChanged(Call call, boolean isExternalCall) {
- maybeChangeSessionState();
+ // Note: We don't use the onCallAdded/onCallRemoved methods here since they do checks to see
+ // if the call is external or not and would skip the session activation/deactivation.
+ if (isExternalCall) {
+ handleCallRemoval();
+ } else {
+ handleCallAddition();
+ }
}
@VisibleForTesting
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index 8e10614..d5689ae 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -2875,7 +2875,11 @@
// 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.
if ((call.isEmergencyCall() || call.isInECBM())
- && userManager.isQuietModeEnabled(userFromCall)) {
+ && (userManager.isQuietModeEnabled(userFromCall)
+ // We should also account for secondary/guest users where the profile may not
+ // necessarily be paused.
+ || !userManager.isUserAdmin(mCallsManager.getCurrentUserHandle()
+ .getIdentifier()))) {
return mCallsManager.getCurrentUserHandle();
}
return userFromCall;
diff --git a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
index c42a2ca..9f46336 100644
--- a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
@@ -174,6 +174,8 @@
ComponentName.unflattenFromString("com.baz/.Self"), "Self");
private static final PhoneAccountHandle SELF_MANAGED_2_HANDLE = new PhoneAccountHandle(
ComponentName.unflattenFromString("com.baz/.Self2"), "Self2");
+ private static final PhoneAccountHandle WORK_HANDLE = new PhoneAccountHandle(
+ ComponentName.unflattenFromString("com.foo/.Blah"), "work", new UserHandle(10));
private static final PhoneAccountHandle SELF_MANAGED_W_CUSTOM_HANDLE = new PhoneAccountHandle(
new ComponentName(TEST_PACKAGE_NAME, "class"), "1", TEST_USER_HANDLE);
private static final PhoneAccount SIM_1_ACCOUNT = new PhoneAccount.Builder(SIM_1_HANDLE, "Sim1")
@@ -205,11 +207,19 @@
.setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED)
.setIsEnabled(true)
.build();
+ private static final PhoneAccount WORK_ACCOUNT = new PhoneAccount.Builder(
+ WORK_HANDLE, "work")
+ .setCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION
+ | PhoneAccount.CAPABILITY_CALL_PROVIDER
+ | PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS)
+ .setIsEnabled(true)
+ .build();
private static final PhoneAccount SM_W_DIFFERENT_PACKAGE_AND_USER = new PhoneAccount.Builder(
SELF_MANAGED_W_CUSTOM_HANDLE, "Self")
.setCapabilities(PhoneAccount.CAPABILITY_SELF_MANAGED)
.setIsEnabled(true)
.build();
+
private static final Uri TEST_ADDRESS = Uri.parse("tel:555-1212");
private static final Uri TEST_ADDRESS2 = Uri.parse("tel:555-1213");
private static final Uri TEST_ADDRESS3 = Uri.parse("tel:555-1214");
@@ -346,6 +356,8 @@
eq(SIM_1_HANDLE), any())).thenReturn(SIM_1_ACCOUNT);
when(mPhoneAccountRegistrar.getPhoneAccount(
eq(SIM_2_HANDLE), any())).thenReturn(SIM_2_ACCOUNT);
+ when(mPhoneAccountRegistrar.getPhoneAccount(
+ eq(WORK_HANDLE), any())).thenReturn(WORK_ACCOUNT);
when(mToastFactory.makeText(any(), anyInt(), anyInt())).thenReturn(mToast);
when(mToastFactory.makeText(any(), any(), anyInt())).thenReturn(mToast);
}
@@ -2490,7 +2502,30 @@
@SmallTest
@Test
- public void testRejectIncomingCallOnPAHInactive() throws Exception {
+ public void testRejectIncomingCallOnPAHInactive_SecondaryUser() throws Exception {
+ ConnectionServiceWrapper service = mock(ConnectionServiceWrapper.class);
+ doReturn(WORK_HANDLE.getComponentName()).when(service).getComponentName();
+ mCallsManager.addConnectionServiceRepositoryCache(WORK_HANDLE.getComponentName(),
+ WORK_HANDLE.getUserHandle(), service);
+
+ UserManager um = mContext.getSystemService(UserManager.class);
+ UserHandle newUser = new UserHandle(11);
+ when(mCallsManager.getCurrentUserHandle()).thenReturn(newUser);
+ when(um.isUserAdmin(eq(newUser.getIdentifier()))).thenReturn(false);
+ when(um.isQuietModeEnabled(eq(WORK_HANDLE.getUserHandle()))).thenReturn(false);
+ when(mPhoneAccountRegistrar.getPhoneAccountUnchecked(eq(WORK_HANDLE)))
+ .thenReturn(WORK_ACCOUNT);
+ Call newCall = mCallsManager.processIncomingCallIntent(
+ WORK_HANDLE, new Bundle(), false);
+
+ verify(service, timeout(TEST_TIMEOUT)).createConnectionFailed(any());
+ assertFalse(newCall.isInECBM());
+ assertEquals(USER_MISSED_NOT_RUNNING, newCall.getMissedReason());
+ }
+
+ @SmallTest
+ @Test
+ public void testRejectIncomingCallOnPAHInactive_ProfilePaused() throws Exception {
ConnectionServiceWrapper service = mock(ConnectionServiceWrapper.class);
doReturn(SIM_2_HANDLE.getComponentName()).when(service).getComponentName();
mCallsManager.addConnectionServiceRepositoryCache(SIM_2_HANDLE.getComponentName(),
@@ -2527,6 +2562,30 @@
@SmallTest
@Test
+ public void testAcceptIncomingCallOnPAHInactiveAndECBMActive_SecondaryUser() throws Exception {
+ ConnectionServiceWrapper service = mock(ConnectionServiceWrapper.class);
+ doReturn(WORK_HANDLE.getComponentName()).when(service).getComponentName();
+ mCallsManager.addConnectionServiceRepositoryCache(SIM_2_HANDLE.getComponentName(),
+ WORK_HANDLE.getUserHandle(), service);
+
+ when(mEmergencyCallHelper.isLastOutgoingEmergencyCallPAH(eq(WORK_HANDLE)))
+ .thenReturn(true);
+ UserManager um = mContext.getSystemService(UserManager.class);
+ UserHandle newUser = new UserHandle(11);
+ when(mCallsManager.getCurrentUserHandle()).thenReturn(newUser);
+ when(um.isUserAdmin(eq(newUser.getIdentifier()))).thenReturn(false);
+ when(um.isQuietModeEnabled(eq(WORK_HANDLE.getUserHandle()))).thenReturn(false);
+ when(mPhoneAccountRegistrar.getPhoneAccountUnchecked(eq(WORK_HANDLE)))
+ .thenReturn(WORK_ACCOUNT);
+ Call newCall = mCallsManager.processIncomingCallIntent(
+ WORK_HANDLE, new Bundle(), false);
+
+ assertTrue(newCall.isInECBM());
+ verify(service, timeout(TEST_TIMEOUT).times(0)).createConnectionFailed(any());
+ }
+
+ @SmallTest
+ @Test
public void testAcceptIncomingEmergencyCallOnPAHInactive() throws Exception {
ConnectionServiceWrapper service = mock(ConnectionServiceWrapper.class);
doReturn(SIM_2_HANDLE.getComponentName()).when(service).getComponentName();
@@ -3100,6 +3159,9 @@
// WHEN
when(mPhoneAccountRegistrar.getPhoneAccountUnchecked(any()))
.thenReturn(SM_W_DIFFERENT_PACKAGE_AND_USER);
+ UserManager um = mContext.getSystemService(UserManager.class);
+ when(um.isUserAdmin(eq(mCallsManager.getCurrentUserHandle().getIdentifier())))
+ .thenReturn(true);
// THEN
mCallsManager.processIncomingCallIntent(SELF_MANAGED_W_CUSTOM_HANDLE, new Bundle(), false);
diff --git a/tests/src/com/android/server/telecom/tests/HeadsetMediaButtonTest.java b/tests/src/com/android/server/telecom/tests/HeadsetMediaButtonTest.java
index ce23724..0bfa987 100644
--- a/tests/src/com/android/server/telecom/tests/HeadsetMediaButtonTest.java
+++ b/tests/src/com/android/server/telecom/tests/HeadsetMediaButtonTest.java
@@ -18,7 +18,6 @@
import android.content.Intent;
import android.media.session.MediaSession;
-import android.telecom.CallEndpoint;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import android.view.KeyEvent;
@@ -81,7 +80,7 @@
}
/**
- * Nominal case; just add a call and remove it; this happens when the audio state is earpiece.
+ * Nominal case; just add a call and remove it.
*/
@SmallTest
@Test
@@ -91,95 +90,14 @@
when(mMockCallsManager.hasAnyCalls()).thenReturn(true);
mHeadsetMediaButton.onCallAdded(regularCall);
waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
- verify(mMediaSessionAdapter, never()).setActive(eq(true));
-
- // Report that the endpoint is earpiece and other routes that don't matter
- mHeadsetMediaButton.onCallEndpointChanged(
- new CallEndpoint("Earpiece", CallEndpoint.TYPE_EARPIECE));
- mHeadsetMediaButton.onCallEndpointChanged(
- new CallEndpoint("Speaker", CallEndpoint.TYPE_SPEAKER));
- mHeadsetMediaButton.onCallEndpointChanged(
- new CallEndpoint("BT", CallEndpoint.TYPE_BLUETOOTH));
- waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
- verify(mMediaSessionAdapter, never()).setActive(eq(true));
-
- // ... and thus we see how the original code isn't amenable to tests.
- when(mMediaSessionAdapter.isActive()).thenReturn(false);
-
- // Still should not have done anything; we never hit wired headset
- mHeadsetMediaButton.onCallRemoved(regularCall);
- waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
- verify(mMediaSessionAdapter, never()).setActive(eq(false));
- }
-
- /**
- * Call is added and then routed to headset after call start
- */
- @SmallTest
- @Test
- public void testAddCallThenRouteToHeadset() {
- Call regularCall = getRegularCall();
-
- mHeadsetMediaButton.onCallAdded(regularCall);
- waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
- verify(mMediaSessionAdapter, never()).setActive(eq(true));
-
- mHeadsetMediaButton.onCallEndpointChanged(
- new CallEndpoint("Wired Headset", CallEndpoint.TYPE_WIRED_HEADSET));
- waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
verify(mMediaSessionAdapter).setActive(eq(true));
-
// ... and thus we see how the original code isn't amenable to tests.
when(mMediaSessionAdapter.isActive()).thenReturn(true);
- // Remove the one call; we should release the session.
+ when(mMockCallsManager.hasAnyCalls()).thenReturn(false);
mHeadsetMediaButton.onCallRemoved(regularCall);
waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
verify(mMediaSessionAdapter).setActive(eq(false));
- when(mMediaSessionAdapter.isActive()).thenReturn(false);
-
- // Add a new call; make sure we go active once more.
- mHeadsetMediaButton.onCallAdded(regularCall);
- mHeadsetMediaButton.onCallEndpointChanged(
- new CallEndpoint("Wired Headset", CallEndpoint.TYPE_WIRED_HEADSET));
- waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
- verify(mMediaSessionAdapter, times(2)).setActive(eq(true));
- }
-
- /**
- * Call is added and then routed to headset after call start
- */
- @SmallTest
- @Test
- public void testAddCallThenRouteToHeadsetAndBack() {
- Call regularCall = getRegularCall();
-
- when(mMockCallsManager.hasAnyCalls()).thenReturn(true);
- mHeadsetMediaButton.onCallAdded(regularCall);
- waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
- verify(mMediaSessionAdapter, never()).setActive(eq(true));
-
- mHeadsetMediaButton.onCallEndpointChanged(
- new CallEndpoint("Wired Headset", CallEndpoint.TYPE_WIRED_HEADSET));
- waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
- verify(mMediaSessionAdapter).setActive(eq(true));
-
- // ... and thus we see how the original code isn't amenable to tests.
- when(mMediaSessionAdapter.isActive()).thenReturn(true);
-
- mHeadsetMediaButton.onCallEndpointChanged(
- new CallEndpoint("Earpiece", CallEndpoint.TYPE_EARPIECE));
- waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
- verify(mMediaSessionAdapter).setActive(eq(false));
- when(mMediaSessionAdapter.isActive()).thenReturn(false);
-
- // Remove the one call; we should not release again.
- mHeadsetMediaButton.onCallRemoved(regularCall);
- waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
- // Remember, mockito counts total invocations; we should have went active once and then
- // inactive again when we hit earpiece.
- verify(mMediaSessionAdapter, times(1)).setActive(eq(true));
- verify(mMediaSessionAdapter, times(1)).setActive(eq(false));
}
/**
@@ -193,8 +111,6 @@
// Start with a regular old call.
when(mMockCallsManager.hasAnyCalls()).thenReturn(true);
mHeadsetMediaButton.onCallAdded(regularCall);
- mHeadsetMediaButton.onCallEndpointChanged(
- new CallEndpoint("Wired Headset", CallEndpoint.TYPE_WIRED_HEADSET));
waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
verify(mMediaSessionAdapter).setActive(eq(true));
when(mMediaSessionAdapter.isActive()).thenReturn(true);
@@ -206,7 +122,6 @@
// Expect to set session inactive.
waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
verify(mMediaSessionAdapter).setActive(eq(false));
- when(mMediaSessionAdapter.isActive()).thenReturn(false);
// For good measure lets make it non-external again.
when(regularCall.isExternalCall()).thenReturn(false);
@@ -214,7 +129,7 @@
mHeadsetMediaButton.onExternalCallChanged(regularCall, false);
// Expect to set session active.
waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
- verify(mMediaSessionAdapter, times(2)).setActive(eq(true));
+ verify(mMediaSessionAdapter).setActive(eq(true));
}
@MediumTest
@@ -224,8 +139,6 @@
when(externalCall.isExternalCall()).thenReturn(true);
mHeadsetMediaButton.onCallAdded(externalCall);
- mHeadsetMediaButton.onCallEndpointChanged(
- new CallEndpoint("Wired Headset", CallEndpoint.TYPE_WIRED_HEADSET));
waitForHandlerAction(mHeadsetMediaButton.getHandler(), TEST_TIMEOUT_MILLIS);
verify(mMediaSessionAdapter, never()).setActive(eq(true));
diff --git a/tests/src/com/android/server/telecom/tests/InCallControllerTests.java b/tests/src/com/android/server/telecom/tests/InCallControllerTests.java
index 2f3e4bf..683a5e2 100644
--- a/tests/src/com/android/server/telecom/tests/InCallControllerTests.java
+++ b/tests/src/com/android/server/telecom/tests/InCallControllerTests.java
@@ -638,6 +638,37 @@
@MediumTest
@Test
public void
+ testBindToService_UserAssociatedWithCallSecondary_NonEmergCallECBM_BindsToSecondaryUser()
+ throws Exception {
+ UserHandle newUser = new UserHandle(13);
+ when(mMockCallsManager.getCurrentUserHandle()).thenReturn(newUser);
+ when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
+ when(mMockCall.isEmergencyCall()).thenReturn(false);
+ when(mMockCall.isInECBM()).thenReturn(true);
+ 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(false);
+ when(mMockUserManager.isUserAdmin(anyInt())).thenReturn(false);
+ setupMockPackageManager(true /* default */, true /* system */, false /* external calls */);
+ setupMockPackageManagerLocationPermission(SYS_PKG, false /* granted */);
+
+ mInCallController.bindToServices(mMockCall);
+
+ ArgumentCaptor<Intent> bindIntentCaptor = ArgumentCaptor.forClass(Intent.class);
+ verify(mMockContext, times(1)).bindServiceAsUser(
+ bindIntentCaptor.capture(),
+ any(ServiceConnection.class),
+ eq(serviceBindingFlags),
+ eq(newUser));
+ Intent bindIntent = bindIntentCaptor.getValue();
+ assertEquals(InCallService.SERVICE_INTERFACE, bindIntent.getAction());
+ }
+
+ @MediumTest
+ @Test
+ public void
testBindToService_UserAssociatedWithCallNotInQuietMode_EmergCallInCallUi_BindsToAssociatedUser()
throws Exception {
when(mMockCallsManager.getCurrentUserHandle()).thenReturn(mUserHandle);
@@ -647,6 +678,7 @@
when(mMockContext.getSystemService(eq(UserManager.class)))
.thenReturn(mMockUserManager);
when(mMockUserManager.isQuietModeEnabled(any(UserHandle.class))).thenReturn(false);
+ when(mMockUserManager.isUserAdmin(anyInt())).thenReturn(true);
setupMockPackageManager(true /* default */, true /* system */, false /* external calls */);
setupMockPackageManagerLocationPermission(SYS_PKG, false /* granted */);