Loading src/java/com/android/internal/telephony/LocaleTracker.java +0 −15 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.wifi.WifiManager; import android.os.AsyncResult; import android.os.Build; import android.os.Handler; Loading Loading @@ -491,20 +490,6 @@ public class LocaleTracker extends Handler { TelephonyManager.setTelephonyProperty(mPhone.getPhoneId(), TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, mCurrentCountryIso); // Set the country code for wifi. This sets allowed wifi channels based on the // country of the carrier we see. If we can't see any, reset to 0 so we don't // broadcast on forbidden channels. WifiManager wifiManager = (WifiManager) mPhone.getContext() .getSystemService(Context.WIFI_SERVICE); if (wifiManager != null) { wifiManager.setCountryCode(countryIso); } else { msg = "Wifi manager is not available."; log(msg); mLocalLog.log(msg); } Intent intent = new Intent(TelephonyManager.ACTION_NETWORK_COUNTRY_CHANGED); intent.putExtra(TelephonyManager.EXTRA_NETWORK_COUNTRY, countryIso); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); Loading tests/telephonytests/src/com/android/internal/telephony/LocaleTrackerTest.java +0 −10 Original line number Diff line number Diff line Loading @@ -25,9 +25,7 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import android.content.Context; import android.content.Intent; import android.net.wifi.WifiManager; import android.os.AsyncResult; import android.os.Looper; import android.os.Message; Loading Loading @@ -66,7 +64,6 @@ public class LocaleTrackerTest extends TelephonyTest { private LocaleTracker mLocaleTracker; private CellInfoGsm mCellInfo; private WifiManager mWifiManager; @Before public void setUp() throws Exception { Loading @@ -77,7 +74,6 @@ public class LocaleTrackerTest extends TelephonyTest { // This is a workaround to bypass setting system properties, which causes access violation. doReturn(-1).when(mPhone).getPhoneId(); mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); mCellInfo = new CellInfoGsm(); mCellInfo.setCellIdentity(new CellIdentityGsm( Loading Loading @@ -118,17 +114,11 @@ public class LocaleTrackerTest extends TelephonyTest { } private void verifyCountryCodeNotified(String[] countryCodes) { ArgumentCaptor<String> stringArgumentCaptor = ArgumentCaptor.forClass(String.class); verify(mWifiManager, times(countryCodes.length)).setCountryCode( stringArgumentCaptor.capture()); List<String> strs = stringArgumentCaptor.getAllValues(); ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class); verify(mContext, times(countryCodes.length)).sendBroadcast(intentArgumentCaptor.capture()); List<Intent> intents = intentArgumentCaptor.getAllValues(); for (int i = 0; i < countryCodes.length; i++) { assertEquals(countryCodes[i], strs.get(i)); assertEquals(TelephonyManager.ACTION_NETWORK_COUNTRY_CHANGED, intents.get(i).getAction()); assertEquals(countryCodes[i], intents.get(i).getStringExtra( Loading Loading
src/java/com/android/internal/telephony/LocaleTracker.java +0 −15 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.net.wifi.WifiManager; import android.os.AsyncResult; import android.os.Build; import android.os.Handler; Loading Loading @@ -491,20 +490,6 @@ public class LocaleTracker extends Handler { TelephonyManager.setTelephonyProperty(mPhone.getPhoneId(), TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, mCurrentCountryIso); // Set the country code for wifi. This sets allowed wifi channels based on the // country of the carrier we see. If we can't see any, reset to 0 so we don't // broadcast on forbidden channels. WifiManager wifiManager = (WifiManager) mPhone.getContext() .getSystemService(Context.WIFI_SERVICE); if (wifiManager != null) { wifiManager.setCountryCode(countryIso); } else { msg = "Wifi manager is not available."; log(msg); mLocalLog.log(msg); } Intent intent = new Intent(TelephonyManager.ACTION_NETWORK_COUNTRY_CHANGED); intent.putExtra(TelephonyManager.EXTRA_NETWORK_COUNTRY, countryIso); SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId()); Loading
tests/telephonytests/src/com/android/internal/telephony/LocaleTrackerTest.java +0 −10 Original line number Diff line number Diff line Loading @@ -25,9 +25,7 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import android.content.Context; import android.content.Intent; import android.net.wifi.WifiManager; import android.os.AsyncResult; import android.os.Looper; import android.os.Message; Loading Loading @@ -66,7 +64,6 @@ public class LocaleTrackerTest extends TelephonyTest { private LocaleTracker mLocaleTracker; private CellInfoGsm mCellInfo; private WifiManager mWifiManager; @Before public void setUp() throws Exception { Loading @@ -77,7 +74,6 @@ public class LocaleTrackerTest extends TelephonyTest { // This is a workaround to bypass setting system properties, which causes access violation. doReturn(-1).when(mPhone).getPhoneId(); mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE); mCellInfo = new CellInfoGsm(); mCellInfo.setCellIdentity(new CellIdentityGsm( Loading Loading @@ -118,17 +114,11 @@ public class LocaleTrackerTest extends TelephonyTest { } private void verifyCountryCodeNotified(String[] countryCodes) { ArgumentCaptor<String> stringArgumentCaptor = ArgumentCaptor.forClass(String.class); verify(mWifiManager, times(countryCodes.length)).setCountryCode( stringArgumentCaptor.capture()); List<String> strs = stringArgumentCaptor.getAllValues(); ArgumentCaptor<Intent> intentArgumentCaptor = ArgumentCaptor.forClass(Intent.class); verify(mContext, times(countryCodes.length)).sendBroadcast(intentArgumentCaptor.capture()); List<Intent> intents = intentArgumentCaptor.getAllValues(); for (int i = 0; i < countryCodes.length; i++) { assertEquals(countryCodes[i], strs.get(i)); assertEquals(TelephonyManager.ACTION_NETWORK_COUNTRY_CHANGED, intents.get(i).getAction()); assertEquals(countryCodes[i], intents.get(i).getStringExtra( Loading