Loading src/com/android/server/telecom/Call.java +1 −1 Original line number Diff line number Diff line Loading @@ -2550,7 +2550,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, return; } mCreateConnectionProcessor = new CreateConnectionProcessor(this, mRepository, this, phoneAccountRegistrar, mContext, mFlags); phoneAccountRegistrar, mContext, mFlags, new Timeouts.Adapter()); mCreateConnectionProcessor.process(); } Loading src/com/android/server/telecom/ConnectionServiceWrapper.java +2 −1 Original line number Diff line number Diff line Loading @@ -2032,7 +2032,8 @@ public class ConnectionServiceWrapper extends ServiceBinder implements } /** @see IConnectionService#disconnect(String, Session.Info) */ void disconnect(Call call) { @VisibleForTesting public void disconnect(Call call) { final String callId = mCallIdMapper.getCallId(call); if (callId != null && isServiceValid("disconnect")) { try { Loading src/com/android/server/telecom/CreateConnectionProcessor.java +10 −5 Original line number Diff line number Diff line Loading @@ -138,15 +138,19 @@ public class CreateConnectionProcessor implements CreateConnectionResponse { private final PhoneAccountRegistrar mPhoneAccountRegistrar; private final Context mContext; private final FeatureFlags mFlags; private final Timeouts.Adapter mTimeoutsAdapter; private CreateConnectionTimeout mTimeout; private ConnectionServiceWrapper mService; private int mConnectionAttempt; @VisibleForTesting public CreateConnectionProcessor( Call call, ConnectionServiceRepository repository, CreateConnectionResponse response, PhoneAccountRegistrar phoneAccountRegistrar, Context context, FeatureFlags featureFlags) { public CreateConnectionProcessor(Call call, ConnectionServiceRepository repository, CreateConnectionResponse response, PhoneAccountRegistrar phoneAccountRegistrar, Context context, FeatureFlags featureFlags, Timeouts.Adapter timeoutsAdapter) { Log.v(this, "CreateConnectionProcessor created for Call = %s", call); mCall = call; mRepository = repository; Loading @@ -155,6 +159,7 @@ public class CreateConnectionProcessor implements CreateConnectionResponse { mContext = context; mConnectionAttempt = 0; mFlags = featureFlags; mTimeoutsAdapter = timeoutsAdapter; } boolean isProcessingComplete() { Loading Loading @@ -327,7 +332,7 @@ public class CreateConnectionProcessor implements CreateConnectionResponse { clearTimeout(); CreateConnectionTimeout timeout = new CreateConnectionTimeout( mContext, mPhoneAccountRegistrar, service, mCall); mContext, mPhoneAccountRegistrar, service, mCall, mTimeoutsAdapter); if (timeout.isTimeoutNeededForCall(getConnectionServices(mAttemptRecords), attempt.connectionManagerPhoneAccount)) { mTimeout = timeout; Loading src/com/android/server/telecom/CreateConnectionTimeout.java +34 −16 Original line number Diff line number Diff line Loading @@ -44,15 +44,17 @@ public final class CreateConnectionTimeout extends Runnable { private final Handler mHandler = new Handler(Looper.getMainLooper()); private boolean mIsRegistered; private boolean mIsCallTimedOut; private final Timeouts.Adapter mTimeoutsAdapter; @VisibleForTesting public CreateConnectionTimeout(Context context, PhoneAccountRegistrar phoneAccountRegistrar, ConnectionServiceWrapper service, Call call) { ConnectionServiceWrapper service, Call call, Timeouts.Adapter timeoutsAdapter) { super("CCT", null /*lock*/); mContext = context; mPhoneAccountRegistrar = phoneAccountRegistrar; mConnectionService = service; mCall = call; mTimeoutsAdapter = timeoutsAdapter; } @VisibleForTesting Loading @@ -60,6 +62,7 @@ public final class CreateConnectionTimeout extends Runnable { PhoneAccountHandle currentAccount) { // Non-emergency calls timeout automatically at the radio layer. No need for a timeout here. if (!mCall.isEmergencyCall()) { Log.d(this, "isTimeoutNeededForCall, not an emergency call"); return false; } Loading @@ -68,11 +71,13 @@ public final class CreateConnectionTimeout extends Runnable { PhoneAccountHandle connectionManager = mPhoneAccountRegistrar.getSimCallManagerFromCall(mCall); if (!accounts.contains(connectionManager)) { Log.d(this, "isTimeoutNeededForCall, no connection manager"); return false; } // No need to add a timeout if the current attempt is over the connection manager. if (Objects.equals(connectionManager, currentAccount)) { Log.d(this, "isTimeoutNeededForCall, already attempting over connection manager"); return false; } Loading @@ -83,17 +88,6 @@ public final class CreateConnectionTimeout extends Runnable { return false; } // Timeout is not required if carrier is not in service. if (carrierEnabledSatelliteFlag() && connectionManager != null) { PhoneAccount account = mPhoneAccountRegistrar.getPhoneAccount(connectionManager, connectionManager.getUserHandle()); if (account.hasCapabilities(PhoneAccount.CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS) && !account.hasCapabilities(PhoneAccount.CAPABILITY_VOICE_CALLING_AVAILABLE)) { Log.d(this, "isTimeoutNeededForCall, carrier is not in service."); return false; } } Log.i(this, "isTimeoutNeededForCall, returning true"); return true; } Loading Loading @@ -123,8 +117,31 @@ public final class CreateConnectionTimeout extends Runnable { @Override public void loggedRun() { if (!carrierEnabledSatelliteFlag()) { timeoutCallIfNeeded(); return; } PhoneAccountHandle connectionManager = mPhoneAccountRegistrar.getSimCallManagerFromCall(mCall); if (connectionManager != null) { PhoneAccount account = mPhoneAccountRegistrar.getPhoneAccount(connectionManager, connectionManager.getUserHandle()); if (account != null && account.hasCapabilities( (PhoneAccount.CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS | PhoneAccount.CAPABILITY_VOICE_CALLING_AVAILABLE))) { // If we have encountered the timeout and there is an in service // ConnectionManager, disconnect the call so that it can be attempted over // the ConnectionManager. timeoutCallIfNeeded(); return; } } } private void timeoutCallIfNeeded() { if (mIsRegistered && isCallBeingPlaced(mCall)) { Log.i(this, "run, call timed out, calling disconnect"); Log.i(this, "timeoutCallIfNeeded, call timed out, calling disconnect"); mIsCallTimedOut = true; mConnectionService.disconnect(mCall); } Loading @@ -145,14 +162,15 @@ public final class CreateConnectionTimeout extends Runnable { TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager.isRadioOn()) { return Timeouts.getEmergencyCallTimeoutMillis(mContext.getContentResolver()); return mTimeoutsAdapter.getEmergencyCallTimeoutMillis( mContext.getContentResolver()); } else { return Timeouts.getEmergencyCallTimeoutRadioOffMillis( return mTimeoutsAdapter.getEmergencyCallTimeoutRadioOffMillis( mContext.getContentResolver()); } } catch (UnsupportedOperationException uoe) { Log.e(this, uoe, "getTimeoutLengthMillis - telephony is not supported"); return Timeouts.getEmergencyCallTimeoutMillis(mContext.getContentResolver()); return mTimeoutsAdapter.getEmergencyCallTimeoutMillis(mContext.getContentResolver()); } } } src/com/android/server/telecom/Timeouts.java +8 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,14 @@ public final class Timeouts { return Timeouts.getEmergencyCallbackWindowMillis(cr); } public long getEmergencyCallTimeoutMillis(ContentResolver cr) { return Timeouts.getEmergencyCallTimeoutMillis(cr); } public long getEmergencyCallTimeoutRadioOffMillis(ContentResolver cr) { return Timeouts.getEmergencyCallTimeoutRadioOffMillis(cr); } public long getUserDefinedCallRedirectionTimeoutMillis(ContentResolver cr) { return Timeouts.getUserDefinedCallRedirectionTimeoutMillis(cr); } Loading Loading @@ -127,7 +135,6 @@ public final class Timeouts { public int getDaysBackToSearchEmergencyDiagnosticEntries(){ return Timeouts.getDaysBackToSearchEmergencyDiagnosticEntries(); } } Loading Loading
src/com/android/server/telecom/Call.java +1 −1 Original line number Diff line number Diff line Loading @@ -2550,7 +2550,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, return; } mCreateConnectionProcessor = new CreateConnectionProcessor(this, mRepository, this, phoneAccountRegistrar, mContext, mFlags); phoneAccountRegistrar, mContext, mFlags, new Timeouts.Adapter()); mCreateConnectionProcessor.process(); } Loading
src/com/android/server/telecom/ConnectionServiceWrapper.java +2 −1 Original line number Diff line number Diff line Loading @@ -2032,7 +2032,8 @@ public class ConnectionServiceWrapper extends ServiceBinder implements } /** @see IConnectionService#disconnect(String, Session.Info) */ void disconnect(Call call) { @VisibleForTesting public void disconnect(Call call) { final String callId = mCallIdMapper.getCallId(call); if (callId != null && isServiceValid("disconnect")) { try { Loading
src/com/android/server/telecom/CreateConnectionProcessor.java +10 −5 Original line number Diff line number Diff line Loading @@ -138,15 +138,19 @@ public class CreateConnectionProcessor implements CreateConnectionResponse { private final PhoneAccountRegistrar mPhoneAccountRegistrar; private final Context mContext; private final FeatureFlags mFlags; private final Timeouts.Adapter mTimeoutsAdapter; private CreateConnectionTimeout mTimeout; private ConnectionServiceWrapper mService; private int mConnectionAttempt; @VisibleForTesting public CreateConnectionProcessor( Call call, ConnectionServiceRepository repository, CreateConnectionResponse response, PhoneAccountRegistrar phoneAccountRegistrar, Context context, FeatureFlags featureFlags) { public CreateConnectionProcessor(Call call, ConnectionServiceRepository repository, CreateConnectionResponse response, PhoneAccountRegistrar phoneAccountRegistrar, Context context, FeatureFlags featureFlags, Timeouts.Adapter timeoutsAdapter) { Log.v(this, "CreateConnectionProcessor created for Call = %s", call); mCall = call; mRepository = repository; Loading @@ -155,6 +159,7 @@ public class CreateConnectionProcessor implements CreateConnectionResponse { mContext = context; mConnectionAttempt = 0; mFlags = featureFlags; mTimeoutsAdapter = timeoutsAdapter; } boolean isProcessingComplete() { Loading Loading @@ -327,7 +332,7 @@ public class CreateConnectionProcessor implements CreateConnectionResponse { clearTimeout(); CreateConnectionTimeout timeout = new CreateConnectionTimeout( mContext, mPhoneAccountRegistrar, service, mCall); mContext, mPhoneAccountRegistrar, service, mCall, mTimeoutsAdapter); if (timeout.isTimeoutNeededForCall(getConnectionServices(mAttemptRecords), attempt.connectionManagerPhoneAccount)) { mTimeout = timeout; Loading
src/com/android/server/telecom/CreateConnectionTimeout.java +34 −16 Original line number Diff line number Diff line Loading @@ -44,15 +44,17 @@ public final class CreateConnectionTimeout extends Runnable { private final Handler mHandler = new Handler(Looper.getMainLooper()); private boolean mIsRegistered; private boolean mIsCallTimedOut; private final Timeouts.Adapter mTimeoutsAdapter; @VisibleForTesting public CreateConnectionTimeout(Context context, PhoneAccountRegistrar phoneAccountRegistrar, ConnectionServiceWrapper service, Call call) { ConnectionServiceWrapper service, Call call, Timeouts.Adapter timeoutsAdapter) { super("CCT", null /*lock*/); mContext = context; mPhoneAccountRegistrar = phoneAccountRegistrar; mConnectionService = service; mCall = call; mTimeoutsAdapter = timeoutsAdapter; } @VisibleForTesting Loading @@ -60,6 +62,7 @@ public final class CreateConnectionTimeout extends Runnable { PhoneAccountHandle currentAccount) { // Non-emergency calls timeout automatically at the radio layer. No need for a timeout here. if (!mCall.isEmergencyCall()) { Log.d(this, "isTimeoutNeededForCall, not an emergency call"); return false; } Loading @@ -68,11 +71,13 @@ public final class CreateConnectionTimeout extends Runnable { PhoneAccountHandle connectionManager = mPhoneAccountRegistrar.getSimCallManagerFromCall(mCall); if (!accounts.contains(connectionManager)) { Log.d(this, "isTimeoutNeededForCall, no connection manager"); return false; } // No need to add a timeout if the current attempt is over the connection manager. if (Objects.equals(connectionManager, currentAccount)) { Log.d(this, "isTimeoutNeededForCall, already attempting over connection manager"); return false; } Loading @@ -83,17 +88,6 @@ public final class CreateConnectionTimeout extends Runnable { return false; } // Timeout is not required if carrier is not in service. if (carrierEnabledSatelliteFlag() && connectionManager != null) { PhoneAccount account = mPhoneAccountRegistrar.getPhoneAccount(connectionManager, connectionManager.getUserHandle()); if (account.hasCapabilities(PhoneAccount.CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS) && !account.hasCapabilities(PhoneAccount.CAPABILITY_VOICE_CALLING_AVAILABLE)) { Log.d(this, "isTimeoutNeededForCall, carrier is not in service."); return false; } } Log.i(this, "isTimeoutNeededForCall, returning true"); return true; } Loading Loading @@ -123,8 +117,31 @@ public final class CreateConnectionTimeout extends Runnable { @Override public void loggedRun() { if (!carrierEnabledSatelliteFlag()) { timeoutCallIfNeeded(); return; } PhoneAccountHandle connectionManager = mPhoneAccountRegistrar.getSimCallManagerFromCall(mCall); if (connectionManager != null) { PhoneAccount account = mPhoneAccountRegistrar.getPhoneAccount(connectionManager, connectionManager.getUserHandle()); if (account != null && account.hasCapabilities( (PhoneAccount.CAPABILITY_SUPPORTS_VOICE_CALLING_INDICATIONS | PhoneAccount.CAPABILITY_VOICE_CALLING_AVAILABLE))) { // If we have encountered the timeout and there is an in service // ConnectionManager, disconnect the call so that it can be attempted over // the ConnectionManager. timeoutCallIfNeeded(); return; } } } private void timeoutCallIfNeeded() { if (mIsRegistered && isCallBeingPlaced(mCall)) { Log.i(this, "run, call timed out, calling disconnect"); Log.i(this, "timeoutCallIfNeeded, call timed out, calling disconnect"); mIsCallTimedOut = true; mConnectionService.disconnect(mCall); } Loading @@ -145,14 +162,15 @@ public final class CreateConnectionTimeout extends Runnable { TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager.isRadioOn()) { return Timeouts.getEmergencyCallTimeoutMillis(mContext.getContentResolver()); return mTimeoutsAdapter.getEmergencyCallTimeoutMillis( mContext.getContentResolver()); } else { return Timeouts.getEmergencyCallTimeoutRadioOffMillis( return mTimeoutsAdapter.getEmergencyCallTimeoutRadioOffMillis( mContext.getContentResolver()); } } catch (UnsupportedOperationException uoe) { Log.e(this, uoe, "getTimeoutLengthMillis - telephony is not supported"); return Timeouts.getEmergencyCallTimeoutMillis(mContext.getContentResolver()); return mTimeoutsAdapter.getEmergencyCallTimeoutMillis(mContext.getContentResolver()); } } }
src/com/android/server/telecom/Timeouts.java +8 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,14 @@ public final class Timeouts { return Timeouts.getEmergencyCallbackWindowMillis(cr); } public long getEmergencyCallTimeoutMillis(ContentResolver cr) { return Timeouts.getEmergencyCallTimeoutMillis(cr); } public long getEmergencyCallTimeoutRadioOffMillis(ContentResolver cr) { return Timeouts.getEmergencyCallTimeoutRadioOffMillis(cr); } public long getUserDefinedCallRedirectionTimeoutMillis(ContentResolver cr) { return Timeouts.getUserDefinedCallRedirectionTimeoutMillis(cr); } Loading Loading @@ -127,7 +135,6 @@ public final class Timeouts { public int getDaysBackToSearchEmergencyDiagnosticEntries(){ return Timeouts.getDaysBackToSearchEmergencyDiagnosticEntries(); } } Loading