Notify policy listeners about metered ifaces.
Currently, kernel definition of metered networks is applied at the
interface level. This change maintain list of those metered ifaces
and notifies policy listeners, like ConnectivityService. (This gives
us a consistent picture of when a network would be blocked.)
Bug: 4601393
Change-Id: I277d5ca96ab967a1c1c3f1da8f9587557cd6d74c
diff --git a/core/java/android/app/DownloadManager.java b/core/java/android/app/DownloadManager.java
index 28559cc..ad8d41f 100644
--- a/core/java/android/app/DownloadManager.java
+++ b/core/java/android/app/DownloadManager.java
@@ -226,6 +226,14 @@
public final static int ERROR_FILE_ALREADY_EXISTS = 1009;
/**
+ * Value of {@link #COLUMN_REASON} when the download has failed because of
+ * {@link NetworkPolicyManager} controls on the requesting application.
+ *
+ * @hide
+ */
+ public final static int ERROR_BLOCKED = 1010;
+
+ /**
* Value of {@link #COLUMN_REASON} when the download is paused because some network error
* occurred and the download manager is waiting before retrying the request.
*/
@@ -249,14 +257,6 @@
public final static int PAUSED_UNKNOWN = 4;
/**
- * Value of {@link #COLUMN_REASON} when the download has been paused because
- * of {@link NetworkPolicyManager} controls on the requesting application.
- *
- * @hide
- */
- public final static int PAUSED_BY_POLICY = 5;
-
- /**
* Broadcast intent action sent by the download manager when a download completes.
*/
public final static String ACTION_DOWNLOAD_COMPLETE = "android.intent.action.DOWNLOAD_COMPLETE";
@@ -804,7 +804,6 @@
parts.add(statusClause("=", Downloads.Impl.STATUS_WAITING_TO_RETRY));
parts.add(statusClause("=", Downloads.Impl.STATUS_WAITING_FOR_NETWORK));
parts.add(statusClause("=", Downloads.Impl.STATUS_QUEUED_FOR_WIFI));
- parts.add(statusClause("=", Downloads.Impl.STATUS_PAUSED_BY_POLICY));
}
if ((mStatusFlags & STATUS_SUCCESSFUL) != 0) {
parts.add(statusClause("=", Downloads.Impl.STATUS_SUCCESS));
@@ -1275,9 +1274,6 @@
case Downloads.Impl.STATUS_QUEUED_FOR_WIFI:
return PAUSED_QUEUED_FOR_WIFI;
- case Downloads.Impl.STATUS_PAUSED_BY_POLICY:
- return PAUSED_BY_POLICY;
-
default:
return PAUSED_UNKNOWN;
}
@@ -1316,6 +1312,9 @@
case Downloads.Impl.STATUS_FILE_ALREADY_EXISTS_ERROR:
return ERROR_FILE_ALREADY_EXISTS;
+ case Downloads.Impl.STATUS_BLOCKED:
+ return ERROR_BLOCKED;
+
default:
return ERROR_UNKNOWN;
}
@@ -1333,7 +1332,6 @@
case Downloads.Impl.STATUS_WAITING_TO_RETRY:
case Downloads.Impl.STATUS_WAITING_FOR_NETWORK:
case Downloads.Impl.STATUS_QUEUED_FOR_WIFI:
- case Downloads.Impl.STATUS_PAUSED_BY_POLICY:
return STATUS_PAUSED;
case Downloads.Impl.STATUS_SUCCESS: