summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Maxwell <maxwelb@google.com>2016-03-24 11:43:47 -0700
committerBrandon Maxwell <maxwelb@google.com>2016-03-24 11:43:47 -0700
commit256281e25aaa4764334f60a4333b607c2a4d5573 (patch)
treecd47619cf0340956a323fe6d44cd6fb4819b5903
parent71d986f1e9748ea4809f1547973e2ee046ce704e (diff)
Fixing blocked number ringtone after E911 call
+ The code which silences the ringtone for incoming calls from blocked numbers did not check to see if blocking should be disabled due to a recent incoming call. + This CL fixes that issue and rearranges logic to improve logging. Change-Id: I6034a0ba26db09624d7ca6beb6f52bea9fda558a Fixes: 26687001
-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 5a27b4ca0..0109d7ee6 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(
@@ -496,10 +498,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);
@@ -510,6 +509,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
@@ -548,8 +563,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);