DSDA - Add support up to 4 calls for Add Call

- Currently, the limit for the number of calls is 2.
  When the limit is reached, the "Add Call" button
  is removed from the UI
- For DSDA, modify the logic, to allow 4 calls and update
  when notified when there is a transition from
  DSDA -> DSDS, and vice versa.

Change-Id: I45b5246557f8ea77ad8b64529b4668e448d875f5
CRs-Fixed: 3037711
This commit is contained in:
Wileen Chiu 2021-09-14 14:08:12 -07:00
parent b3288f4594
commit 844465e383
2 changed files with 11 additions and 1 deletions

View File

@ -56,6 +56,7 @@
<uses-permission android:name="android.permission.READ_BLOCKED_NUMBERS"/>
<uses-permission android:name="android.permission.WRITE_BLOCKED_NUMBERS"/>
<uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME"/>
<uses-permission android:name="com.qti.permission.RECEIVE_MSIM_VOICE_CAPABILITY_CHANGED"/>
<permission android:name="android.permission.BROADCAST_CALLLOG_INFO"
android:label="Broadcast the call type/duration information"

View File

@ -225,6 +225,7 @@ public class CallsManager extends Call.ListenerBase
private static final int MAXIMUM_DIALING_CALLS = 1;
private static final int MAXIMUM_OUTGOING_CALLS = 1;
private static final int MAXIMUM_TOP_LEVEL_CALLS = 2;
private static final int MAXIMUM_TOP_LEVEL_CALLS_DSDA = 4;
private static final int MAXIMUM_SELF_MANAGED_CALLS = 10;
private static final int[] OUTGOING_CALL_STATES =
@ -414,6 +415,8 @@ public class CallsManager extends Call.ListenerBase
// Stored within intent extras and should be removed once the dialog is shown
private final String EXTRA_KEY_DISPLAY_ERROR_DIALOG = "EXTRA_KEY_DISPLAY_ERROR_DIALOG";
private final String ACTION_MSIM_VOICE_CAPABILITY_CHANGED =
"org.codeaurora.intent.action.MSIM_VOICE_CAPABILITY_CHANGED";
/**
* Listener to PhoneAccountRegistrar events.
*/
@ -450,6 +453,8 @@ public class CallsManager extends Call.ListenerBase
|| SystemContract.ACTION_BLOCK_SUPPRESSION_STATE_CHANGED.equals(action)) {
new UpdateEmergencyCallNotificationTask().doInBackground(
Pair.create(context, Log.createSubsession()));
} else if (ACTION_MSIM_VOICE_CAPABILITY_CHANGED.equals(action)) {
updateCanAddCall();
}
}
};
@ -611,6 +616,7 @@ public class CallsManager extends Call.ListenerBase
IntentFilter intentFilter = new IntentFilter(
CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
intentFilter.addAction(SystemContract.ACTION_BLOCK_SUPPRESSION_STATE_CHANGED);
intentFilter.addAction(ACTION_MSIM_VOICE_CAPABILITY_CHANGED);
context.registerReceiver(mReceiver, intentFilter);
mGraphHandlerThreads = new LinkedList<>();
QtiCarrierConfigHelper.getInstance().setup(mContext);
@ -3486,6 +3492,8 @@ public class CallsManager extends Call.ListenerBase
}
int count = 0;
int maxTopLevelCalls = TelephonyManager.isConcurrentCallsPossible() ?
MAXIMUM_TOP_LEVEL_CALLS_DSDA : MAXIMUM_TOP_LEVEL_CALLS;
for (Call call : mCalls) {
if (call.isEmergencyCall()) {
// We never support add call if one of the calls is an emergency call.
@ -3508,7 +3516,8 @@ public class CallsManager extends Call.ListenerBase
// we could put InCallServices into a state where they are showing two calls but
// also support add-call. Technically it's right, but overall looks better (UI-wise)
// and acts better if we wait until the call is removed.
if (count >= MAXIMUM_TOP_LEVEL_CALLS) {
if (count >= maxTopLevelCalls) {
return false;
}
}