Bug 1057626 - Use ConnectivityManagerCompat instead of ConnectivityManager. r=snorp
authorTheodore Kokkoris <t.kokkoris@gmail.com>
Mon, 25 Aug 2014 18:12:36 +0300
changeset 202956 81307805adbb6e0b572598304d6f5402320b32c3
parent 202955 f67b22d1d3229acb06fb4973454cf1ddafbbae5e
child 202957 c32ca9dc07266daec39ba0a47b51a4b3a8d3f95a
push id48527
push usergpascutto@mozilla.com
push dateTue, 02 Sep 2014 08:09:31 +0000
treeherdermozilla-inbound@81307805adbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1057626
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1057626 - Use ConnectivityManagerCompat instead of ConnectivityManager. r=snorp
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());