diff --git a/android/src/com/mapswithme/maps/DownloadResourcesLegacyActivity.java b/android/src/com/mapswithme/maps/DownloadResourcesLegacyActivity.java index 32c2e88856..54255435e2 100644 --- a/android/src/com/mapswithme/maps/DownloadResourcesLegacyActivity.java +++ b/android/src/com/mapswithme/maps/DownloadResourcesLegacyActivity.java @@ -708,7 +708,7 @@ public class DownloadResourcesLegacyActivity extends BaseMwmFragmentActivity { String countryId = intent.getStringExtra(EXTRA_COUNTRY); - mMapTaskToForward = new MwmActivity.ShowCountryTask(countryId, false); + mMapTaskToForward = new MwmActivity.ShowCountryTask(countryId); org.alohalytics.Statistics.logEvent("OpenCountryTaskProcessor::process", new String[] { "autoDownload", "false" }, LocationHelper.INSTANCE.getSavedLocation()); diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index 558782b6a0..53e6548186 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -322,7 +322,7 @@ public class MwmActivity extends BaseMwmFragmentActivity private VisibleRectMeasurer mVisibleRectMeasurer; - public static Intent createShowMapIntent(Context context, String countryId) + public static Intent createShowMapIntent(@NonNull Context context, @Nullable String countryId) { return new Intent(context, DownloadResourcesLegacyActivity.class) .putExtra(DownloadResourcesLegacyActivity.EXTRA_COUNTRY, countryId); @@ -1724,21 +1724,16 @@ public class MwmActivity extends BaseMwmFragmentActivity { private static final long serialVersionUID = 1L; private final String mCountryId; - private final boolean mDoAutoDownload; - public ShowCountryTask(String countryId, boolean doAutoDownload) + public ShowCountryTask(String countryId) { mCountryId = countryId; - mDoAutoDownload = doAutoDownload; } @Override public boolean run(MwmActivity target) { - if (mDoAutoDownload) - MapManager.warn3gAndDownload(target, mCountryId, null); - - Framework.nativeShowCountry(mCountryId, mDoAutoDownload); + Framework.nativeShowCountry(mCountryId, false); return true; } } diff --git a/android/src/com/mapswithme/maps/background/ConnectivityChangedReceiver.java b/android/src/com/mapswithme/maps/background/ConnectivityChangedReceiver.java index f8f9ad51ff..32c27607ce 100644 --- a/android/src/com/mapswithme/maps/background/ConnectivityChangedReceiver.java +++ b/android/src/com/mapswithme/maps/background/ConnectivityChangedReceiver.java @@ -5,16 +5,12 @@ import android.content.Context; import android.content.Intent; import android.util.Log; -import com.mapswithme.maps.MwmApplication; -import com.mapswithme.maps.downloader.MapManager; -import com.mapswithme.util.ConnectionState; import com.mapswithme.util.CrashlyticsUtils; -import com.mapswithme.util.PermissionsUtils; import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; +import static android.net.ConnectivityManager.CONNECTIVITY_ACTION; import static com.mapswithme.maps.MwmApplication.backgroundTracker; -import static com.mapswithme.maps.MwmApplication.prefs; public class ConnectivityChangedReceiver extends BroadcastReceiver { @@ -24,6 +20,13 @@ public class ConnectivityChangedReceiver extends BroadcastReceiver @Override public void onReceive(Context context, Intent intent) { + String action = intent != null ? intent.getAction() : null; + if (!CONNECTIVITY_ACTION.equals(action)) + { + LOGGER.w(TAG, "An intent with wrong action detected: " + action); + return; + } + String msg = "onReceive: " + intent + " app in background = " + !backgroundTracker().isForeground(); LOGGER.i(TAG, msg); diff --git a/android/src/com/mapswithme/maps/background/Notifier.java b/android/src/com/mapswithme/maps/background/Notifier.java index e235e19146..2611a7f2b8 100644 --- a/android/src/com/mapswithme/maps/background/Notifier.java +++ b/android/src/com/mapswithme/maps/background/Notifier.java @@ -39,7 +39,7 @@ public final class Notifier { } - public static void notifyDownloadFailed(String id, String name) + public static void notifyDownloadFailed(@Nullable String id, @Nullable String name) { String title = APP.getString(R.string.app_name); String content = APP.getString(R.string.download_country_failed, name); diff --git a/android/src/com/mapswithme/maps/background/WorkerService.java b/android/src/com/mapswithme/maps/background/WorkerService.java index 45fd2dcbba..277731debe 100644 --- a/android/src/com/mapswithme/maps/background/WorkerService.java +++ b/android/src/com/mapswithme/maps/background/WorkerService.java @@ -1,28 +1,18 @@ package com.mapswithme.maps.background; import android.app.IntentService; -import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.location.Location; import android.text.TextUtils; import android.util.Log; import com.mapswithme.maps.MwmApplication; -import com.mapswithme.maps.R; -import com.mapswithme.maps.downloader.CountryItem; -import com.mapswithme.maps.downloader.MapManager; import com.mapswithme.maps.editor.Editor; -import com.mapswithme.maps.location.LocationHelper; import com.mapswithme.maps.ugc.UGC; import com.mapswithme.util.CrashlyticsUtils; -import com.mapswithme.util.PermissionsUtils; -import com.mapswithme.util.concurrency.UiThread; import com.mapswithme.util.log.Logger; import com.mapswithme.util.log.LoggerFactory; -import java.util.concurrent.CountDownLatch; - public class WorkerService extends IntentService { private static final Logger LOGGER = LoggerFactory.INSTANCE.getLogger(LoggerFactory.Type.MISC); @@ -69,7 +59,7 @@ public class WorkerService extends IntentService CrashlyticsUtils.log(Log.INFO, TAG, msg); final String action = intent.getAction(); - if (action == null) + if (TextUtils.isEmpty(action)) return; switch (action) diff --git a/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java b/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java index f7c60c3dbd..5a20190181 100644 --- a/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java +++ b/android/src/com/mapswithme/maps/downloader/DownloaderAdapter.java @@ -180,7 +180,7 @@ class DownloaderAdapter extends RecyclerView.Adapter