Merge "Wifi: Mock Wifi (Framework changes) testZeroLengthSubElementIEOnMockWifi - test case for IE Zero length sub element" into main am: f45c95daf4 am: cca20aa2b2

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Wifi/+/2858926

Change-Id: Ib27156584e911b62ef93a54d0641d88cb5afb628
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/service/java/com/android/server/wifi/WifiCountryCode.java b/service/java/com/android/server/wifi/WifiCountryCode.java
index 459b4f7..594a880 100644
--- a/service/java/com/android/server/wifi/WifiCountryCode.java
+++ b/service/java/com/android/server/wifi/WifiCountryCode.java
@@ -173,13 +173,6 @@
     private class CountryChangeListenerInternal implements ChangeListener {
         @Override
         public void onDriverCountryCodeChanged(String country) {
-            if (SdkLevel.isAtLeastT()) {
-                if (TextUtils.equals(country, mDriverCountryCode)) {
-                    return;
-                }
-            } else if (TextUtils.equals(country, mLastReceivedActiveDriverCountryCode)) {
-                return;
-            }
             Log.i(TAG, "Receive onDriverCountryCodeChanged " + country);
             mLastReceivedActiveDriverCountryCode = country;
             // Before T build, always handle country code changed.
@@ -772,12 +765,10 @@
     }
 
     private void handleCountryCodeChanged(String country) {
-        if (!SdkLevel.isAtLeastT() || !TextUtils.equals(mDriverCountryCode, country)) {
-            mDriverCountryCodeUpdatedTimestamp = mClock.getWallClockMillis();
-            mDriverCountryCode = country;
-            mWifiP2pMetrics.setIsCountryCodeWorldMode(isDriverCountryCodeWorldMode());
-            notifyListener(country);
-        }
+        mDriverCountryCodeUpdatedTimestamp = mClock.getWallClockMillis();
+        mDriverCountryCode = country;
+        mWifiP2pMetrics.setIsCountryCodeWorldMode(isDriverCountryCodeWorldMode());
+        notifyListener(country);
     }
 
     /**
diff --git a/service/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java b/service/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java
index 98677bf..59b6f64 100644
--- a/service/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java
+++ b/service/tests/wifitests/src/com/android/server/wifi/WifiCountryCodeTest.java
@@ -21,11 +21,23 @@
 import static com.android.server.wifi.ActiveModeManager.ROLE_CLIENT_SECONDARY_LONG_LIVED;
 import static com.android.server.wifi.WifiSettingsConfigStore.WIFI_DEFAULT_COUNTRY_CODE;
 
-import static org.junit.Assert.*;
-import static org.junit.Assume.assumeTrue;
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.lenient;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import android.app.test.MockAnswerUtil.AnswerWithArguments;
 import android.content.Context;
@@ -604,39 +616,6 @@
     }
 
     @Test
-    public void testNotifyExternalListenerWhenOverlayisTrueButCountryCodeSameAsLastActiveOne()
-            throws Exception {
-        assumeTrue(SdkLevel.isAtLeastS());
-        mDriverSupportedNl80211RegChangedEvent = true;
-        createWifiCountryCode();
-        // External caller register the listener
-        mWifiCountryCode.registerListener(mExternalChangeListener);
-        // Supplicant started.
-        mModeChangeCallbackCaptor.getValue().onActiveModeManagerAdded(mClientModeManager);
-        // Wifi get L2 connected.
-        mClientModeImplListenerCaptor.getValue().onConnectionStart(mClientModeManager);
-        verify(mClientModeManager).setCountryCode(mDefaultCountryCode);
-        assertEquals(mDefaultCountryCode, mWifiCountryCode.getCurrentDriverCountryCode());
-        verify(mExternalChangeListener, SdkLevel.isAtLeastT() ? times(1) : times(2))
-                .onDriverCountryCodeChanged(mDefaultCountryCode);
-        if (SdkLevel.isAtLeastT()) {
-            // First time it should not trigger since last active country code is null.
-            verify(mWifiNative, never()).countryCodeChanged(any());
-        }
-        // Remove and add client mode manager again.
-        mModeChangeCallbackCaptor.getValue().onActiveModeManagerRemoved(mClientModeManager);
-        assertNull(mWifiCountryCode.getCurrentDriverCountryCode());
-        mModeChangeCallbackCaptor.getValue().onActiveModeManagerAdded(mClientModeManager);
-        verify(mClientModeManager, times(2)).setCountryCode(mDefaultCountryCode);
-        // Second time it would notify the wificond since it is same as last active country code
-        verify(mWifiNative, SdkLevel.isAtLeastT() ? times(1) : times(2))
-                .countryCodeChanged(mDefaultCountryCode);
-        assertEquals(mDefaultCountryCode, mWifiCountryCode.getCurrentDriverCountryCode());
-        verify(mExternalChangeListener, SdkLevel.isAtLeastT() ? times(2) : times(3))
-                .onDriverCountryCodeChanged(mDefaultCountryCode);
-    }
-
-    @Test
     public void testSetTelephonyCountryCodeAndUpdateWithEmptyCCReturnFalseWhenDefaultSIMCCExist()
             throws Exception {
         when(mTelephonyManager.getNetworkCountryIso()).thenReturn(mTelephonyCountryCode);