diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-03-17 13:53:53 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-03-17 13:53:53 +0000 |
commit | b15b36435c3414b6db295e078ede0eeeae50412a (patch) | |
tree | 8f02ad25944f25583c52f97c3f72f2dc578668ab | |
parent | e6487faa0767e9442b06bd0bd3331c23f444dea8 (diff) | |
parent | 86403ac81147ee4fd856810eed64efd20156d225 (diff) | |
download | Telecomm-android13-d3-s1-release.tar.gz |
Merge cherrypicks of ['googleplex-android-review.googlesource.com/21224930', 'googleplex-android-review.googlesource.com/20659351'] into tm-d3-release.android-13.0.0_r57android13-d3-s1-release
Change-Id: I199d39d1203df6060e5b1bd9812e927dc76577be
4 files changed, 44 insertions, 2 deletions
diff --git a/src/com/android/server/telecom/CallScreeningServiceHelper.java b/src/com/android/server/telecom/CallScreeningServiceHelper.java index c1aff3def..0168590ff 100644 --- a/src/com/android/server/telecom/CallScreeningServiceHelper.java +++ b/src/com/android/server/telecom/CallScreeningServiceHelper.java @@ -137,6 +137,23 @@ public class CallScreeningServiceHelper { "Cancelling outgoing call screen due to service disconnect."); } mFuture.complete(null); + mContext.unbindService(this); + } finally { + Log.endSession(); + } + } + + @Override + public void onNullBinding(ComponentName name) { + // No locking needed -- CompletableFuture only lets one thread call complete. + Log.continueSession(mLoggingSession, "CSSH.oNB"); + try { + if (!mFuture.isDone()) { + Log.w(CallScreeningServiceHelper.this, + "Cancelling outgoing call screen due to null binding."); + } + mFuture.complete(null); + mContext.unbindService(this); } finally { Log.endSession(); } diff --git a/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java b/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java index 86fedd561..4569950e2 100644 --- a/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java +++ b/src/com/android/server/telecom/NewOutgoingCallIntentBroadcaster.java @@ -314,8 +314,18 @@ public class NewOutgoingCallIntentBroadcaster { } private String getNumberFromCallIntent(Intent intent) { - String number; - number = mPhoneNumberUtilsAdapter.getNumberFromIntent(intent, mContext); + String number = null; + + Uri uri = intent.getData(); + if (uri != null) { + String scheme = uri.getScheme(); + if (scheme != null) { + if (scheme.equals("tel") || scheme.equals("sip")) { + number = uri.getSchemeSpecificPart(); + } + } + } + if (TextUtils.isEmpty(number)) { Log.w(this, "Empty number obtained from the call intent."); return null; diff --git a/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java b/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java index 51b1bc64d..5f4c40b82 100644 --- a/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java +++ b/src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java @@ -235,12 +235,14 @@ public class CallScreeningServiceFilter extends CallFilter { public void onServiceDisconnected(ComponentName componentName) { mResultFuture.complete(mPriorStageResult); Log.i(this, "Service disconnected."); + unbindCallScreeningService(); } @Override public void onBindingDied(ComponentName name) { mResultFuture.complete(mPriorStageResult); Log.i(this, "Binding died."); + unbindCallScreeningService(); } @Override diff --git a/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java b/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java index e6c6bacf4..2614abf2f 100644 --- a/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java +++ b/tests/src/com/android/server/telecom/tests/NewOutgoingCallIntentBroadcasterTest.java @@ -214,6 +214,19 @@ public class NewOutgoingCallIntentBroadcasterTest extends TelecomTestCase { verifyNoCallPlaced(); } + @Test + public void testNoCallsPlacedWithContentUri() { + Uri handle = Uri.parse("content://com.android.contacts/data/1"); + Intent intent = new Intent(Intent.ACTION_CALL, handle); + + int result = processIntent(intent, true).disconnectCause; + + assertEquals(DisconnectCause.NO_PHONE_NUMBER_SUPPLIED, result); + verify(mContext, never()).getContentResolver(); + verifyNoBroadcastSent(); + verifyNoCallPlaced(); + } + @SmallTest @Test public void testEmergencyCallWithNonDefaultDialer() { |