summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorBrandon Maxwell <maxwelb@google.com>2016-03-31 02:13:01 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-03-31 02:13:01 +0000
commit78da0cd46e5f563bfb90c31cd6354df75031a352 (patch)
tree495a0902f2a15749d868862921b34ecf5d5780a4 /InCallUI
parentec4ae9c7ecaa477d81f3097c8e0ae212155a61f7 (diff)
parente7855fd7aef7ad9de0f3d26f1003137e1147dc2c (diff)
Fixing blocked number ringtone after E911 call am: bb69f18
am: e7855fd * commit 'e7855fd7aef7ad9de0f3d26f1003137e1147dc2c': Fixing blocked number ringtone after E911 call Change-Id: I72af31ed192ed18056305528a5066e42f9e943e4
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java27
1 files changed, 21 insertions, 6 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 2a3fd3ed7..609eceb80 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -42,7 +42,6 @@ import android.view.WindowManager;
import com.android.contacts.common.GeoUtil;
import com.android.contacts.common.compat.CompatUtils;
-import com.android.contacts.common.compat.SdkVersionOverride;
import com.android.contacts.common.compat.telecom.TelecomManagerCompat;
import com.android.contacts.common.interactions.TouchPointManager;
import com.android.contacts.common.testing.NeededForTesting;
@@ -174,6 +173,9 @@ public class InCallPresenter implements CallList.Listener,
private PhoneStateListener mPhoneStateListener = new PhoneStateListener() {
public void onCallStateChanged(int state, String incomingNumber) {
if (state == TelephonyManager.CALL_STATE_RINGING) {
+ if (FilteredNumbersUtil.hasRecentEmergencyCall(mContext)) {
+ return;
+ }
// Check if the number is blocked, to silence the ringer.
String countryIso = GeoUtil.getCurrentCountryIso(mContext);
mFilteredQueryHandler.isBlockedNumber(
@@ -497,10 +499,7 @@ public class InCallPresenter implements CallList.Listener,
}
public void onCallAdded(final android.telecom.Call call) {
- // Check if call should be blocked.
- if (!TelecomCallUtil.isEmergencyCall(call)
- && !FilteredNumbersUtil.hasRecentEmergencyCall(mContext)
- && call.getState() == android.telecom.Call.STATE_RINGING) {
+ if (shouldAttemptBlocking(call)) {
maybeBlockCall(call);
} else {
mCallList.onCallAdded(call);
@@ -511,6 +510,22 @@ public class InCallPresenter implements CallList.Listener,
call.registerCallback(mCallCallback);
}
+ private boolean shouldAttemptBlocking(android.telecom.Call call) {
+ if (call.getState() != android.telecom.Call.STATE_RINGING) {
+ return false;
+ }
+ if (TelecomCallUtil.isEmergencyCall(call)) {
+ Log.i(this, "Not attempting to block incoming emergency call");
+ return false;
+ }
+ if (FilteredNumbersUtil.hasRecentEmergencyCall(mContext)) {
+ Log.i(this, "Not attempting to block incoming call due to recent emergency call");
+ return false;
+ }
+
+ return true;
+ }
+
/**
* Checks whether a call should be blocked, and blocks it if so. Otherwise, it adds the call
* to the CallList so it can proceed as normal. There is a timeout, so if the function for
@@ -549,8 +564,8 @@ public class InCallPresenter implements CallList.Listener,
mCallList.onCallAdded(call);
}
} else {
+ Log.i(this, "Rejecting incoming call from blocked number");
call.reject(false, null);
- Log.d(this, "checkForBlockedCall: " + Log.pii(number) + " blocked.");
Logger.logInteraction(InteractionEvent.CALL_BLOCKED);
mFilteredQueryHandler.incrementFilteredCount(id);