diff --git a/mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java b/mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java index 437036107c34..bf35142e7a6e 100644 --- a/mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java +++ b/mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java @@ -147,8 +147,8 @@ public class UpdateService extends IntentService { mPrefs = getSharedPreferences(PREFS_NAME, 0); mNotificationManager = NotificationManagerCompat.from(this); - mConnectivityManager = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); - mWifiLock = ((WifiManager)getSystemService(Context.WIFI_SERVICE)) + mConnectivityManager = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); + mWifiLock = ((WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE)) .createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, PREFS_NAME); mCancelDownload = false; } diff --git a/mobile/android/bouncer/java/org/mozilla/bouncer/BouncerService.java b/mobile/android/bouncer/java/org/mozilla/bouncer/BouncerService.java index b33d1a9ca5bc..c68bc62736c2 100644 --- a/mobile/android/bouncer/java/org/mozilla/bouncer/BouncerService.java +++ b/mobile/android/bouncer/java/org/mozilla/bouncer/BouncerService.java @@ -95,12 +95,8 @@ public class BouncerService extends IntentService { } } - private String getDataDir() { - return getApplicationInfo().dataDir; - } - private File getDataFile(final String path) { - File outFile = new File(getDataDir(), path); + File outFile = new File(getApplicationInfo().dataDir, path); File dir = outFile.getParentFile(); if (dir != null && !dir.exists()) { diff --git a/mobile/android/search/java/org/mozilla/search/PostSearchFragment.java b/mobile/android/search/java/org/mozilla/search/PostSearchFragment.java index 8a26c49dd24a..6b491b4b02ef 100644 --- a/mobile/android/search/java/org/mozilla/search/PostSearchFragment.java +++ b/mobile/android/search/java/org/mozilla/search/PostSearchFragment.java @@ -110,6 +110,7 @@ public class PostSearchFragment extends Fragment { networkError = false; } + @SuppressWarnings("deprecation") @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { // Ignore about:blank URL loads and the first results page we try to load. diff --git a/mobile/android/stumbler/moz.build b/mobile/android/stumbler/moz.build index d75665644003..8bb303877d46 100644 --- a/mobile/android/stumbler/moz.build +++ b/mobile/android/stumbler/moz.build @@ -12,4 +12,6 @@ include('stumbler_sources.mozbuild') stumbler_jar = add_java_jar('stumbler') stumbler_jar.sources += stumbler_sources stumbler_jar.extra_jars += [CONFIG['ANDROID_SUPPORT_V4_AAR_LIB']] -stumbler_jar.javac_flags += ['-Xlint:all'] +# Android has deprecated most of the GPS interfaces stumbler uses, so +# we need -deprecation. +stumbler_jar.javac_flags += ['-Xlint:all,-deprecation'] diff --git a/mobile/android/tests/browser/junit3/moz.build b/mobile/android/tests/browser/junit3/moz.build index d84acaae25fd..36e7fc6d7580 100644 --- a/mobile/android/tests/browser/junit3/moz.build +++ b/mobile/android/tests/browser/junit3/moz.build @@ -31,7 +31,10 @@ jar.sources += [ 'src/org/mozilla/tests/browser/junit3/TestSuggestedSites.java', ] jar.generated_sources = [] # None yet -- try to keep it this way. -jar.javac_flags += ['-Xlint:all'] +# MockResources has been deprecated, so we need -deprecation. See +# https://github.com/Countly/countly-sdk-android/blob/ae89490a5646e7db09c855f62b35c861819300cd/sdk/src/androidTest/java/ly/count/android/sdk/DeviceInfoTests.java#L80 +# for a Mockito-based approach. +jar.javac_flags += ['-Xlint:all,-deprecation'] jar.extra_jars += [ CONFIG['ANDROID_SUPPORT_V4_AAR_LIB'],