Merge "Add implementation of handle external messages from wired headset, dock and speaker, mute toggle and focus switching." into main
diff --git a/flags/Android.bp b/flags/Android.bp
index 386831c..3497db8 100644
--- a/flags/Android.bp
+++ b/flags/Android.bp
@@ -21,23 +21,23 @@
aconfig_declarations {
name: "telecom_flags",
package: "com.android.server.telecom.flags",
+ container: "system",
srcs: [
- "telecom_broadcast_flags.aconfig",
- "telecom_ringer_flag_declarations.aconfig",
- "telecom_api_flags.aconfig",
- "telecom_call_filtering_flags.aconfig",
- "telecom_incallservice_flags.aconfig",
- "telecom_default_phone_account_flags.aconfig",
- "telecom_callaudioroutestatemachine_flags.aconfig",
- "telecom_call_flags.aconfig",
- "telecom_calls_manager_flags.aconfig",
- "telecom_anomaly_report_flags.aconfig",
- "telecom_callaudiomodestatemachine_flags.aconfig",
- "telecom_calllog_flags.aconfig",
- "telecom_resolve_hidden_dependencies.aconfig",
- "telecom_bluetoothroutemanager_flags.aconfig",
- "telecom_work_profile_flags.aconfig",
- "telecom_connection_service_wrapper_flags.aconfig",
+ "telecom_broadcast_flags.aconfig",
+ "telecom_ringer_flag_declarations.aconfig",
+ "telecom_api_flags.aconfig",
+ "telecom_call_filtering_flags.aconfig",
+ "telecom_incallservice_flags.aconfig",
+ "telecom_default_phone_account_flags.aconfig",
+ "telecom_callaudioroutestatemachine_flags.aconfig",
+ "telecom_call_flags.aconfig",
+ "telecom_calls_manager_flags.aconfig",
+ "telecom_anomaly_report_flags.aconfig",
+ "telecom_callaudiomodestatemachine_flags.aconfig",
+ "telecom_calllog_flags.aconfig",
+ "telecom_resolve_hidden_dependencies.aconfig",
+ "telecom_bluetoothroutemanager_flags.aconfig",
+ "telecom_work_profile_flags.aconfig",
+ "telecom_connection_service_wrapper_flags.aconfig",
],
}
-
diff --git a/flags/telecom_anomaly_report_flags.aconfig b/flags/telecom_anomaly_report_flags.aconfig
index dbacc08..6879d86 100644
--- a/flags/telecom_anomaly_report_flags.aconfig
+++ b/flags/telecom_anomaly_report_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "gen_anom_report_on_focus_timeout"
diff --git a/flags/telecom_api_flags.aconfig b/flags/telecom_api_flags.aconfig
index 21b83b2..f3a2b8a 100644
--- a/flags/telecom_api_flags.aconfig
+++ b/flags/telecom_api_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "voip_app_actions_support"
@@ -21,10 +22,23 @@
bug: "292597423"
}
-
flag{
name: "set_mute_state"
namespace: "telecom"
description: "transactional calls need the ability to mute the call audio input"
bug: "310669304"
}
+
+flag{
+ name: "transactional_video_state"
+ namespace: "telecom"
+ description: "when set, clients using transactional implementations will be able to set & get the video state"
+ bug: "311265260"
+}
+
+flag{
+ name: "business_call_composer"
+ namespace: "telecom"
+ description: "Enables enriched calling features (e.g. Business name will show for a call)"
+ bug: "311688497"
+}
diff --git a/flags/telecom_bluetoothroutemanager_flags.aconfig b/flags/telecom_bluetoothroutemanager_flags.aconfig
index ddd8571..1df1e9b 100644
--- a/flags/telecom_bluetoothroutemanager_flags.aconfig
+++ b/flags/telecom_bluetoothroutemanager_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "use_actual_address_to_enter_connecting_state"
diff --git a/flags/telecom_broadcast_flags.aconfig b/flags/telecom_broadcast_flags.aconfig
index 348d574..de8dd27 100644
--- a/flags/telecom_broadcast_flags.aconfig
+++ b/flags/telecom_broadcast_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "is_new_outgoing_call_broadcast_unblocking"
diff --git a/flags/telecom_call_filtering_flags.aconfig b/flags/telecom_call_filtering_flags.aconfig
index 95e74ce..72f9db3 100644
--- a/flags/telecom_call_filtering_flags.aconfig
+++ b/flags/telecom_call_filtering_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "skip_filter_phone_account_perform_dnd_filter"
diff --git a/flags/telecom_call_flags.aconfig b/flags/telecom_call_flags.aconfig
index b5ea6a2..27a4b22 100644
--- a/flags/telecom_call_flags.aconfig
+++ b/flags/telecom_call_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "transactional_cs_verifier"
diff --git a/flags/telecom_callaudiomodestatemachine_flags.aconfig b/flags/telecom_callaudiomodestatemachine_flags.aconfig
index b263113..1d81535 100644
--- a/flags/telecom_callaudiomodestatemachine_flags.aconfig
+++ b/flags/telecom_callaudiomodestatemachine_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "set_audio_mode_before_abandon_focus"
diff --git a/flags/telecom_callaudioroutestatemachine_flags.aconfig b/flags/telecom_callaudioroutestatemachine_flags.aconfig
index fe21c92..f5da045 100644
--- a/flags/telecom_callaudioroutestatemachine_flags.aconfig
+++ b/flags/telecom_callaudioroutestatemachine_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "available_routes_never_updated_after_set_system_audio_state"
diff --git a/flags/telecom_calllog_flags.aconfig b/flags/telecom_calllog_flags.aconfig
index 3ce7b63..593b7e5 100644
--- a/flags/telecom_calllog_flags.aconfig
+++ b/flags/telecom_calllog_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "telecom_log_external_wearable_calls"
diff --git a/flags/telecom_calls_manager_flags.aconfig b/flags/telecom_calls_manager_flags.aconfig
index 1a19480..cdfcc30 100644
--- a/flags/telecom_calls_manager_flags.aconfig
+++ b/flags/telecom_calls_manager_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "use_improved_listener_order"
diff --git a/flags/telecom_connection_service_wrapper_flags.aconfig b/flags/telecom_connection_service_wrapper_flags.aconfig
index 5f46c27..80a8dfe 100644
--- a/flags/telecom_connection_service_wrapper_flags.aconfig
+++ b/flags/telecom_connection_service_wrapper_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "updated_rcs_call_count_tracking"
diff --git a/flags/telecom_default_phone_account_flags.aconfig b/flags/telecom_default_phone_account_flags.aconfig
index 03f324c..e6badde 100644
--- a/flags/telecom_default_phone_account_flags.aconfig
+++ b/flags/telecom_default_phone_account_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "only_update_telephony_on_valid_sub_ids"
diff --git a/flags/telecom_incallservice_flags.aconfig b/flags/telecom_incallservice_flags.aconfig
index 1110ca4..08a82ba 100644
--- a/flags/telecom_incallservice_flags.aconfig
+++ b/flags/telecom_incallservice_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "early_binding_to_incall_service"
diff --git a/flags/telecom_resolve_hidden_dependencies.aconfig b/flags/telecom_resolve_hidden_dependencies.aconfig
index 6def938..674a968 100644
--- a/flags/telecom_resolve_hidden_dependencies.aconfig
+++ b/flags/telecom_resolve_hidden_dependencies.aconfig
@@ -1,8 +1,9 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "telecom_resolve_hidden_dependencies"
namespace: "telecom"
description: "Mainland cleanup for hidden dependencies"
- bug: "b/324090590"
+ bug: "323414215"
}
diff --git a/flags/telecom_ringer_flag_declarations.aconfig b/flags/telecom_ringer_flag_declarations.aconfig
index 54748d0..13577bb 100644
--- a/flags/telecom_ringer_flag_declarations.aconfig
+++ b/flags/telecom_ringer_flag_declarations.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "use_device_provided_serialized_ringer_vibration"
diff --git a/flags/telecom_work_profile_flags.aconfig b/flags/telecom_work_profile_flags.aconfig
index 180af59..854568b 100644
--- a/flags/telecom_work_profile_flags.aconfig
+++ b/flags/telecom_work_profile_flags.aconfig
@@ -1,4 +1,5 @@
package: "com.android.server.telecom.flags"
+container: "system"
flag {
name: "associated_user_refactor_for_work_profile"
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index 624399b..f7ad93f 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -19,6 +19,8 @@
import static android.provider.CallLog.Calls.MISSED_REASON_NOT_MISSED;
import static android.telephony.TelephonyManager.EVENT_DISPLAY_EMERGENCY_MESSAGE;
+import static com.android.server.telecom.voip.VideoStateTranslation.VideoProfileStateToTransactionalVideoState;
+
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
@@ -652,6 +654,36 @@
private boolean mIsVideoCallingSupportedByPhoneAccount = false;
/**
+ * Indicates whether this individual calls video state can be changed as opposed to be gated
+ * by the {@link PhoneAccount}.
+ *
+ * {@code True} if the call is Transactional && has the CallAttributes.SUPPORTS_VIDEO_CALLING
+ * capability {@code false} otherwise.
+ */
+ private boolean mTransactionalCallSupportsVideoCalling = false;
+
+ public void setTransactionalCallSupportsVideoCalling(CallAttributes callAttributes) {
+ if (!mIsTransactionalCall) {
+ Log.i(this, "setTransactionalCallSupportsVideoCalling: call is not transactional");
+ return;
+ }
+ if (callAttributes == null) {
+ Log.i(this, "setTransactionalCallSupportsVideoCalling: callAttributes is null");
+ return;
+ }
+ if ((callAttributes.getCallCapabilities() & CallAttributes.SUPPORTS_VIDEO_CALLING)
+ == CallAttributes.SUPPORTS_VIDEO_CALLING) {
+ mTransactionalCallSupportsVideoCalling = true;
+ } else {
+ mTransactionalCallSupportsVideoCalling = false;
+ }
+ }
+
+ public boolean isTransactionalCallSupportsVideoCalling() {
+ return mTransactionalCallSupportsVideoCalling;
+ }
+
+ /**
* Indicates whether or not this call can be pulled if it is an external call. If true, respect
* the Connection Capability set by the ConnectionService. If false, override the capability
* set and always remove the ability to pull this external call.
@@ -3176,8 +3208,7 @@
} else if (mConnectionService != null) {
mConnectionService.onExtrasChanged(this, mExtras);
} else {
- Log.e(this, new NullPointerException(),
- "putExtras failed due to null CS callId=%s", getId());
+ Log.w(this, "putExtras failed due to null CS callId=%s", getId());
}
}
}
@@ -4023,6 +4054,15 @@
videoState = VideoProfile.STATE_AUDIO_ONLY;
}
+ // Transactional calls have the ability to change video calling capabilities on a per-call
+ // basis as opposed to ConnectionService calls which are only based on the PhoneAccount.
+ if (mFlags.transactionalVideoState()
+ && mIsTransactionalCall && !mTransactionalCallSupportsVideoCalling) {
+ Log.i(this, "setVideoState: The transactional does NOT support video calling."
+ + " defaulted to audio (video not supported)");
+ videoState = VideoProfile.STATE_AUDIO_ONLY;
+ }
+
// Track Video State history during the duration of the call.
// Only update the history when the call is active or disconnected. This ensures we do
// not include the video state history when:
@@ -4045,6 +4085,12 @@
}
}
+ if (mFlags.transactionalVideoState()
+ && mIsTransactionalCall && mTransactionalService != null) {
+ int transactionalVS = VideoProfileStateToTransactionalVideoState(mVideoState);
+ mTransactionalService.onVideoStateChanged(this, transactionalVS);
+ }
+
if (VideoProfile.isVideo(videoState)) {
mAnalytics.setCallIsVideo(true);
}
diff --git a/src/com/android/server/telecom/CallLogManager.java b/src/com/android/server/telecom/CallLogManager.java
index 6a9977d..f6360a3 100644
--- a/src/com/android/server/telecom/CallLogManager.java
+++ b/src/com/android/server/telecom/CallLogManager.java
@@ -54,6 +54,7 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.telecom.callfiltering.CallFilteringResult;
import com.android.server.telecom.flags.FeatureFlags;
+import com.android.server.telecom.flags.Flags;
import java.util.Arrays;
import java.util.Locale;
@@ -418,7 +419,12 @@
paramBuilder.setCallType(callLogType);
paramBuilder.setIsRead(call.isSelfManaged());
paramBuilder.setMissedReason(call.getMissedReason());
-
+ if (Flags.businessCallComposer() && call.getExtras() != null) {
+ paramBuilder.setIsBusinessCall(call.getExtras().getBoolean(
+ android.telecom.Call.EXTRA_IS_BUSINESS_CALL, false));
+ paramBuilder.setBusinessName(call.getExtras().getString(
+ android.telecom.Call.EXTRA_ASSERTED_DISPLAY_NAME, ""));
+ }
sendAddCallBroadcast(callLogType, call.getAgeMillis());
boolean okayToLog =
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 97a53e2..a39e1e6 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -79,7 +79,7 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.BlockedNumberContract;
-import android.provider.BlockedNumberContract.SystemContract;
+import android.provider.BlockedNumberContract.BlockedNumbers;
import android.provider.CallLog.Calls;
import android.provider.Settings;
import android.sysprop.TelephonyProperties;
@@ -557,7 +557,7 @@
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED.equals(action)
- || SystemContract.ACTION_BLOCK_SUPPRESSION_STATE_CHANGED.equals(action)) {
+ || BlockedNumbers.ACTION_BLOCK_SUPPRESSION_STATE_CHANGED.equals(action)) {
updateEmergencyCallNotificationAsync(context);
}
}
@@ -756,7 +756,7 @@
IntentFilter intentFilter = new IntentFilter(
CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
intentFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
- intentFilter.addAction(SystemContract.ACTION_BLOCK_SUPPRESSION_STATE_CHANGED);
+ intentFilter.addAction(BlockedNumbers.ACTION_BLOCK_SUPPRESSION_STATE_CHANGED);
context.registerReceiver(mReceiver, intentFilter, Context.RECEIVER_EXPORTED);
mGraphHandlerThreads = new LinkedList<>();
@@ -2931,7 +2931,7 @@
if (call.isEmergencyCall()) {
Executors.defaultThreadFactory().newThread(() ->
- BlockedNumberContract.SystemContract.notifyEmergencyContact(mContext))
+ BlockedNumberContract.BlockedNumbers.notifyEmergencyContact(mContext))
.start();
}
diff --git a/src/com/android/server/telecom/ParcelableCallUtils.java b/src/com/android/server/telecom/ParcelableCallUtils.java
index c77e605..3573de8 100644
--- a/src/com/android/server/telecom/ParcelableCallUtils.java
+++ b/src/com/android/server/telecom/ParcelableCallUtils.java
@@ -63,6 +63,7 @@
RESTRICTED_CALL_SCREENING_EXTRA_KEYS = new ArrayList<>();
RESTRICTED_CALL_SCREENING_EXTRA_KEYS.add(android.telecom.Connection.EXTRA_SIP_INVITE);
RESTRICTED_CALL_SCREENING_EXTRA_KEYS.add(ImsCallProfile.EXTRA_IS_BUSINESS_CALL);
+ RESTRICTED_CALL_SCREENING_EXTRA_KEYS.add(ImsCallProfile.EXTRA_ASSERTED_DISPLAY_NAME);
}
public static class Converter {
diff --git a/src/com/android/server/telecom/TelecomServiceImpl.java b/src/com/android/server/telecom/TelecomServiceImpl.java
index b704d33..d4d395a 100644
--- a/src/com/android/server/telecom/TelecomServiceImpl.java
+++ b/src/com/android/server/telecom/TelecomServiceImpl.java
@@ -239,6 +239,9 @@
callEventCallback, mCallsManager, call);
call.setTransactionServiceWrapper(serviceWrapper);
+ if (mFeatureFlags.transactionalVideoState()) {
+ call.setTransactionalCallSupportsVideoCalling(callAttributes);
+ }
ICallControl clientCallControl = serviceWrapper.getICallControl();
if (clientCallControl == null) {
@@ -787,6 +790,9 @@
Bundle extras = account.getExtras();
if (extras != null
&& extras.getBoolean(PhoneAccount.EXTRA_SKIP_CALL_FILTERING)) {
+ // System apps should be granted the MODIFY_PHONE_STATE permission.
+ enforceModifyPermission(
+ "registerPhoneAccount requires MODIFY_PHONE_STATE permission.");
enforceRegisterSkipCallFiltering();
}
final int callingUid = Binder.getCallingUid();
@@ -1951,7 +1957,7 @@
synchronized (mLock) {
long token = Binder.clearCallingIdentity();
try {
- BlockedNumberContract.SystemContract.endBlockSuppression(mContext);
+ BlockedNumberContract.BlockedNumbers.endBlockSuppression(mContext);
} finally {
Binder.restoreCallingIdentity(token);
}
diff --git a/src/com/android/server/telecom/TransactionalServiceWrapper.java b/src/com/android/server/telecom/TransactionalServiceWrapper.java
index 938ee58..b9096fa 100644
--- a/src/com/android/server/telecom/TransactionalServiceWrapper.java
+++ b/src/com/android/server/telecom/TransactionalServiceWrapper.java
@@ -43,10 +43,10 @@
import com.android.server.telecom.voip.HoldCallTransaction;
import com.android.server.telecom.voip.EndCallTransaction;
import com.android.server.telecom.voip.MaybeHoldCallForNewCallTransaction;
-import com.android.server.telecom.voip.ParallelTransaction;
import com.android.server.telecom.voip.RequestNewActiveCallTransaction;
import com.android.server.telecom.voip.SerialTransaction;
import com.android.server.telecom.voip.SetMuteStateTransaction;
+import com.android.server.telecom.voip.RequestVideoStateTransaction;
import com.android.server.telecom.voip.TransactionManager;
import com.android.server.telecom.voip.VoipCallTransaction;
import com.android.server.telecom.voip.VoipCallTransactionResult;
@@ -71,6 +71,7 @@
public static final String ANSWER = "Answer";
public static final String DISCONNECT = "Disconnect";
public static final String START_STREAMING = "StartStreaming";
+ public static final String REQUEST_VIDEO_STATE = "RequestVideoState";
// CallEventCallback : Telecom --> Client (ex. voip app)
public static final String ON_SET_ACTIVE = "onSetActive";
@@ -248,6 +249,17 @@
}
}
+ @Override
+ public void requestVideoState(int videoState, String callId, ResultReceiver callback)
+ throws RemoteException {
+ try {
+ Log.startSession("TSW.rVS");
+ createTransactions(callId, callback, REQUEST_VIDEO_STATE, videoState);
+ } finally {
+ Log.endSession();
+ }
+ }
+
private void createTransactions(String callId, ResultReceiver callback, String action,
Object... objects) {
Log.d(TAG, "createTransactions: callId=" + callId);
@@ -274,6 +286,11 @@
addTransactionsToManager(mStreamingController.getStartStreamingTransaction(mCallsManager,
TransactionalServiceWrapper.this, call, mLock), callback);
break;
+ case REQUEST_VIDEO_STATE:
+ addTransactionsToManager(
+ new RequestVideoStateTransaction(mCallsManager, call,
+ (int) objects[0]), callback);
+ break;
}
} else {
Bundle exceptionBundle = new Bundle();
@@ -562,6 +579,15 @@
}
}
+ public void onVideoStateChanged(Call call, int videoState) {
+ if (call != null) {
+ try {
+ mICallEventCallback.onVideoStateChanged(call.getId(), videoState);
+ } catch (RemoteException e) {
+ }
+ }
+ }
+
public void removeCallFromWrappers(Call call) {
if (call != null) {
try {
diff --git a/src/com/android/server/telecom/callfiltering/BlockCheckerAdapter.java b/src/com/android/server/telecom/callfiltering/BlockCheckerAdapter.java
index a83f314..1fda542 100644
--- a/src/com/android/server/telecom/callfiltering/BlockCheckerAdapter.java
+++ b/src/com/android/server/telecom/callfiltering/BlockCheckerAdapter.java
@@ -34,22 +34,24 @@
*
* @param context the context of the caller.
* @param phoneNumber the number to check.
- * @param extras the extra attribute of the number.
+ * @param numberPresentation the presentation code associated with the call.
+ * @param isNumberInContacts indicates if the provided number exists as a contact.
* @return result code indicating if the number should be blocked, and if so why.
- * Valid values are: {@link BlockedNumberContract#STATUS_NOT_BLOCKED},
- * {@link BlockedNumberContract#STATUS_BLOCKED_IN_LIST},
- * {@link BlockedNumberContract#STATUS_BLOCKED_NOT_IN_CONTACTS},
- * {@link BlockedNumberContract#STATUS_BLOCKED_PAYPHONE},
- * {@link BlockedNumberContract#STATUS_BLOCKED_RESTRICTED},
- * {@link BlockedNumberContract#STATUS_BLOCKED_UNKNOWN_NUMBER}.
+ * Valid values are: {@link BlockCheckerFilter#STATUS_NOT_BLOCKED},
+ * {@link BlockCheckerFilter#STATUS_BLOCKED_IN_LIST},
+ * {@link BlockCheckerFilter#STATUS_BLOCKED_NOT_IN_CONTACTS},
+ * {@link BlockCheckerFilter#STATUS_BLOCKED_PAYPHONE},
+ * {@link BlockCheckerFilter#STATUS_BLOCKED_RESTRICTED},
+ * {@link BlockCheckerFilter#STATUS_BLOCKED_UNKNOWN_NUMBER}.
*/
- public int getBlockStatus(Context context, String phoneNumber, Bundle extras) {
+ public int getBlockStatus(Context context, String phoneNumber,
+ int numberPresentation, boolean isNumberInContacts) {
int blockStatus = BlockedNumberContract.STATUS_NOT_BLOCKED;
long startTimeNano = System.nanoTime();
try {
- blockStatus = BlockedNumberContract.SystemContract.shouldSystemBlockNumber(
- context, phoneNumber, extras);
+ blockStatus = BlockedNumberContract.BlockedNumbers.shouldSystemBlockNumber(
+ context, phoneNumber, numberPresentation, isNumberInContacts);
if (blockStatus != BlockedNumberContract.STATUS_NOT_BLOCKED) {
Log.d(TAG, phoneNumber + " is blocked.");
}
diff --git a/src/com/android/server/telecom/callfiltering/BlockCheckerFilter.java b/src/com/android/server/telecom/callfiltering/BlockCheckerFilter.java
index 64060c8..5beb5f0 100644
--- a/src/com/android/server/telecom/callfiltering/BlockCheckerFilter.java
+++ b/src/com/android/server/telecom/callfiltering/BlockCheckerFilter.java
@@ -48,6 +48,61 @@
public static final long CALLER_INFO_QUERY_TIMEOUT = 5000;
+ /**
+ * Integer reason indicating whether a call was blocked, and if so why.
+ * @hide
+ */
+ public static final String RES_BLOCK_STATUS = "block_status";
+
+ /**
+ * Integer reason code used with {@link #RES_BLOCK_STATUS} to indicate that a call was not
+ * blocked.
+ * @hide
+ */
+ public static final int STATUS_NOT_BLOCKED = 0;
+
+ /**
+ * Integer reason code used with {@link #RES_BLOCK_STATUS} to indicate that a call was blocked
+ * because it is in the list of blocked numbers maintained by the provider.
+ * @hide
+ */
+ public static final int STATUS_BLOCKED_IN_LIST = 1;
+
+ /**
+ * Integer reason code used with {@link #RES_BLOCK_STATUS} to indicate that a call was blocked
+ * because it is from a restricted number.
+ * @hide
+ */
+ public static final int STATUS_BLOCKED_RESTRICTED = 2;
+
+ /**
+ * Integer reason code used with {@link #RES_BLOCK_STATUS} to indicate that a call was blocked
+ * because it is from an unknown number.
+ * @hide
+ */
+ public static final int STATUS_BLOCKED_UNKNOWN_NUMBER = 3;
+
+ /**
+ * Integer reason code used with {@link #RES_BLOCK_STATUS} to indicate that a call was blocked
+ * because it is from a pay phone.
+ * @hide
+ */
+ public static final int STATUS_BLOCKED_PAYPHONE = 4;
+
+ /**
+ * Integer reason code used with {@link #RES_BLOCK_STATUS} to indicate that a call was blocked
+ * because it is from a number not in the users contacts.
+ * @hide
+ */
+ public static final int STATUS_BLOCKED_NOT_IN_CONTACTS = 5;
+
+ /**
+ * Integer reason code used with {@link #RES_BLOCK_STATUS} to indicate that a call was blocked
+ * because it is from a number not available.
+ * @hide
+ */
+ public static final int STATUS_BLOCKED_UNAVAILABLE = 6;
+
public BlockCheckerFilter(Context context, Call call,
CallerInfoLookupHelper callerInfoLookupHelper,
BlockCheckerAdapter blockCheckerAdapter) {
@@ -96,14 +151,21 @@
private void getBlockStatus(
CompletableFuture<CallFilteringResult> resultFuture) {
- // Set extras
- Bundle extras = new Bundle();
+ // Set presentation and if contact exists. Used in determining if the system should block
+ // the passed in number. Use default values as they would be returned if the keys didn't
+ // exist in the extras to maintain existing behavior.
+ int presentation;
+ boolean isNumberInContacts;
if (BlockedNumbersUtil.isEnhancedCallBlockingEnabledByPlatform(mContext)) {
- int presentation = mCall.getHandlePresentation();
- extras.putInt(BlockedNumberContract.EXTRA_CALL_PRESENTATION, presentation);
- if (presentation == TelecomManager.PRESENTATION_ALLOWED) {
- extras.putBoolean(BlockedNumberContract.EXTRA_CONTACT_EXIST, mContactExists);
- }
+ presentation = mCall.getHandlePresentation();
+ } else {
+ presentation = 0;
+ }
+
+ if (presentation == TelecomManager.PRESENTATION_ALLOWED) {
+ isNumberInContacts = mContactExists;
+ } else {
+ isNumberInContacts = false;
}
// Set number
@@ -111,7 +173,8 @@
mCall.getHandle().getSchemeSpecificPart();
CompletableFuture.supplyAsync(
- () -> mBlockCheckerAdapter.getBlockStatus(mContext, number, extras),
+ () -> mBlockCheckerAdapter.getBlockStatus(mContext, number,
+ presentation, isNumberInContacts),
new LoggedHandlerExecutor(mHandler, "BCF.gBS", null))
.thenApplyAsync((x) -> completeResult(resultFuture, x),
new LoggedHandlerExecutor(mHandler, "BCF.gBS", null));
@@ -120,7 +183,7 @@
private int completeResult(CompletableFuture<CallFilteringResult> resultFuture,
int blockStatus) {
CallFilteringResult result;
- if (blockStatus != BlockedNumberContract.STATUS_NOT_BLOCKED) {
+ if (blockStatus != STATUS_NOT_BLOCKED) {
result = new CallFilteringResult.Builder()
.setShouldAllowCall(false)
.setShouldReject(true)
@@ -143,8 +206,7 @@
.build();
}
Log.addEvent(mCall, LogUtils.Events.BLOCK_CHECK_FINISHED,
- BlockedNumberContract.SystemContract.blockStatusToString(blockStatus) + " "
- + result);
+ blockStatusToString(blockStatus) + " " + result);
resultFuture.complete(result);
mHandlerThread.quitSafely();
return blockStatus;
@@ -152,20 +214,20 @@
private int getBlockReason(int blockStatus) {
switch (blockStatus) {
- case BlockedNumberContract.STATUS_BLOCKED_IN_LIST:
+ case STATUS_BLOCKED_IN_LIST:
return CallLog.Calls.BLOCK_REASON_BLOCKED_NUMBER;
- case BlockedNumberContract.STATUS_BLOCKED_UNKNOWN_NUMBER:
- case BlockedNumberContract.STATUS_BLOCKED_UNAVAILABLE:
+ case STATUS_BLOCKED_UNKNOWN_NUMBER:
+ case STATUS_BLOCKED_UNAVAILABLE:
return CallLog.Calls.BLOCK_REASON_UNKNOWN_NUMBER;
- case BlockedNumberContract.STATUS_BLOCKED_RESTRICTED:
+ case STATUS_BLOCKED_RESTRICTED:
return CallLog.Calls.BLOCK_REASON_RESTRICTED_NUMBER;
- case BlockedNumberContract.STATUS_BLOCKED_PAYPHONE:
+ case STATUS_BLOCKED_PAYPHONE:
return CallLog.Calls.BLOCK_REASON_PAY_PHONE;
- case BlockedNumberContract.STATUS_BLOCKED_NOT_IN_CONTACTS:
+ case STATUS_BLOCKED_NOT_IN_CONTACTS:
return CallLog.Calls.BLOCK_REASON_NOT_IN_CONTACTS;
default:
@@ -174,4 +236,27 @@
return CallLog.Calls.BLOCK_REASON_BLOCKED_NUMBER;
}
}
+
+ /**
+ * Converts a block status constant to a string equivalent for logging.
+ */
+ private String blockStatusToString(int blockStatus) {
+ switch (blockStatus) {
+ case STATUS_NOT_BLOCKED:
+ return "not blocked";
+ case STATUS_BLOCKED_IN_LIST:
+ return "blocked - in list";
+ case STATUS_BLOCKED_RESTRICTED:
+ return "blocked - restricted";
+ case STATUS_BLOCKED_UNKNOWN_NUMBER:
+ return "blocked - unknown";
+ case STATUS_BLOCKED_PAYPHONE:
+ return "blocked - payphone";
+ case STATUS_BLOCKED_NOT_IN_CONTACTS:
+ return "blocked - not in contacts";
+ case STATUS_BLOCKED_UNAVAILABLE:
+ return "blocked - unavailable";
+ }
+ return "unknown";
+ }
}
diff --git a/src/com/android/server/telecom/callfiltering/BlockedNumbersAdapter.java b/src/com/android/server/telecom/callfiltering/BlockedNumbersAdapter.java
index b8658d8..f640826 100644
--- a/src/com/android/server/telecom/callfiltering/BlockedNumbersAdapter.java
+++ b/src/com/android/server/telecom/callfiltering/BlockedNumbersAdapter.java
@@ -20,7 +20,7 @@
/**
* Adapter interface that wraps methods from
- * {@link android.provider.BlockedNumberContract.SystemContract} and
+ * {@link android.provider.BlockedNumberContract.BlockedNumbers} and
* {@link com.android.server.telecom.settings.BlockedNumbersUtil} to make things testable.
*/
public interface BlockedNumbersAdapter {
diff --git a/src/com/android/server/telecom/components/TelecomService.java b/src/com/android/server/telecom/components/TelecomService.java
index 9287d33..24e5d57 100644
--- a/src/com/android/server/telecom/components/TelecomService.java
+++ b/src/com/android/server/telecom/components/TelecomService.java
@@ -223,7 +223,7 @@
@Override
public boolean shouldShowEmergencyCallNotification(Context
context) {
- return BlockedNumberContract.SystemContract
+ return BlockedNumberContract.BlockedNumbers
.shouldShowEmergencyCallNotification(context);
}
diff --git a/src/com/android/server/telecom/settings/BlockedNumbersActivity.java b/src/com/android/server/telecom/settings/BlockedNumbersActivity.java
index 5fa5f06..819b270 100644
--- a/src/com/android/server/telecom/settings/BlockedNumbersActivity.java
+++ b/src/com/android/server/telecom/settings/BlockedNumbersActivity.java
@@ -155,7 +155,7 @@
}
};
IntentFilter blockStatusIntentFilter = new IntentFilter(
- BlockedNumberContract.SystemContract.ACTION_BLOCK_SUPPRESSION_STATE_CHANGED);
+ BlockedNumberContract.BlockedNumbers.ACTION_BLOCK_SUPPRESSION_STATE_CHANGED);
blockStatusIntentFilter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
registerReceiver(mBlockingStatusReceiver, blockStatusIntentFilter,
Context.RECEIVER_EXPORTED);
@@ -183,7 +183,8 @@
}
private void updateButterBar() {
- if (BlockedNumberContract.SystemContract.getBlockSuppressionStatus(this).isSuppressed) {
+ if (BlockedNumberContract.BlockedNumbers
+ .getBlockSuppressionStatus(this).getIsSuppressed()) {
mButterBar.setVisibility(View.VISIBLE);
} else {
mButterBar.setVisibility(View.GONE);
@@ -238,7 +239,7 @@
if (view == mAddButton) {
showAddBlockedNumberDialog();
} else if (view == mReEnableButton) {
- BlockedNumberContract.SystemContract.endBlockSuppression(this);
+ BlockedNumberContract.BlockedNumbers.endBlockSuppression(this);
mButterBar.setVisibility(View.GONE);
}
}
diff --git a/src/com/android/server/telecom/settings/BlockedNumbersUtil.java b/src/com/android/server/telecom/settings/BlockedNumbersUtil.java
index 4be75f8..e0fe81e 100644
--- a/src/com/android/server/telecom/settings/BlockedNumbersUtil.java
+++ b/src/com/android/server/telecom/settings/BlockedNumbersUtil.java
@@ -23,7 +23,7 @@
import android.content.Intent;
import android.os.PersistableBundle;
import android.os.UserHandle;
-import android.provider.BlockedNumberContract.SystemContract;
+import android.provider.BlockedNumberContract.BlockedNumbers;
import android.telephony.CarrierConfigManager;
import android.telephony.PhoneNumberUtils;
import android.text.BidiFormatter;
@@ -148,8 +148,8 @@
* @return If {@code true} means the key enabled in the SharedPreferences,
* {@code false} otherwise.
*/
- public static boolean getEnhancedBlockSetting(Context context, String key) {
- return SystemContract.getEnhancedBlockSetting(context, key);
+ public static boolean getBlockedNumberSetting(Context context, String key) {
+ return BlockedNumbers.getBlockedNumberSetting(context, key);
}
/**
@@ -159,7 +159,7 @@
* @param key preference key of SharedPreferences.
* @param value the register value to the SharedPreferences.
*/
- public static void setEnhancedBlockSetting(Context context, String key, boolean value) {
- SystemContract.setEnhancedBlockSetting(context, key, value);
+ public static void setBlockedNumberSetting(Context context, String key, boolean value) {
+ BlockedNumbers.setBlockedNumberSetting(context, key, value);
}
}
diff --git a/src/com/android/server/telecom/settings/CallBlockDisabledActivity.java b/src/com/android/server/telecom/settings/CallBlockDisabledActivity.java
index 5f42b37..35b7f70 100644
--- a/src/com/android/server/telecom/settings/CallBlockDisabledActivity.java
+++ b/src/com/android/server/telecom/settings/CallBlockDisabledActivity.java
@@ -58,9 +58,9 @@
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- BlockedNumbersUtil.setEnhancedBlockSetting(
+ BlockedNumbersUtil.setBlockedNumberSetting(
CallBlockDisabledActivity.this,
- BlockedNumberContract.SystemContract
+ BlockedNumberContract.BlockedNumbers
.ENHANCED_SETTING_KEY_SHOW_EMERGENCY_CALL_NOTIFICATION,
false);
BlockedNumbersUtil.updateEmergencyCallNotification(
diff --git a/src/com/android/server/telecom/settings/EnhancedCallBlockingFragment.java b/src/com/android/server/telecom/settings/EnhancedCallBlockingFragment.java
index b1a1b0e..7ea8926 100644
--- a/src/com/android/server/telecom/settings/EnhancedCallBlockingFragment.java
+++ b/src/com/android/server/telecom/settings/EnhancedCallBlockingFragment.java
@@ -23,12 +23,11 @@
import android.preference.PreferenceFragment;
import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;
-import android.provider.BlockedNumberContract.SystemContract;
+import android.provider.BlockedNumberContract.BlockedNumbers;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telecom.Log;
import android.view.LayoutInflater;
-import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
@@ -54,13 +53,14 @@
maybeConfigureCallBlockingOptions();
- setOnPreferenceChangeListener(SystemContract.ENHANCED_SETTING_KEY_BLOCK_UNREGISTERED);
- setOnPreferenceChangeListener(SystemContract.ENHANCED_SETTING_KEY_BLOCK_PRIVATE);
- setOnPreferenceChangeListener(SystemContract.ENHANCED_SETTING_KEY_BLOCK_PAYPHONE);
- setOnPreferenceChangeListener(SystemContract.ENHANCED_SETTING_KEY_BLOCK_UNKNOWN);
- setOnPreferenceChangeListener(SystemContract.ENHANCED_SETTING_KEY_BLOCK_UNAVAILABLE);
+ setOnPreferenceChangeListener(BlockedNumbers.ENHANCED_SETTING_KEY_BLOCK_UNREGISTERED);
+ setOnPreferenceChangeListener(BlockedNumbers.ENHANCED_SETTING_KEY_BLOCK_PRIVATE);
+ setOnPreferenceChangeListener(BlockedNumbers.ENHANCED_SETTING_KEY_BLOCK_PAYPHONE);
+ setOnPreferenceChangeListener(BlockedNumbers.ENHANCED_SETTING_KEY_BLOCK_UNKNOWN);
+ setOnPreferenceChangeListener(BlockedNumbers.ENHANCED_SETTING_KEY_BLOCK_UNAVAILABLE);
if (!showPayPhoneBlocking()) {
- Preference payPhoneOption = getPreferenceScreen().findPreference(SystemContract.ENHANCED_SETTING_KEY_BLOCK_PAYPHONE);
+ Preference payPhoneOption = getPreferenceScreen()
+ .findPreference(BlockedNumbers.ENHANCED_SETTING_KEY_BLOCK_PAYPHONE);
getPreferenceScreen().removePreference(payPhoneOption);
}
}
@@ -122,13 +122,13 @@
public void onResume() {
super.onResume();
- updateEnhancedBlockPref(SystemContract.ENHANCED_SETTING_KEY_BLOCK_UNREGISTERED);
- updateEnhancedBlockPref(SystemContract.ENHANCED_SETTING_KEY_BLOCK_PRIVATE);
+ updateEnhancedBlockPref(BlockedNumbers.ENHANCED_SETTING_KEY_BLOCK_UNREGISTERED);
+ updateEnhancedBlockPref(BlockedNumbers.ENHANCED_SETTING_KEY_BLOCK_PRIVATE);
if (showPayPhoneBlocking()) {
- updateEnhancedBlockPref(SystemContract.ENHANCED_SETTING_KEY_BLOCK_PAYPHONE);
+ updateEnhancedBlockPref(BlockedNumbers.ENHANCED_SETTING_KEY_BLOCK_PAYPHONE);
}
- updateEnhancedBlockPref(SystemContract.ENHANCED_SETTING_KEY_BLOCK_UNKNOWN);
- updateEnhancedBlockPref(SystemContract.ENHANCED_SETTING_KEY_BLOCK_UNAVAILABLE);
+ updateEnhancedBlockPref(BlockedNumbers.ENHANCED_SETTING_KEY_BLOCK_UNKNOWN);
+ updateEnhancedBlockPref(BlockedNumbers.ENHANCED_SETTING_KEY_BLOCK_UNAVAILABLE);
}
/**
@@ -137,7 +137,7 @@
private void updateEnhancedBlockPref(String key) {
SwitchPreference pref = (SwitchPreference) findPreference(key);
if (pref != null) {
- pref.setChecked(BlockedNumbersUtil.getEnhancedBlockSetting(getActivity(), key));
+ pref.setChecked(BlockedNumbersUtil.getBlockedNumberSetting(getActivity(), key));
}
}
@@ -147,18 +147,18 @@
if (mIsCombiningRestrictedAndUnknownOption) {
Log.i(this, "onPreferenceChange: changing %s and %s to %b",
preference.getKey(), BLOCK_RESTRICTED_NUMBERS_KEY, (boolean) objValue);
- BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(),
+ BlockedNumbersUtil.setBlockedNumberSetting(getActivity(),
BLOCK_RESTRICTED_NUMBERS_KEY, (boolean) objValue);
}
if (mIsCombiningUnavailableAndUnknownOption) {
Log.i(this, "onPreferenceChange: changing %s and %s to %b",
preference.getKey(), BLOCK_UNAVAILABLE_NUMBERS_KEY, (boolean) objValue);
- BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(),
+ BlockedNumbersUtil.setBlockedNumberSetting(getActivity(),
BLOCK_UNAVAILABLE_NUMBERS_KEY, (boolean) objValue);
}
}
- BlockedNumbersUtil.setEnhancedBlockSetting(getActivity(), preference.getKey(),
+ BlockedNumbersUtil.setBlockedNumberSetting(getActivity(), preference.getKey(),
(boolean) objValue);
return true;
}
diff --git a/src/com/android/server/telecom/voip/RequestVideoStateTransaction.java b/src/com/android/server/telecom/voip/RequestVideoStateTransaction.java
new file mode 100644
index 0000000..64596b1
--- /dev/null
+++ b/src/com/android/server/telecom/voip/RequestVideoStateTransaction.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.telecom.voip;
+
+import static com.android.server.telecom.voip.VideoStateTranslation.TransactionalVideoStateToVideoProfileState;
+
+import android.telecom.VideoProfile;
+import android.util.Log;
+
+import com.android.server.telecom.CallsManager;
+import com.android.server.telecom.Call;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionStage;
+
+public class RequestVideoStateTransaction extends VoipCallTransaction {
+
+ private static final String TAG = RequestVideoStateTransaction.class.getSimpleName();
+ private final Call mCall;
+ private final int mVideoProfileState;
+
+ public RequestVideoStateTransaction(CallsManager callsManager, Call call,
+ int transactionalVideoState) {
+ super(callsManager.getLock());
+ mCall = call;
+ mVideoProfileState = TransactionalVideoStateToVideoProfileState(transactionalVideoState);
+ }
+
+ @Override
+ public CompletionStage<VoipCallTransactionResult> processTransaction(Void v) {
+ Log.d(TAG, "processTransaction");
+ CompletableFuture<VoipCallTransactionResult> future = new CompletableFuture<>();
+
+ if (isRequestingVideoTransmission(mVideoProfileState) &&
+ !mCall.isVideoCallingSupportedByPhoneAccount()) {
+ future.complete(new VoipCallTransactionResult(
+ VoipCallTransactionResult.RESULT_FAILED,
+ "Video calling is not supported by the target account"));
+ } else if (isRequestingVideoTransmission(mVideoProfileState) &&
+ !mCall.isTransactionalCallSupportsVideoCalling()) {
+ future.complete(new VoipCallTransactionResult(
+ VoipCallTransactionResult.RESULT_FAILED,
+ "Video calling is not supported according to the callAttributes"));
+ } else {
+ mCall.setVideoState(mVideoProfileState);
+ future.complete(new VoipCallTransactionResult(
+ VoipCallTransactionResult.RESULT_SUCCEED,
+ "The Video State was changed successfully"));
+ }
+ return future;
+ }
+
+ private boolean isRequestingVideoTransmission(int targetVideoState) {
+ return targetVideoState != VideoProfile.STATE_AUDIO_ONLY;
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/server/telecom/voip/VideoStateTranslation.java b/src/com/android/server/telecom/voip/VideoStateTranslation.java
new file mode 100644
index 0000000..615e4bc
--- /dev/null
+++ b/src/com/android/server/telecom/voip/VideoStateTranslation.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server.telecom.voip;
+
+import android.telecom.CallAttributes;
+import android.telecom.Log;
+import android.telecom.VideoProfile;
+
+/**
+ * This remapping class is needed because {@link VideoProfile} has more fine grain levels of video
+ * states as apposed to Transactional video states (defined in {@link CallAttributes.CallType}.
+ * To be more specific, there are 3 video states (rx, tx, and bi-directional).
+ * {@link CallAttributes.CallType} only has 2 states (audio and video).
+ *
+ * The reason why Transactional calls have fewer states is due to the fact that the framework is
+ * only used by VoIP apps and Telecom only cares to know if the call is audio or video.
+ *
+ * Calls that are backed by a {@link android.telecom.ConnectionService} have the ability to be
+ * managed calls (non-VoIP) and Dialer needs more fine grain video states to update the UI. Thus,
+ * {@link VideoProfile} is used for {@link android.telecom.ConnectionService} backed calls.
+ */
+public class VideoStateTranslation {
+ private static final String TAG = VideoStateTranslation.class.getSimpleName();
+
+ /**
+ * Client --> Telecom
+ * This should be used when the client application is signaling they are changing the video
+ * state.
+ */
+ public static int TransactionalVideoStateToVideoProfileState(int transactionalVideo) {
+ if (transactionalVideo == CallAttributes.AUDIO_CALL) {
+ Log.i(TAG, "%s --> VideoProfile.STATE_AUDIO_ONLY",
+ TransactionalVideoState_toString(transactionalVideo));
+ return VideoProfile.STATE_AUDIO_ONLY;
+ } else {
+ Log.i(TAG, "%s --> VideoProfile.STATE_BIDIRECTIONAL",
+ TransactionalVideoState_toString(transactionalVideo));
+ return VideoProfile.STATE_BIDIRECTIONAL;
+ }
+ }
+
+ /**
+ * Telecom --> Client
+ * This should be used when Telecom is informing the client of a video state change.
+ */
+ public static int VideoProfileStateToTransactionalVideoState(int videoProfileState) {
+ if (videoProfileState == VideoProfile.STATE_AUDIO_ONLY) {
+ Log.i(TAG, "%s --> CallAttributes.AUDIO_CALL",
+ VideoProfileState_toString(videoProfileState));
+ return CallAttributes.AUDIO_CALL;
+ } else {
+ Log.i(TAG, "%s --> CallAttributes.VIDEO_CALL",
+ VideoProfileState_toString(videoProfileState));
+ return CallAttributes.VIDEO_CALL;
+ }
+ }
+
+ private static String TransactionalVideoState_toString(int transactionalVideoState) {
+ if (transactionalVideoState == CallAttributes.AUDIO_CALL) {
+ return "CallAttributes.AUDIO_CALL";
+ } else {
+ return "CallAttributes.VIDEO_CALL";
+ }
+ }
+
+ private static String VideoProfileState_toString(int videoProfileState) {
+ switch (videoProfileState) {
+ case VideoProfile.STATE_BIDIRECTIONAL -> {
+ return "VideoProfile.STATE_BIDIRECTIONAL";
+ }
+ case VideoProfile.STATE_RX_ENABLED -> {
+ return "VideoProfile.STATE_RX_ENABLED";
+ }
+ case VideoProfile.STATE_TX_ENABLED -> {
+ return "VideoProfile.STATE_TX_ENABLED";
+ }
+ }
+ return "VideoProfile.STATE_AUDIO_ONLY";
+ }
+}
diff --git a/testapps/src/com/android/server/telecom/testapps/TestInCallUI.java b/testapps/src/com/android/server/telecom/testapps/TestInCallUI.java
index bdd4c1a..d2aca78 100644
--- a/testapps/src/com/android/server/telecom/testapps/TestInCallUI.java
+++ b/testapps/src/com/android/server/telecom/testapps/TestInCallUI.java
@@ -40,6 +40,8 @@
import android.widget.TextView;
import android.widget.Toast;
+import com.android.server.telecom.flags.Flags;
+
import java.util.Collection;
import java.util.List;
import java.util.Optional;
@@ -263,6 +265,8 @@
.getIntentExtras().getString(TelecomManager.EXTRA_CALL_SUBJECT);
boolean isBusiness = call.getDetails()
.getExtras().getBoolean(ImsCallProfile.EXTRA_IS_BUSINESS_CALL);
+ String businessName = call.getDetails()
+ .getExtras().getString(ImsCallProfile.EXTRA_ASSERTED_DISPLAY_NAME);
StringBuilder display = new StringBuilder();
display.append("priority=");
@@ -286,6 +290,7 @@
display.append(" subject=" + subject);
display.append(" isBusiness=" + isBusiness);
+ display.append(" businessName=" + businessName);
TextView attachmentsTextView = findViewById(R.id.incoming_composer_attachments);
attachmentsTextView.setText(display.toString());
break;
diff --git a/tests/src/com/android/server/telecom/tests/BasicCallTests.java b/tests/src/com/android/server/telecom/tests/BasicCallTests.java
index 9ca3de1..4bca30d 100644
--- a/tests/src/com/android/server/telecom/tests/BasicCallTests.java
+++ b/tests/src/com/android/server/telecom/tests/BasicCallTests.java
@@ -16,6 +16,8 @@
package com.android.server.telecom.tests;
+import static com.android.server.telecom.callfiltering.BlockCheckerFilter.RES_BLOCK_STATUS;
+import static com.android.server.telecom.callfiltering.BlockCheckerFilter.STATUS_BLOCKED_IN_LIST;
import static com.android.server.telecom.tests.ConnectionServiceFixture.STATUS_HINTS_EXTRA;
import static org.junit.Assert.assertEquals;
@@ -887,8 +889,7 @@
@Override
public Bundle answer(InvocationOnMock invocation) throws Throwable {
Bundle bundle = new Bundle();
- bundle.putInt(BlockedNumberContract.RES_BLOCK_STATUS,
- BlockedNumberContract.STATUS_BLOCKED_IN_LIST);
+ bundle.putInt(RES_BLOCK_STATUS, STATUS_BLOCKED_IN_LIST);
return bundle;
}
});
diff --git a/tests/src/com/android/server/telecom/tests/BlockCheckerFilterTest.java b/tests/src/com/android/server/telecom/tests/BlockCheckerFilterTest.java
index 2584b02..e76989c 100644
--- a/tests/src/com/android/server/telecom/tests/BlockCheckerFilterTest.java
+++ b/tests/src/com/android/server/telecom/tests/BlockCheckerFilterTest.java
@@ -16,12 +16,14 @@
package com.android.server.telecom.tests;
-import static android.provider.BlockedNumberContract.STATUS_BLOCKED_IN_LIST;
-import static android.provider.BlockedNumberContract.STATUS_NOT_BLOCKED;
+import static com.android.server.telecom.callfiltering.BlockCheckerFilter.STATUS_BLOCKED_IN_LIST;
+import static com.android.server.telecom.callfiltering.BlockCheckerFilter.STATUS_NOT_BLOCKED;
import static junit.framework.TestCase.assertEquals;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
@@ -93,7 +95,7 @@
@Test
public void testBlockNumber() throws Exception {
when(mBlockCheckerAdapter.getBlockStatus(any(Context.class),
- eq(TEST_HANDLE.getSchemeSpecificPart()), any(Bundle.class)))
+ eq(TEST_HANDLE.getSchemeSpecificPart()), anyInt(), anyBoolean()))
.thenReturn(STATUS_BLOCKED_IN_LIST);
setEnhancedBlockingEnabled(false);
@@ -105,7 +107,7 @@
@Test
public void testBlockNumberWhenEnhancedBlockingEnabled() throws Exception {
when(mBlockCheckerAdapter.getBlockStatus(any(Context.class),
- eq(TEST_HANDLE.getSchemeSpecificPart()), any(Bundle.class)))
+ eq(TEST_HANDLE.getSchemeSpecificPart()), anyInt(), anyBoolean()))
.thenReturn(STATUS_BLOCKED_IN_LIST);
setEnhancedBlockingEnabled(true);
@@ -119,7 +121,7 @@
@Test
public void testDontBlockNumber() throws Exception {
when(mBlockCheckerAdapter.getBlockStatus(any(Context.class),
- eq(TEST_HANDLE.getSchemeSpecificPart()), any(Bundle.class)))
+ eq(TEST_HANDLE.getSchemeSpecificPart()), anyInt(), anyBoolean()))
.thenReturn(STATUS_NOT_BLOCKED);
setEnhancedBlockingEnabled(false);
@@ -131,7 +133,7 @@
@Test
public void testDontBlockNumberWhenEnhancedBlockingEnabled() throws Exception {
when(mBlockCheckerAdapter.getBlockStatus(any(Context.class),
- eq(TEST_HANDLE.getSchemeSpecificPart()), any(Bundle.class)))
+ eq(TEST_HANDLE.getSchemeSpecificPart()), anyInt(), anyBoolean()))
.thenReturn(STATUS_NOT_BLOCKED);
setEnhancedBlockingEnabled(true);
diff --git a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
index 670875b..1529629 100644
--- a/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
+++ b/tests/src/com/android/server/telecom/tests/CallsManagerTest.java
@@ -3197,7 +3197,7 @@
.thenReturn(true);
mComponentContextFixture.getBroadcastReceivers().forEach(c -> c.onReceive(mContext,
new Intent(
- BlockedNumberContract.SystemContract
+ BlockedNumberContract.BlockedNumbers
.ACTION_BLOCK_SUPPRESSION_STATE_CHANGED)));
verify(mBlockedNumbersAdapter).updateEmergencyCallNotification(any(Context.class),
eq(true));
@@ -3206,7 +3206,7 @@
.thenReturn(false);
mComponentContextFixture.getBroadcastReceivers().forEach(c -> c.onReceive(mContext,
new Intent(
- BlockedNumberContract.SystemContract
+ BlockedNumberContract.BlockedNumbers
.ACTION_BLOCK_SUPPRESSION_STATE_CHANGED)));
verify(mBlockedNumbersAdapter).updateEmergencyCallNotification(any(Context.class),
eq(false));