Merge "DSDA: Update managed call check" into main
diff --git a/src/com/android/server/telecom/Ringer.java b/src/com/android/server/telecom/Ringer.java
index d0fd201..5904689 100644
--- a/src/com/android/server/telecom/Ringer.java
+++ b/src/com/android/server/telecom/Ringer.java
@@ -305,6 +305,8 @@
                 return false;
             }
 
+            mAttributesLatch = new CountDownLatch(1);
+
             // Use completable future to establish a timeout, not intent to make these work outside
             // the main thread asynchronously
             // TODO: moving these RingerAttributes calculation out of Telecom lock to avoid blocking
@@ -314,7 +316,6 @@
 
             RingerAttributes attributes = null;
             try {
-                mAttributesLatch = new CountDownLatch(1);
                 attributes = ringerAttributesFuture.get(
                         RINGER_ATTRIBUTES_TIMEOUT, TimeUnit.MILLISECONDS);
             } catch (ExecutionException | InterruptedException | TimeoutException e) {
@@ -852,7 +853,9 @@
             call.setUserMissed(USER_MISSED_DND_MODE);
         }
 
-        mAttributesLatch.countDown();
+        if (mAttributesLatch != null) {
+            mAttributesLatch.countDown();
+        }
         return builder.setEndEarly(endEarly)
                 .setLetDialerHandleRinging(letDialerHandleRinging)
                 .setAcquireAudioFocus(shouldAcquireAudioFocus)
diff --git a/tests/src/com/android/server/telecom/tests/BasicCallTests.java b/tests/src/com/android/server/telecom/tests/BasicCallTests.java
index fe39f70..ef2d1a8 100644
--- a/tests/src/com/android/server/telecom/tests/BasicCallTests.java
+++ b/tests/src/com/android/server/telecom/tests/BasicCallTests.java
@@ -860,7 +860,7 @@
 
         mInCallServiceFixtureX.mInCallAdapter.sendCallEvent(ids.mCallId, TEST_EVENT, 26, null);
         verify(mConnectionServiceFixtureA.getTestDouble(), timeout(TEST_TIMEOUT))
-                .sendCallEvent(eq(ids.mConnectionId), eq(TEST_EVENT), isNull(Bundle.class), any());
+                .sendCallEvent(eq(ids.mConnectionId), eq(TEST_EVENT), isNull(), any());
     }
 
     /**
diff --git a/tests/src/com/android/server/telecom/tests/CallerInfoLookupHelperTest.java b/tests/src/com/android/server/telecom/tests/CallerInfoLookupHelperTest.java
index 614ef71..645e2e4 100644
--- a/tests/src/com/android/server/telecom/tests/CallerInfoLookupHelperTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallerInfoLookupHelperTest.java
@@ -116,7 +116,7 @@
                 CallerInfoLookupHelper.OnQueryCompleteListener.class);
         mCallerInfoLookupHelper.startLookup(Uri.EMPTY, listener);
 
-        verify(listener).onCallerInfoQueryComplete(eq(Uri.EMPTY), isNull(CallerInfo.class));
+        verify(listener).onCallerInfoQueryComplete(eq(Uri.EMPTY), isNull());
         verifyProperCleanup();
     }
 
diff --git a/tests/src/com/android/server/telecom/tests/ContactsAsyncHelperTest.java b/tests/src/com/android/server/telecom/tests/ContactsAsyncHelperTest.java
index 6ed80ac..0536ddb 100644
--- a/tests/src/com/android/server/telecom/tests/ContactsAsyncHelperTest.java
+++ b/tests/src/com/android/server/telecom/tests/ContactsAsyncHelperTest.java
@@ -126,7 +126,7 @@
         cah.startObtainPhotoAsync(TOKEN, mContext, SAMPLE_CONTACT_PHOTO_URI, mListener, COOKIE);
 
         verify(mListener, timeout(TEST_TIMEOUT)).onImageLoadComplete(eq(TOKEN),
-                isNull(Drawable.class), isNull(Bitmap.class), eq(COOKIE));
+                isNull(), isNull(), eq(COOKIE));
     }
 
     @SmallTest
diff --git a/tests/src/com/android/server/telecom/tests/DefaultDialerCacheTest.java b/tests/src/com/android/server/telecom/tests/DefaultDialerCacheTest.java
index 3da9284..ecabf64 100644
--- a/tests/src/com/android/server/telecom/tests/DefaultDialerCacheTest.java
+++ b/tests/src/com/android/server/telecom/tests/DefaultDialerCacheTest.java
@@ -84,7 +84,7 @@
 
         verify(mContext, times(2)).registerReceiverAsUser(
                 packageReceiverCaptor.capture(), eq(UserHandle.ALL), any(IntentFilter.class),
-                isNull(String.class), isNull(Handler.class));
+                isNull(), isNull());
         // Receive the first receiver that was captured, the package change receiver.
         mPackageChangeReceiver = packageReceiverCaptor.getAllValues().get(0);
 
diff --git a/tests/src/com/android/server/telecom/tests/MissedCallNotifierImplTest.java b/tests/src/com/android/server/telecom/tests/MissedCallNotifierImplTest.java
index 1776411..39836ee 100644
--- a/tests/src/com/android/server/telecom/tests/MissedCallNotifierImplTest.java
+++ b/tests/src/com/android/server/telecom/tests/MissedCallNotifierImplTest.java
@@ -578,7 +578,7 @@
 
         CallerInfo ci = new CallerInfo();
         listenerCaptor.getValue().onCallerInfoQueryComplete(escapedHandle, ci);
-        verify(mockCallInfoFactory).makeCallInfo(eq(ci), isNull(PhoneAccountHandle.class),
+        verify(mockCallInfoFactory).makeCallInfo(eq(ci), isNull(),
                 eq(escapedHandle), eq(CALL_TIMESTAMP));
     }
 
diff --git a/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java b/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java
index e75ad97..1ea0ed1 100644
--- a/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java
+++ b/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java
@@ -385,7 +385,7 @@
         assertEquals(false, callDisposition.requestRedirection);
         assertEquals(DisconnectCause.NOT_DISCONNECTED, callDisposition.disconnectCause);
 
-        verify(mCallsManager).placeOutgoingCall(eq(mCall), eq(handle), isNull(GatewayInfo.class),
+        verify(mCallsManager).placeOutgoingCall(eq(mCall), eq(handle), isNull(),
                 eq(isSpeakerphoneOn), eq(videoState));
 
         Bundle expectedExtras = createNumberExtras(handle.getSchemeSpecificPart());
@@ -409,7 +409,7 @@
 
         result.receiver.onReceive(mContext, result.intent);
 
-        verify(mCallsManager).placeOutgoingCall(eq(mCall), eq(handle), isNull(GatewayInfo.class),
+        verify(mCallsManager).placeOutgoingCall(eq(mCall), eq(handle), isNull(),
                 eq(true), eq(VideoProfile.STATE_BIDIRECTIONAL));
     }
 
@@ -427,7 +427,7 @@
 
         Uri encHandle = Uri.fromParts(handle.getScheme(),
                 handle.getSchemeSpecificPart(), null);
-        verify(mCallsManager).placeOutgoingCall(eq(mCall), eq(encHandle), isNull(GatewayInfo.class),
+        verify(mCallsManager).placeOutgoingCall(eq(mCall), eq(encHandle), isNull(),
                 eq(true), eq(VideoProfile.STATE_BIDIRECTIONAL));
     }
 
@@ -448,7 +448,7 @@
         result.receiver.onReceive(mContext, result.intent);
 
         verify(mCallsManager).placeOutgoingCall(eq(mCall), eq(handle),
-                isNotNull(GatewayInfo.class), eq(true), eq(VideoProfile.STATE_BIDIRECTIONAL));
+                isNotNull(), eq(true), eq(VideoProfile.STATE_BIDIRECTIONAL));
     }
 
     @SmallTest
@@ -645,10 +645,10 @@
                 eq(AppOpsManager.OP_PROCESS_OUTGOING_CALLS),
                 any(Bundle.class),
                 receiverCaptor.capture(),
-                isNull(Handler.class),
+                isNull(),
                 eq(Activity.RESULT_OK),
                 eq(number),
-                isNull(Bundle.class));
+                isNull());
 
         Intent capturedIntent = intentCaptor.getValue();
         assertEquals(Intent.ACTION_NEW_OUTGOING_CALL, capturedIntent.getAction());
diff --git a/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java b/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java
index d002739..30a5a19 100644
--- a/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java
+++ b/tests/src/com/android/server/telecom/tests/TelecomServiceImplTest.java
@@ -1990,7 +1990,7 @@
     @SmallTest
     @Test
     public void testGetVoicemailNumberWithNullAccountHandle() throws Exception {
-        when(mFakePhoneAccountRegistrar.getPhoneAccount(isNull(PhoneAccountHandle.class),
+        when(mFakePhoneAccountRegistrar.getPhoneAccount(isNull(),
                 eq(Binder.getCallingUserHandle())))
                 .thenReturn(makePhoneAccount(TEL_PA_HANDLE_CURRENT).build());
         int subId = 58374;