diff options
author | Sean.JS Tsai <seanjstsai@google.com> | 2022-12-06 08:27:34 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2022-12-06 08:27:34 +0000 |
commit | 4c6995266b5f7bc738f3117792e486c6fbdb75f0 (patch) | |
tree | 8d686641258d46a57fd1b8429b7473b6aee234c5 /services/QualifiedNetworksService/src/com/android | |
parent | 44cfd553c42e445de899641c53cda0deea9777b7 (diff) | |
parent | 140c0ec9c22eb116eb72e1bf837bf7d4aafbe44e (diff) | |
download | Telephony-4c6995266b5f7bc738f3117792e486c6fbdb75f0.tar.gz |
Merge "[QNS] Move ePDG-based WFC activation from WFC APP to Google QNS"
Diffstat (limited to 'services/QualifiedNetworksService/src/com/android')
4 files changed, 82 insertions, 0 deletions
diff --git a/services/QualifiedNetworksService/src/com/android/telephony/qns/AccessNetworkEvaluator.java b/services/QualifiedNetworksService/src/com/android/telephony/qns/AccessNetworkEvaluator.java index e0231e8..38ed6e3 100644 --- a/services/QualifiedNetworksService/src/com/android/telephony/qns/AccessNetworkEvaluator.java +++ b/services/QualifiedNetworksService/src/com/android/telephony/qns/AccessNetworkEvaluator.java @@ -393,6 +393,8 @@ class AccessNetworkEvaluator { events.add(QnsEventDispatcher.QNS_EVENT_WFC_PLATFORM_ENABLED); events.add(QnsEventDispatcher.QNS_EVENT_WFC_PLATFORM_DISABLED); events.add(QnsEventDispatcher.QNS_EVENT_SIM_ABSENT); + events.add(QnsEventDispatcher.QNS_EVENT_TRY_WFC_ACTIVATION); + events.add(QnsEventDispatcher.QNS_EVENT_CANCEL_TRY_WFC_ACTIVATION); mQnsEventDispatcher.registerEvent(events, mHandler); mRestrictManager.registerRestrictInfoChanged(mHandler, EVENT_RESTRICT_INFO_CHANGED); } @@ -659,9 +661,18 @@ class AccessNetworkEvaluator { @VisibleForTesting void onTryWfcConnectionStateChanged(boolean isEnabled) { log("onTryWfcConnectionStateChanged enabled:" + isEnabled); + int timeout = mConfigManager.getVowifiRegistrationTimerForVowifiActivation(); + if (mAllowIwlanForWfcActivation == isEnabled) { return; } + if (isEnabled) { + mHandler.sendEmptyMessageDelayed( + QnsEventDispatcher.QNS_EVENT_CANCEL_TRY_WFC_ACTIVATION, + timeout + /* milliseconds */3000); + } else { + mHandler.removeMessages(QnsEventDispatcher.QNS_EVENT_CANCEL_TRY_WFC_ACTIVATION); + } mAllowIwlanForWfcActivation = isEnabled; evaluate(); } @@ -1919,6 +1930,12 @@ class AccessNetworkEvaluator { case EVENT_WIFI_RTT_STATUS_CHANGED: onRttStatusChanged((boolean) ar.mResult); break; + case QnsEventDispatcher.QNS_EVENT_TRY_WFC_ACTIVATION: + onTryWfcConnectionStateChanged(true); + break; + case QnsEventDispatcher.QNS_EVENT_CANCEL_TRY_WFC_ACTIVATION: + onTryWfcConnectionStateChanged(false); + break; default: log("never reach here msg=" + message.what); } diff --git a/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsCarrierConfigManager.java b/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsCarrierConfigManager.java index 354e2af..f8407ed 100644 --- a/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsCarrierConfigManager.java +++ b/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsCarrierConfigManager.java @@ -32,6 +32,7 @@ import static android.telephony.TelephonyManager.UNKNOWN_CARRIER_ID; import static com.android.telephony.qns.QnsConstants.FALLBACK_REASON_INVALID; import static com.android.telephony.qns.QnsConstants.MAX_COUNT_INVALID; +import static com.android.telephony.qns.wfc.WfcCarrierConfigManager.KEY_QNS_VOWIFI_REGISTATION_TIMER_FOR_VOWIFI_ACTIVATION_INT; import android.annotation.IntDef; import android.annotation.NonNull; @@ -782,6 +783,7 @@ class QnsCarrierConfigManager { private int mCbsRatPreference; private int mNetworkEnableHysteresisTimer; private int mMinimumHandoverGuardingTimer; + private int mVowifiRegistrationTimerForVowifiActivation; private int[] mWwanHysteresisTimer; private int[] mWlanHysteresisTimer; @@ -1209,6 +1211,8 @@ class QnsCarrierConfigManager { // Load configs using Carrier Config Manager Keys loadDirectFromCarrierConfigManagerKey(carrierConfigBundle); + + loadWfcConfigurations(carrierConfigBundle, assetConfigBundle); } /** @@ -1439,6 +1443,16 @@ class QnsCarrierConfigManager { } @VisibleForTesting + void loadWfcConfigurations(PersistableBundle bundleCarrier, PersistableBundle bundleAsset) { + + mVowifiRegistrationTimerForVowifiActivation = + getConfig( + bundleCarrier, + bundleAsset, + KEY_QNS_VOWIFI_REGISTATION_TIMER_FOR_VOWIFI_ACTIVATION_INT); + } + + @VisibleForTesting void loadFallbackPolicyWithImsRegiFail(PersistableBundle carrier, PersistableBundle asset) { synchronized (this) { mFallbackWwanRuleWithImsUnregistered.clear(); @@ -2492,6 +2506,14 @@ class QnsCarrierConfigManager { } /** + * This method returns the wait timer in milliseconds that VoWiFi registration in VoWiFi + * activation process + */ + int getVowifiRegistrationTimerForVowifiActivation() { + return mVowifiRegistrationTimerForVowifiActivation; + } + + /** * This method returns whether the IMS Registration state option is added when reporting a * qualified Wi-Fi network for network capabilities other than ims. * diff --git a/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsEventDispatcher.java b/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsEventDispatcher.java index 6d18b1a..cbe2411 100644 --- a/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsEventDispatcher.java +++ b/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsEventDispatcher.java @@ -21,6 +21,11 @@ import static android.telephony.ims.ImsMmTelManager.WIFI_MODE_CELLULAR_PREFERRED import static android.telephony.ims.ImsMmTelManager.WIFI_MODE_WIFI_ONLY; import static android.telephony.ims.ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED; +import static com.android.telephony.qns.wfc.WfcActivationHelper.ACTION_TRY_WFC_CONNECTION; +import static com.android.telephony.qns.wfc.WfcActivationHelper.EXTRA_SUB_ID; +import static com.android.telephony.qns.wfc.WfcActivationHelper.EXTRA_TRY_STATUS; +import static com.android.telephony.qns.wfc.WfcActivationHelper.STATUS_START; + import android.annotation.IntDef; import android.content.BroadcastReceiver; import android.content.ContentResolver; @@ -110,6 +115,8 @@ class QnsEventDispatcher { static final int QNS_EVENT_SIM_ABSENT = QNS_EVENT_BASE + 23; static final int QNS_EVENT_SIM_LOADED = QNS_EVENT_BASE + 24; static final int QNS_EVENT_WIFI_ENABLED = QNS_EVENT_BASE + 25; + static final int QNS_EVENT_TRY_WFC_ACTIVATION = QNS_EVENT_BASE + 100; + static final int QNS_EVENT_CANCEL_TRY_WFC_ACTIVATION = QNS_EVENT_BASE + 101; private static final int EVENT_PROVISIONING_INFO_CHANGED = QNS_EVENT_BASE + 200; private static Boolean sIsAirplaneModeOn; private static int sWiFiState = WifiManager.WIFI_STATE_UNKNOWN; @@ -222,6 +229,32 @@ class QnsEventDispatcher { } }; + final BroadcastReceiver mWfcActivationIntentReceiver = + new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + int event; + Log.d(mLogTag, "mWfcActivationIntentReceiver onReceive: " + action); + switch (action) { + case ACTION_TRY_WFC_CONNECTION: + int subId = intent.getIntExtra(EXTRA_SUB_ID, -1); + if (subId != mSubId) { + Log.d(mLogTag, "Intent subId: " + subId + ", mSubId: " + mSubId); + break; + } + int request = + intent.getIntExtra(EXTRA_TRY_STATUS, 0); + event = + request == STATUS_START + ? QNS_EVENT_TRY_WFC_ACTIVATION + : QNS_EVENT_CANCEL_TRY_WFC_ACTIVATION; + updateHandlers(event); + break; + } + } + }; + /** * QnsEventDispatcher constructor */ @@ -248,6 +281,11 @@ class QnsEventDispatcher { intentFilter.addAction(TelephonyManager.ACTION_SIM_APPLICATION_STATE_CHANGED); mContext.registerReceiver(mIntentReceiver, intentFilter); + IntentFilter wfcIntentFilter = new IntentFilter(); + wfcIntentFilter.addAction(ACTION_TRY_WFC_CONNECTION); + mContext.registerReceiver( + mWfcActivationIntentReceiver, wfcIntentFilter, Context.RECEIVER_NOT_EXPORTED); + HandlerThread handlerThread = new HandlerThread(mLogTag); handlerThread.start(); mQnsEventDispatcherHandler = new QnsEventDispatcherHandler(handlerThread.getLooper()); diff --git a/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsUtils.java b/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsUtils.java index d8e3a21..3cef0a0 100644 --- a/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsUtils.java +++ b/services/QualifiedNetworksService/src/com/android/telephony/qns/QnsUtils.java @@ -19,6 +19,9 @@ package com.android.telephony.qns; import static android.telephony.ims.ImsMmTelManager.WIFI_MODE_CELLULAR_PREFERRED; import static android.telephony.ims.ImsMmTelManager.WIFI_MODE_WIFI_PREFERRED; +import static com.android.telephony.qns.wfc.WfcCarrierConfigManager.CONFIG_DEFAULT_VOWIFI_REGISTATION_TIMER; +import static com.android.telephony.qns.wfc.WfcCarrierConfigManager.KEY_QNS_VOWIFI_REGISTATION_TIMER_FOR_VOWIFI_ACTIVATION_INT; + import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; @@ -603,6 +606,8 @@ class QnsUtils { case QnsCarrierConfigManager.KEY_QNS_MMS_RAT_PREFERENCE_INT: case QnsCarrierConfigManager.KEY_QNS_CBS_RAT_PREFERENCE_INT: return (T) Integer.valueOf(QnsConstants.RAT_PREFERENCE_DEFAULT); + case KEY_QNS_VOWIFI_REGISTATION_TIMER_FOR_VOWIFI_ACTIVATION_INT: + return (T) Integer.valueOf(CONFIG_DEFAULT_VOWIFI_REGISTATION_TIMER); case QnsCarrierConfigManager .KEY_QNS_IN_CALL_ROVEIN_ALLOWED_COUNT_AND_FALLBACK_REASON_INT_ARRAY: return (T) |