Search in sources :

Example 71 with Country

use of android.location.Country in project android_frameworks_base by crdroidandroid.

the class ComprehensiveCountryDetectorTest method testDetectLocationBasedCountry.

public void testDetectLocationBasedCountry() {
    final Country resultCountry = new Country(TestCountryDetector.COUNTRY_ISO, Country.COUNTRY_SOURCE_SIM);
    final Country locationBasedCountry = new Country(TestCountryDetector.COUNTRY_ISO, Country.COUNTRY_SOURCE_LOCATION);
    TestCountryDetector countryDetector = new TestCountryDetector() {

        @Override
        protected Country getSimBasedCountry() {
            return resultCountry;
        }
    };
    CountryListenerImpl listener = new CountryListenerImpl();
    countryDetector.setCountryListener(listener);
    Country country = countryDetector.detectCountry();
    assertTrue(sameCountry(country, resultCountry));
    assertTrue(countryDetector.locationBasedDetectorStarted());
    countryDetector.notifyLocationBasedListener(locationBasedCountry);
    assertTrue(listener.notified());
    assertTrue(sameCountry(listener.getCountry(), locationBasedCountry));
    assertTrue(countryDetector.locationBasedDetectorStopped());
    assertTrue(countryDetector.locationRefreshStarted());
    countryDetector.stop();
    assertTrue(countryDetector.locationRefreshCancelled());
}
Also used : Country(android.location.Country)

Aggregations

Country (android.location.Country)71 CountryListener (android.location.CountryListener)6 ICountryListener (android.location.ICountryListener)6 ComprehensiveCountryDetector (com.android.server.location.ComprehensiveCountryDetector)6 CountryDetector (android.location.CountryDetector)4 Context (android.content.Context)1 StrictMode (android.os.StrictMode)1 LifecycleHandler (com.moez.QKSMS.common.LifecycleHandler)1 PduLoaderManager (com.moez.QKSMS.common.google.PduLoaderManager)1 ThumbnailManager (com.moez.QKSMS.common.google.ThumbnailManager)1