Loading flags/telecom_incallservice_flags.aconfig +0 −8 Original line number Diff line number Diff line Loading @@ -17,14 +17,6 @@ flag { bug: "306582821" } # OWNER=pmadapurmath TARGET=24Q3 flag { name: "separately_bind_to_bt_incall_service" namespace: "telecom" description: "Binding/Unbinding to BluetoothInCallServices in proper time to improve call audio" bug: "306395598" } # OWNER=tjstuart TARGET=24Q4 flag { name: "do_not_send_call_to_null_ics" Loading src/com/android/server/telecom/CallAudioManager.java +1 −4 Original line number Diff line number Diff line Loading @@ -787,12 +787,9 @@ public class CallAudioManager extends CallsManagerListenerBase { private void onCallEnteringRinging() { if (mRingingCalls.size() == 1) { Log.i(this, "onCallEnteringRinging: mFeatureFlags.separatelyBindToBtIncallService() ? %s", mFeatureFlags.separatelyBindToBtIncallService()); Log.i(this, "onCallEnteringRinging: mRingingCalls.getFirst().getBtIcsFuture() = %s", mRingingCalls.getFirst().getBtIcsFuture()); if (mFeatureFlags.separatelyBindToBtIncallService() && mRingingCalls.getFirst().getBtIcsFuture() != null) { if (mRingingCalls.getFirst().getBtIcsFuture() != null) { mCallRingingFuture = mRingingCalls.getFirst().getBtIcsFuture() .thenComposeAsync((completed) -> { mCallAudioModeStateMachine.sendMessageWithArgs( Loading src/com/android/server/telecom/CallsManager.java +6 −15 Original line number Diff line number Diff line Loading @@ -1097,13 +1097,8 @@ public class CallsManager extends Call.ListenerBase incomingCall.setUserMissed(USER_MISSED_CALL_FILTERS_TIMEOUT); } if (incomingCall.getState() != CallState.DISCONNECTED && incomingCall.getState() != CallState.DISCONNECTING) { if (!mFeatureFlags.separatelyBindToBtIncallService()) { setCallState(incomingCall, CallState.RINGING, result.shouldAllowCall ? "successful incoming call" : "blocking call"); } } else { if (incomingCall.getState() == CallState.DISCONNECTED || incomingCall.getState() == CallState.DISCONNECTING) { Log.i(this, "onCallFilteringCompleted: call already disconnected."); return; } Loading Loading @@ -1147,11 +1142,9 @@ public class CallsManager extends Call.ListenerBase } if (result.shouldAllowCall) { if (mFeatureFlags.separatelyBindToBtIncallService()) { mInCallController.bindToBTService(incomingCall, null); incomingCall.setBtIcsFuture(mInCallController.getBtBindingFuture(incomingCall)); setCallState(incomingCall, CallState.RINGING, "successful incoming call"); } incomingCall.setPostCallPackageName( getRoleManagerAdapter().getDefaultCallScreeningApp( incomingCall.getAssociatedUser() Loading Loading @@ -1193,9 +1186,7 @@ public class CallsManager extends Call.ListenerBase } else { if (result.shouldReject) { Log.i(this, "onCallFilteringCompleted: blocked call, rejecting."); if (mFeatureFlags.separatelyBindToBtIncallService()) { setCallState(incomingCall, CallState.RINGING, "blocking call"); } incomingCall.reject(false, null); } if (result.shouldAddToCallLog) { Loading src/com/android/server/telecom/InCallController.java +42 −70 Original line number Diff line number Diff line Loading @@ -330,8 +330,7 @@ public class InCallController extends CallsManagerListenerBase implements addCall(call); // Notify this new added call if (mFeatureFlags.separatelyBindToBtIncallService() && mInCallServiceInfo.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) { if (mInCallServiceInfo.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) { sendCallToService(call, mInCallServiceInfo, mBTInCallServices .get(userFromCall).second); } else { Loading Loading @@ -1124,8 +1123,7 @@ public class InCallController extends CallsManagerListenerBase implements // Bind to BT service if there's an available call. When the flag isn't // enabled, the service will be included as part of // getNonUiInCallServiceBindingConnectionList. if (mFeatureFlags.separatelyBindToBtIncallService() && isBluetoothPkg && callToConnectWith != null) { if (isBluetoothPkg && callToConnectWith != null) { // mNonUIInCallServiceConnections will always contain a key for // userHandle and/or the child user if there is an ongoing call with // that user, regardless if there aren't any non-UI ICS bound. Loading Loading @@ -1417,7 +1415,6 @@ public class InCallController extends CallsManagerListenerBase implements // Track the call if we don't already know about it. addCall(call); if (mFeatureFlags.separatelyBindToBtIncallService()) { boolean bindingToBtRequired = false; boolean bindingToOtherServicesRequired = false; if (!isBoundAndConnectedToBTService(userFromCall)) { Loading @@ -1437,15 +1434,6 @@ public class InCallController extends CallsManagerListenerBase implements if (!bindingToBtRequired || !bindingToOtherServicesRequired) { addCallToConnectedServices(call, userFromCall); } } else { if (!isBoundAndConnectedToServices(userFromCall)) { Log.i(this, "onCallAdded: %s; not bound or connected.", call); // We are not bound, or we're not connected. bindToServices(call); } else { addCallToConnectedServices(call, userFromCall); } } } private void addCallToConnectedServices(Call call, UserHandle userFromCall) { Loading Loading @@ -1555,7 +1543,6 @@ public class InCallController extends CallsManagerListenerBase implements @Override public void onDisconnectedTonePlaying(Call call, boolean isTonePlaying) { Log.i(this, "onDisconnectedTonePlaying: %s -> %b", call, isTonePlaying); if (mFeatureFlags.separatelyBindToBtIncallService()) { synchronized (mLock) { if (isTonePlaying) { mDisconnectedToneStartedPlaying = true; Loading @@ -1571,7 +1558,6 @@ public class InCallController extends CallsManagerListenerBase implements } } } } public void maybeScheduleBtUnbind(Call call) { mBtIcsCallTracker.remove(call); Loading Loading @@ -2101,12 +2087,10 @@ public class InCallController extends CallsManagerListenerBase implements mNonUIInCallServiceConnections.remove(userHandle); } getCombinedInCallServiceMap().remove(userHandle); if (mFeatureFlags.separatelyBindToBtIncallService()) { // Note that the BT ICS will be repopulated as part of the combined map if the // BT ICS is still bound (disconnected tone hasn't finished playing). updateCombinedInCallServiceMap(userHandle); } } /** * Binds to Bluetooth InCallServices. Method-invoker must check Loading Loading @@ -2565,8 +2549,8 @@ public class InCallController extends CallsManagerListenerBase implements } boolean processingBluetoothPackage = isBluetoothPackage(serviceInfo.packageName); if (mFeatureFlags.separatelyBindToBtIncallService() && processingBluetoothPackage && (hasControlInCallPermission || hasAppOpsPermittedManageOngoingCalls)) { if (processingBluetoothPackage && (hasControlInCallPermission || hasAppOpsPermittedManageOngoingCalls)) { return IN_CALL_SERVICE_TYPE_BLUETOOTH; } Loading Loading @@ -2610,8 +2594,7 @@ public class InCallController extends CallsManagerListenerBase implements trackCallingUserInterfaceStarted(info); } IInCallService inCallService = IInCallService.Stub.asInterface(service); if (mFeatureFlags.separatelyBindToBtIncallService() && info.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) { if (info.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) { if (!mBtBindingFuture.containsKey(userHandle) || mBtBindingFuture.get(userHandle).isDone()) { Log.i(this, "onConnected: BT binding future timed out."); Loading @@ -2626,9 +2609,7 @@ public class InCallController extends CallsManagerListenerBase implements mInCallServices.get(userHandle).put(info, inCallService); } if (mFeatureFlags.separatelyBindToBtIncallService()) { updateCombinedInCallServiceMap(userHandle); } try { inCallService.setInCallAdapter( Loading Loading @@ -2733,8 +2714,7 @@ public class InCallController extends CallsManagerListenerBase implements if (mInCallServices.containsKey(userHandle)) { mInCallServices.get(userHandle).remove(disconnectedInfo); } if (mFeatureFlags.separatelyBindToBtIncallService() && disconnectedInfo.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) { if (disconnectedInfo.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) { mBTInCallServices.remove(userHandle); updateCombinedInCallServiceMap(userHandle); } Loading Loading @@ -2879,10 +2859,8 @@ public class InCallController extends CallsManagerListenerBase implements if (mCallIdMapper.getCallId(call) == null) { mCallIdMapper.addCall(call); call.addListener(mCallListener); if (mFeatureFlags.separatelyBindToBtIncallService()) { mBtIcsCallTracker.add(call); } } maybeTrackMicrophoneUse(isMuted()); } Loading Loading @@ -3413,8 +3391,7 @@ public class InCallController extends CallsManagerListenerBase implements } // If early binding for BT ICS is enabled, ensure that it is included into consideration as // a bound non-UI ICS. return mFeatureFlags.separatelyBindToBtIncallService() && !mBTInCallServices.isEmpty() && isBluetoothPackage(packageName); return !mBTInCallServices.isEmpty() && isBluetoothPackage(packageName); } private void updateCombinedInCallServiceMap(UserHandle user) { Loading @@ -3425,8 +3402,7 @@ public class InCallController extends CallsManagerListenerBase implements } else { serviceMap = new HashMap<>(); } if (mFeatureFlags.separatelyBindToBtIncallService() && mBTInCallServices.containsKey(user)) { if (mBTInCallServices.containsKey(user)) { Pair<InCallServiceInfo, IInCallService> btServicePair = mBTInCallServices.get(user); serviceMap.put(btServicePair.first, btServicePair.second); } Loading @@ -3441,11 +3417,7 @@ public class InCallController extends CallsManagerListenerBase implements private Map<UserHandle, Map<InCallController.InCallServiceInfo, IInCallService>> getCombinedInCallServiceMap() { synchronized (mLock) { if (mFeatureFlags.separatelyBindToBtIncallService()) { return mCombinedInCallServiceMap; } else { return mInCallServices; } } } Loading src/com/android/server/telecom/TelecomServiceImpl.java +2 −4 Original line number Diff line number Diff line Loading @@ -1973,10 +1973,8 @@ public class TelecomServiceImpl { && accountExtra != null && accountExtra.getBoolean( PhoneAccount.EXTRA_SKIP_CALL_FILTERING, false)) { if (mFeatureFlags.separatelyBindToBtIncallService()) { mCallsManager.getInCallController().bindToBTService( null, null); } // Should be able to run this as is even if above flag is // enabled (BT binding should be skipped automatically). mCallsManager.getInCallController().bindToServices(null); Loading Loading
flags/telecom_incallservice_flags.aconfig +0 −8 Original line number Diff line number Diff line Loading @@ -17,14 +17,6 @@ flag { bug: "306582821" } # OWNER=pmadapurmath TARGET=24Q3 flag { name: "separately_bind_to_bt_incall_service" namespace: "telecom" description: "Binding/Unbinding to BluetoothInCallServices in proper time to improve call audio" bug: "306395598" } # OWNER=tjstuart TARGET=24Q4 flag { name: "do_not_send_call_to_null_ics" Loading
src/com/android/server/telecom/CallAudioManager.java +1 −4 Original line number Diff line number Diff line Loading @@ -787,12 +787,9 @@ public class CallAudioManager extends CallsManagerListenerBase { private void onCallEnteringRinging() { if (mRingingCalls.size() == 1) { Log.i(this, "onCallEnteringRinging: mFeatureFlags.separatelyBindToBtIncallService() ? %s", mFeatureFlags.separatelyBindToBtIncallService()); Log.i(this, "onCallEnteringRinging: mRingingCalls.getFirst().getBtIcsFuture() = %s", mRingingCalls.getFirst().getBtIcsFuture()); if (mFeatureFlags.separatelyBindToBtIncallService() && mRingingCalls.getFirst().getBtIcsFuture() != null) { if (mRingingCalls.getFirst().getBtIcsFuture() != null) { mCallRingingFuture = mRingingCalls.getFirst().getBtIcsFuture() .thenComposeAsync((completed) -> { mCallAudioModeStateMachine.sendMessageWithArgs( Loading
src/com/android/server/telecom/CallsManager.java +6 −15 Original line number Diff line number Diff line Loading @@ -1097,13 +1097,8 @@ public class CallsManager extends Call.ListenerBase incomingCall.setUserMissed(USER_MISSED_CALL_FILTERS_TIMEOUT); } if (incomingCall.getState() != CallState.DISCONNECTED && incomingCall.getState() != CallState.DISCONNECTING) { if (!mFeatureFlags.separatelyBindToBtIncallService()) { setCallState(incomingCall, CallState.RINGING, result.shouldAllowCall ? "successful incoming call" : "blocking call"); } } else { if (incomingCall.getState() == CallState.DISCONNECTED || incomingCall.getState() == CallState.DISCONNECTING) { Log.i(this, "onCallFilteringCompleted: call already disconnected."); return; } Loading Loading @@ -1147,11 +1142,9 @@ public class CallsManager extends Call.ListenerBase } if (result.shouldAllowCall) { if (mFeatureFlags.separatelyBindToBtIncallService()) { mInCallController.bindToBTService(incomingCall, null); incomingCall.setBtIcsFuture(mInCallController.getBtBindingFuture(incomingCall)); setCallState(incomingCall, CallState.RINGING, "successful incoming call"); } incomingCall.setPostCallPackageName( getRoleManagerAdapter().getDefaultCallScreeningApp( incomingCall.getAssociatedUser() Loading Loading @@ -1193,9 +1186,7 @@ public class CallsManager extends Call.ListenerBase } else { if (result.shouldReject) { Log.i(this, "onCallFilteringCompleted: blocked call, rejecting."); if (mFeatureFlags.separatelyBindToBtIncallService()) { setCallState(incomingCall, CallState.RINGING, "blocking call"); } incomingCall.reject(false, null); } if (result.shouldAddToCallLog) { Loading
src/com/android/server/telecom/InCallController.java +42 −70 Original line number Diff line number Diff line Loading @@ -330,8 +330,7 @@ public class InCallController extends CallsManagerListenerBase implements addCall(call); // Notify this new added call if (mFeatureFlags.separatelyBindToBtIncallService() && mInCallServiceInfo.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) { if (mInCallServiceInfo.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) { sendCallToService(call, mInCallServiceInfo, mBTInCallServices .get(userFromCall).second); } else { Loading Loading @@ -1124,8 +1123,7 @@ public class InCallController extends CallsManagerListenerBase implements // Bind to BT service if there's an available call. When the flag isn't // enabled, the service will be included as part of // getNonUiInCallServiceBindingConnectionList. if (mFeatureFlags.separatelyBindToBtIncallService() && isBluetoothPkg && callToConnectWith != null) { if (isBluetoothPkg && callToConnectWith != null) { // mNonUIInCallServiceConnections will always contain a key for // userHandle and/or the child user if there is an ongoing call with // that user, regardless if there aren't any non-UI ICS bound. Loading Loading @@ -1417,7 +1415,6 @@ public class InCallController extends CallsManagerListenerBase implements // Track the call if we don't already know about it. addCall(call); if (mFeatureFlags.separatelyBindToBtIncallService()) { boolean bindingToBtRequired = false; boolean bindingToOtherServicesRequired = false; if (!isBoundAndConnectedToBTService(userFromCall)) { Loading @@ -1437,15 +1434,6 @@ public class InCallController extends CallsManagerListenerBase implements if (!bindingToBtRequired || !bindingToOtherServicesRequired) { addCallToConnectedServices(call, userFromCall); } } else { if (!isBoundAndConnectedToServices(userFromCall)) { Log.i(this, "onCallAdded: %s; not bound or connected.", call); // We are not bound, or we're not connected. bindToServices(call); } else { addCallToConnectedServices(call, userFromCall); } } } private void addCallToConnectedServices(Call call, UserHandle userFromCall) { Loading Loading @@ -1555,7 +1543,6 @@ public class InCallController extends CallsManagerListenerBase implements @Override public void onDisconnectedTonePlaying(Call call, boolean isTonePlaying) { Log.i(this, "onDisconnectedTonePlaying: %s -> %b", call, isTonePlaying); if (mFeatureFlags.separatelyBindToBtIncallService()) { synchronized (mLock) { if (isTonePlaying) { mDisconnectedToneStartedPlaying = true; Loading @@ -1571,7 +1558,6 @@ public class InCallController extends CallsManagerListenerBase implements } } } } public void maybeScheduleBtUnbind(Call call) { mBtIcsCallTracker.remove(call); Loading Loading @@ -2101,12 +2087,10 @@ public class InCallController extends CallsManagerListenerBase implements mNonUIInCallServiceConnections.remove(userHandle); } getCombinedInCallServiceMap().remove(userHandle); if (mFeatureFlags.separatelyBindToBtIncallService()) { // Note that the BT ICS will be repopulated as part of the combined map if the // BT ICS is still bound (disconnected tone hasn't finished playing). updateCombinedInCallServiceMap(userHandle); } } /** * Binds to Bluetooth InCallServices. Method-invoker must check Loading Loading @@ -2565,8 +2549,8 @@ public class InCallController extends CallsManagerListenerBase implements } boolean processingBluetoothPackage = isBluetoothPackage(serviceInfo.packageName); if (mFeatureFlags.separatelyBindToBtIncallService() && processingBluetoothPackage && (hasControlInCallPermission || hasAppOpsPermittedManageOngoingCalls)) { if (processingBluetoothPackage && (hasControlInCallPermission || hasAppOpsPermittedManageOngoingCalls)) { return IN_CALL_SERVICE_TYPE_BLUETOOTH; } Loading Loading @@ -2610,8 +2594,7 @@ public class InCallController extends CallsManagerListenerBase implements trackCallingUserInterfaceStarted(info); } IInCallService inCallService = IInCallService.Stub.asInterface(service); if (mFeatureFlags.separatelyBindToBtIncallService() && info.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) { if (info.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) { if (!mBtBindingFuture.containsKey(userHandle) || mBtBindingFuture.get(userHandle).isDone()) { Log.i(this, "onConnected: BT binding future timed out."); Loading @@ -2626,9 +2609,7 @@ public class InCallController extends CallsManagerListenerBase implements mInCallServices.get(userHandle).put(info, inCallService); } if (mFeatureFlags.separatelyBindToBtIncallService()) { updateCombinedInCallServiceMap(userHandle); } try { inCallService.setInCallAdapter( Loading Loading @@ -2733,8 +2714,7 @@ public class InCallController extends CallsManagerListenerBase implements if (mInCallServices.containsKey(userHandle)) { mInCallServices.get(userHandle).remove(disconnectedInfo); } if (mFeatureFlags.separatelyBindToBtIncallService() && disconnectedInfo.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) { if (disconnectedInfo.getType() == IN_CALL_SERVICE_TYPE_BLUETOOTH) { mBTInCallServices.remove(userHandle); updateCombinedInCallServiceMap(userHandle); } Loading Loading @@ -2879,10 +2859,8 @@ public class InCallController extends CallsManagerListenerBase implements if (mCallIdMapper.getCallId(call) == null) { mCallIdMapper.addCall(call); call.addListener(mCallListener); if (mFeatureFlags.separatelyBindToBtIncallService()) { mBtIcsCallTracker.add(call); } } maybeTrackMicrophoneUse(isMuted()); } Loading Loading @@ -3413,8 +3391,7 @@ public class InCallController extends CallsManagerListenerBase implements } // If early binding for BT ICS is enabled, ensure that it is included into consideration as // a bound non-UI ICS. return mFeatureFlags.separatelyBindToBtIncallService() && !mBTInCallServices.isEmpty() && isBluetoothPackage(packageName); return !mBTInCallServices.isEmpty() && isBluetoothPackage(packageName); } private void updateCombinedInCallServiceMap(UserHandle user) { Loading @@ -3425,8 +3402,7 @@ public class InCallController extends CallsManagerListenerBase implements } else { serviceMap = new HashMap<>(); } if (mFeatureFlags.separatelyBindToBtIncallService() && mBTInCallServices.containsKey(user)) { if (mBTInCallServices.containsKey(user)) { Pair<InCallServiceInfo, IInCallService> btServicePair = mBTInCallServices.get(user); serviceMap.put(btServicePair.first, btServicePair.second); } Loading @@ -3441,11 +3417,7 @@ public class InCallController extends CallsManagerListenerBase implements private Map<UserHandle, Map<InCallController.InCallServiceInfo, IInCallService>> getCombinedInCallServiceMap() { synchronized (mLock) { if (mFeatureFlags.separatelyBindToBtIncallService()) { return mCombinedInCallServiceMap; } else { return mInCallServices; } } } Loading
src/com/android/server/telecom/TelecomServiceImpl.java +2 −4 Original line number Diff line number Diff line Loading @@ -1973,10 +1973,8 @@ public class TelecomServiceImpl { && accountExtra != null && accountExtra.getBoolean( PhoneAccount.EXTRA_SKIP_CALL_FILTERING, false)) { if (mFeatureFlags.separatelyBindToBtIncallService()) { mCallsManager.getInCallController().bindToBTService( null, null); } // Should be able to run this as is even if above flag is // enabled (BT binding should be skipped automatically). mCallsManager.getInCallController().bindToServices(null); Loading