Loading src/com/android/server/telecom/Call.java +15 −0 Original line number Diff line number Diff line Loading @@ -389,6 +389,9 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, /** Whether this call is requesting that Telecom play the ringback tone on its behalf. */ private boolean mRingbackRequested = false; /** Whether this call is requesting to be silently ringing. */ private boolean mSilentRingingRequested = false; /** Whether direct-to-voicemail query is pending. */ private boolean mDirectToVoicemailQueryPending; Loading Loading @@ -995,6 +998,18 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, return mRingbackRequested; } public void setSilentRingingRequested(boolean silentRingingRequested) { mSilentRingingRequested = silentRingingRequested; Bundle bundle = new Bundle(); bundle.putBoolean(android.telecom.Call.EXTRA_SILENT_RINGING_REQUESTED, silentRingingRequested); putExtras(SOURCE_CONNECTION_SERVICE, bundle); } public boolean isSilentRingingRequested() { return mSilentRingingRequested; } @VisibleForTesting public boolean isConference() { return mIsConference; Loading src/com/android/server/telecom/CallScreeningServiceHelper.java +5 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,11 @@ public class CallScreeningServiceHelper { // no-op; we don't allow this on outgoing calls. } @Override public void silenceCall(String s) throws RemoteException { // no-op; we don't allow this on outgoing calls. } @Override public void disallowCall(String s, boolean b, boolean b1, boolean b2, ComponentName componentName) throws RemoteException { Loading src/com/android/server/telecom/CallsManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -663,6 +663,10 @@ public class CallsManager extends Call.ListenerBase "dialing calls."); rejectCallAndLog(incomingCall, result); } } else if (result.shouldSilence) { Log.i(this, "onCallFilteringCompleted: setting the call to silent ringing state"); incomingCall.setSilentRingingRequested(true); addCall(incomingCall); } else { addCall(incomingCall); } Loading src/com/android/server/telecom/Ringer.java +9 −3 Original line number Diff line number Diff line Loading @@ -199,6 +199,7 @@ public class Ringer { boolean shouldRingForContact = shouldRingForContact(foregroundCall.getContactUri()); boolean isRingtonePresent = !(mRingtoneFactory.getRingtone(foregroundCall) == null); boolean isSelfManaged = foregroundCall.isSelfManaged(); boolean isSilentRingingRequested = foregroundCall.isSilentRingingRequested(); boolean isRingerAudible = isVolumeOverZero && shouldRingForContact && isRingtonePresent; boolean hasExternalRinger = hasExternalRinger(foregroundCall); Loading @@ -214,15 +215,20 @@ public class Ringer { boolean isTheaterModeOn = mSystemSettingsUtil.isTheaterModeOn(mContext); boolean letDialerHandleRinging = mInCallController.doesConnectedDialerSupportRinging(); boolean endEarly = isTheaterModeOn || letDialerHandleRinging || isSelfManaged || hasExternalRinger; hasExternalRinger || isSilentRingingRequested; if (endEarly) { if (letDialerHandleRinging) { Log.addEvent(foregroundCall, LogUtils.Events.SKIP_RINGING, "Dialer handles"); } if (isSilentRingingRequested) { Log.addEvent(foregroundCall, LogUtils.Events.SKIP_RINGING, "Silent ringing " + "requested"); } Log.i(this, "Ending early -- isTheaterModeOn=%s, letDialerHandleRinging=%s, " + "isSelfManaged=%s, hasExternalRinger=%s", isTheaterModeOn, letDialerHandleRinging, isSelfManaged, hasExternalRinger); "isSelfManaged=%s, hasExternalRinger=%s, silentRingingRequested=%s", isTheaterModeOn, letDialerHandleRinging, isSelfManaged, hasExternalRinger, isSilentRingingRequested); return shouldAcquireAudioFocus; } Loading src/com/android/server/telecom/callfiltering/CallFilteringResult.java +31 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.text.TextUtils; public class CallFilteringResult { public boolean shouldAllowCall; public boolean shouldReject; public boolean shouldSilence; public boolean shouldAddToCallLog; public boolean shouldShowNotification; public int mCallBlockReason = CallLog.Calls.BLOCK_REASON_NOT_BLOCKED; Loading @@ -33,6 +34,7 @@ public class CallFilteringResult { shouldAddToCallLog, boolean shouldShowNotification) { this.shouldAllowCall = shouldAllowCall; this.shouldReject = shouldReject; this.shouldSilence = false; this.shouldAddToCallLog = shouldAddToCallLog; this.shouldShowNotification = shouldShowNotification; } Loading @@ -42,6 +44,29 @@ public class CallFilteringResult { CharSequence callScreeningAppName, String callScreeningComponentName) { this.shouldAllowCall = shouldAllowCall; this.shouldReject = shouldReject; this.shouldSilence = false; this.shouldAddToCallLog = shouldAddToCallLog; this.shouldShowNotification = shouldShowNotification; this.mCallBlockReason = callBlockReason; this.mCallScreeningAppName = callScreeningAppName; this.mCallScreeningComponentName = callScreeningComponentName; } public CallFilteringResult(boolean shouldAllowCall, boolean shouldReject, boolean shouldSilence, boolean shouldAddToCallLog, boolean shouldShowNotification) { this.shouldAllowCall = shouldAllowCall; this.shouldReject = shouldReject; this.shouldSilence = shouldSilence; this.shouldAddToCallLog = shouldAddToCallLog; this.shouldShowNotification = shouldShowNotification; } public CallFilteringResult(boolean shouldAllowCall, boolean shouldReject, boolean shouldSilence, boolean shouldAddToCallLog, boolean shouldShowNotification, int callBlockReason, CharSequence callScreeningAppName, String callScreeningComponentName) { this.shouldAllowCall = shouldAllowCall; this.shouldReject = shouldReject; this.shouldSilence = shouldSilence; this.shouldAddToCallLog = shouldAddToCallLog; this.shouldShowNotification = shouldShowNotification; this.mCallBlockReason = callBlockReason; Loading Loading @@ -87,6 +112,7 @@ public class CallFilteringResult { return new CallFilteringResult( shouldAllowCall && other.shouldAllowCall, shouldReject || other.shouldReject, shouldSilence || other.shouldSilence, shouldAddToCallLog && other.shouldAddToCallLog, shouldShowNotification && other.shouldShowNotification); } Loading @@ -108,6 +134,7 @@ public class CallFilteringResult { return new CallFilteringResult( shouldAllowCall && other.shouldAllowCall, shouldReject || other.shouldReject, shouldSilence|| other.shouldSilence, shouldAddToCallLog && other.shouldAddToCallLog, shouldShowNotification && other.shouldShowNotification, callBlockReason, Loading @@ -125,6 +152,7 @@ public class CallFilteringResult { if (shouldAllowCall != that.shouldAllowCall) return false; if (shouldReject != that.shouldReject) return false; if (shouldSilence != that.shouldSilence) return false; if (shouldAddToCallLog != that.shouldAddToCallLog) return false; if (shouldShowNotification != that.shouldShowNotification) return false; if (mCallBlockReason != that.mCallBlockReason) return false; Loading @@ -150,6 +178,7 @@ public class CallFilteringResult { public int hashCode() { int result = (shouldAllowCall ? 1 : 0); result = 31 * result + (shouldReject ? 1 : 0); result = 31 * result + (shouldSilence ? 1 : 0); result = 31 * result + (shouldAddToCallLog ? 1 : 0); result = 31 * result + (shouldShowNotification ? 1 : 0); return result; Loading @@ -163,6 +192,8 @@ public class CallFilteringResult { sb.append("Allow"); } else if (shouldReject) { sb.append("Reject"); } else if (shouldSilence) { sb.append("Silence"); } else { sb.append("Ignore"); } Loading Loading
src/com/android/server/telecom/Call.java +15 −0 Original line number Diff line number Diff line Loading @@ -389,6 +389,9 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, /** Whether this call is requesting that Telecom play the ringback tone on its behalf. */ private boolean mRingbackRequested = false; /** Whether this call is requesting to be silently ringing. */ private boolean mSilentRingingRequested = false; /** Whether direct-to-voicemail query is pending. */ private boolean mDirectToVoicemailQueryPending; Loading Loading @@ -995,6 +998,18 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, return mRingbackRequested; } public void setSilentRingingRequested(boolean silentRingingRequested) { mSilentRingingRequested = silentRingingRequested; Bundle bundle = new Bundle(); bundle.putBoolean(android.telecom.Call.EXTRA_SILENT_RINGING_REQUESTED, silentRingingRequested); putExtras(SOURCE_CONNECTION_SERVICE, bundle); } public boolean isSilentRingingRequested() { return mSilentRingingRequested; } @VisibleForTesting public boolean isConference() { return mIsConference; Loading
src/com/android/server/telecom/CallScreeningServiceHelper.java +5 −0 Original line number Diff line number Diff line Loading @@ -64,6 +64,11 @@ public class CallScreeningServiceHelper { // no-op; we don't allow this on outgoing calls. } @Override public void silenceCall(String s) throws RemoteException { // no-op; we don't allow this on outgoing calls. } @Override public void disallowCall(String s, boolean b, boolean b1, boolean b2, ComponentName componentName) throws RemoteException { Loading
src/com/android/server/telecom/CallsManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -663,6 +663,10 @@ public class CallsManager extends Call.ListenerBase "dialing calls."); rejectCallAndLog(incomingCall, result); } } else if (result.shouldSilence) { Log.i(this, "onCallFilteringCompleted: setting the call to silent ringing state"); incomingCall.setSilentRingingRequested(true); addCall(incomingCall); } else { addCall(incomingCall); } Loading
src/com/android/server/telecom/Ringer.java +9 −3 Original line number Diff line number Diff line Loading @@ -199,6 +199,7 @@ public class Ringer { boolean shouldRingForContact = shouldRingForContact(foregroundCall.getContactUri()); boolean isRingtonePresent = !(mRingtoneFactory.getRingtone(foregroundCall) == null); boolean isSelfManaged = foregroundCall.isSelfManaged(); boolean isSilentRingingRequested = foregroundCall.isSilentRingingRequested(); boolean isRingerAudible = isVolumeOverZero && shouldRingForContact && isRingtonePresent; boolean hasExternalRinger = hasExternalRinger(foregroundCall); Loading @@ -214,15 +215,20 @@ public class Ringer { boolean isTheaterModeOn = mSystemSettingsUtil.isTheaterModeOn(mContext); boolean letDialerHandleRinging = mInCallController.doesConnectedDialerSupportRinging(); boolean endEarly = isTheaterModeOn || letDialerHandleRinging || isSelfManaged || hasExternalRinger; hasExternalRinger || isSilentRingingRequested; if (endEarly) { if (letDialerHandleRinging) { Log.addEvent(foregroundCall, LogUtils.Events.SKIP_RINGING, "Dialer handles"); } if (isSilentRingingRequested) { Log.addEvent(foregroundCall, LogUtils.Events.SKIP_RINGING, "Silent ringing " + "requested"); } Log.i(this, "Ending early -- isTheaterModeOn=%s, letDialerHandleRinging=%s, " + "isSelfManaged=%s, hasExternalRinger=%s", isTheaterModeOn, letDialerHandleRinging, isSelfManaged, hasExternalRinger); "isSelfManaged=%s, hasExternalRinger=%s, silentRingingRequested=%s", isTheaterModeOn, letDialerHandleRinging, isSelfManaged, hasExternalRinger, isSilentRingingRequested); return shouldAcquireAudioFocus; } Loading
src/com/android/server/telecom/callfiltering/CallFilteringResult.java +31 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.text.TextUtils; public class CallFilteringResult { public boolean shouldAllowCall; public boolean shouldReject; public boolean shouldSilence; public boolean shouldAddToCallLog; public boolean shouldShowNotification; public int mCallBlockReason = CallLog.Calls.BLOCK_REASON_NOT_BLOCKED; Loading @@ -33,6 +34,7 @@ public class CallFilteringResult { shouldAddToCallLog, boolean shouldShowNotification) { this.shouldAllowCall = shouldAllowCall; this.shouldReject = shouldReject; this.shouldSilence = false; this.shouldAddToCallLog = shouldAddToCallLog; this.shouldShowNotification = shouldShowNotification; } Loading @@ -42,6 +44,29 @@ public class CallFilteringResult { CharSequence callScreeningAppName, String callScreeningComponentName) { this.shouldAllowCall = shouldAllowCall; this.shouldReject = shouldReject; this.shouldSilence = false; this.shouldAddToCallLog = shouldAddToCallLog; this.shouldShowNotification = shouldShowNotification; this.mCallBlockReason = callBlockReason; this.mCallScreeningAppName = callScreeningAppName; this.mCallScreeningComponentName = callScreeningComponentName; } public CallFilteringResult(boolean shouldAllowCall, boolean shouldReject, boolean shouldSilence, boolean shouldAddToCallLog, boolean shouldShowNotification) { this.shouldAllowCall = shouldAllowCall; this.shouldReject = shouldReject; this.shouldSilence = shouldSilence; this.shouldAddToCallLog = shouldAddToCallLog; this.shouldShowNotification = shouldShowNotification; } public CallFilteringResult(boolean shouldAllowCall, boolean shouldReject, boolean shouldSilence, boolean shouldAddToCallLog, boolean shouldShowNotification, int callBlockReason, CharSequence callScreeningAppName, String callScreeningComponentName) { this.shouldAllowCall = shouldAllowCall; this.shouldReject = shouldReject; this.shouldSilence = shouldSilence; this.shouldAddToCallLog = shouldAddToCallLog; this.shouldShowNotification = shouldShowNotification; this.mCallBlockReason = callBlockReason; Loading Loading @@ -87,6 +112,7 @@ public class CallFilteringResult { return new CallFilteringResult( shouldAllowCall && other.shouldAllowCall, shouldReject || other.shouldReject, shouldSilence || other.shouldSilence, shouldAddToCallLog && other.shouldAddToCallLog, shouldShowNotification && other.shouldShowNotification); } Loading @@ -108,6 +134,7 @@ public class CallFilteringResult { return new CallFilteringResult( shouldAllowCall && other.shouldAllowCall, shouldReject || other.shouldReject, shouldSilence|| other.shouldSilence, shouldAddToCallLog && other.shouldAddToCallLog, shouldShowNotification && other.shouldShowNotification, callBlockReason, Loading @@ -125,6 +152,7 @@ public class CallFilteringResult { if (shouldAllowCall != that.shouldAllowCall) return false; if (shouldReject != that.shouldReject) return false; if (shouldSilence != that.shouldSilence) return false; if (shouldAddToCallLog != that.shouldAddToCallLog) return false; if (shouldShowNotification != that.shouldShowNotification) return false; if (mCallBlockReason != that.mCallBlockReason) return false; Loading @@ -150,6 +178,7 @@ public class CallFilteringResult { public int hashCode() { int result = (shouldAllowCall ? 1 : 0); result = 31 * result + (shouldReject ? 1 : 0); result = 31 * result + (shouldSilence ? 1 : 0); result = 31 * result + (shouldAddToCallLog ? 1 : 0); result = 31 * result + (shouldShowNotification ? 1 : 0); return result; Loading @@ -163,6 +192,8 @@ public class CallFilteringResult { sb.append("Allow"); } else if (shouldReject) { sb.append("Reject"); } else if (shouldSilence) { sb.append("Silence"); } else { sb.append("Ignore"); } Loading