Bug 1057626 - Use ConnectivityManagerCompat instead of ConnectivityManager. r=snorp, a=lmandel
authorTheodore Kokkoris <t.kokkoris@gmail.com>
Mon, 25 Aug 2014 18:12:36 +0300
changeset 224577 55d92d90051127c01899df161fcbc4b94c9a1d54
parent 224576 597d3192150f694e212f1845c6229c8fcf9a18a9
child 224578 34d3c9faaacba6056e6db1979b526cd87cbf5d5d
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp, lmandel
bugs1057626
milestone34.0a2
Bug 1057626 - Use ConnectivityManagerCompat instead of ConnectivityManager. r=snorp, a=lmandel
mobile/android/base/updater/UpdateService.java
--- a/mobile/android/base/updater/UpdateService.java
+++ b/mobile/android/base/updater/UpdateService.java
@@ -22,16 +22,17 @@ import android.app.PendingIntent;
 import android.app.Service;
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
 import android.net.Uri;
 import android.os.Environment;
+import android.support.v4.net.ConnectivityManagerCompat;
 import android.support.v4.app.NotificationCompat;
 import android.support.v4.app.NotificationCompat.Builder;
 import android.util.Log;
 
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -215,17 +216,17 @@ public class UpdateService extends Inten
          * We only start a download automatically if one of following criteria are met:
          *
          * - We have a FORCE_DOWNLOAD flag passed in
          * - The preference is set to 'always'
          * - The preference is set to 'wifi' and we are using a non-metered network (i.e. the user is OK with large data transfers occuring)
          */
         boolean shouldStartDownload = hasFlag(flags, UpdateServiceHelper.FLAG_FORCE_DOWNLOAD) ||
             autoDownloadPolicy == UpdateServiceHelper.AUTODOWNLOAD_ENABLED ||
-            (autoDownloadPolicy == UpdateServiceHelper.AUTODOWNLOAD_WIFI && !mConnectivityManager.isActiveNetworkMetered());
+            (autoDownloadPolicy == UpdateServiceHelper.AUTODOWNLOAD_WIFI && !ConnectivityManagerCompat.isActiveNetworkMetered(mConnectivityManager));
 
         if (!shouldStartDownload) {
             Log.i(LOGTAG, "not initiating automatic update download due to policy " + autoDownloadPolicy);
             sendCheckUpdateResult(UpdateServiceHelper.CheckUpdateResult.AVAILABLE);
 
             // We aren't autodownloading here, so prompt to start the update
             Notification notification = new Notification(R.drawable.ic_status_logo, null, System.currentTimeMillis());