Merge "Clear caller identify before registering and unregistering phone acct."
diff --git a/src/com/android/server/telecom/InCallController.java b/src/com/android/server/telecom/InCallController.java
index f74dc42..169ebd7 100644
--- a/src/com/android/server/telecom/InCallController.java
+++ b/src/com/android/server/telecom/InCallController.java
@@ -212,7 +212,8 @@
return CONNECTION_SUCCEEDED;
}
- if (call.isSelfManaged() && !mInCallServiceInfo.isSelfManagedCallsSupported()) {
+ if (call != null && call.isSelfManaged() &&
+ !mInCallServiceInfo.isSelfManagedCallsSupported()) {
Log.i(this, "Skipping binding to %s - doesn't support self-mgd calls",
mInCallServiceInfo);
mIsConnected = false;
diff --git a/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java b/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java
index fb4c118..bbfc11e 100644
--- a/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java
+++ b/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java
@@ -466,22 +466,10 @@
if (shouldSucceed) {
assertFalse(didExceptionOccur);
verify(mFakePhoneAccountRegistrar).registerPhoneAccount(testPhoneAccount);
- verify(mContext).sendBroadcastAsUser(intentCaptor.capture(), eq(UserHandle.ALL),
- anyString());
-
- Intent capturedIntent = intentCaptor.getValue();
- assertEquals(TelecomManager.ACTION_PHONE_ACCOUNT_REGISTERED,
- capturedIntent.getAction());
- Bundle intentExtras = capturedIntent.getExtras();
- assertEquals(1, intentExtras.size());
- assertEquals(testPhoneAccount.getAccountHandle(),
- intentExtras.get(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE));
} else {
assertTrue(didExceptionOccur);
verify(mFakePhoneAccountRegistrar, never())
.registerPhoneAccount(any(PhoneAccount.class));
- verify(mContext, never())
- .sendBroadcastAsUser(any(Intent.class), any(UserHandle.class), anyString());
}
}
@@ -497,14 +485,6 @@
mTSIBinder.unregisterPhoneAccount(phHandle);
verify(mFakePhoneAccountRegistrar).unregisterPhoneAccount(phHandle);
- verify(mContext).sendBroadcastAsUser(intentCaptor.capture(), eq(UserHandle.ALL),
- anyString());
- Intent capturedIntent = intentCaptor.getValue();
- assertEquals(TelecomManager.ACTION_PHONE_ACCOUNT_UNREGISTERED,
- capturedIntent.getAction());
- Bundle intentExtras = capturedIntent.getExtras();
- assertEquals(1, intentExtras.size());
- assertEquals(phHandle, intentExtras.get(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE));
}
@SmallTest
diff --git a/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java b/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
index c7cb941..1c81fec 100644
--- a/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
+++ b/tests/src/com/android/server/telecom/tests/TelecomSystemTest.java
@@ -25,6 +25,7 @@
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isNull;
import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
@@ -311,6 +312,7 @@
super.setUp();
mSpyContext = mComponentContextFixture.getTestDouble().getApplicationContext();
doReturn(mSpyContext).when(mSpyContext).getApplicationContext();
+ doNothing().when(mSpyContext).sendBroadcastAsUser(any(), any(), any());
mNumOutgoingCallsMade = 0;