Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0e5b8c7 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "DownloadManager and metered networks."

parents 455b7bb8 792e0910
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -3265,6 +3265,7 @@ package android.app {
    method public android.app.DownloadManager.Request addRequestHeader(java.lang.String, java.lang.String);
    method public android.app.DownloadManager.Request addRequestHeader(java.lang.String, java.lang.String);
    method public void allowScanningByMediaScanner();
    method public void allowScanningByMediaScanner();
    method public android.app.DownloadManager.Request setAllowedNetworkTypes(int);
    method public android.app.DownloadManager.Request setAllowedNetworkTypes(int);
    method public android.app.DownloadManager.Request setAllowedOverMetered(boolean);
    method public android.app.DownloadManager.Request setAllowedOverRoaming(boolean);
    method public android.app.DownloadManager.Request setAllowedOverRoaming(boolean);
    method public android.app.DownloadManager.Request setDescription(java.lang.CharSequence);
    method public android.app.DownloadManager.Request setDescription(java.lang.CharSequence);
    method public android.app.DownloadManager.Request setDestinationInExternalFilesDir(android.content.Context, java.lang.String, java.lang.String);
    method public android.app.DownloadManager.Request setDestinationInExternalFilesDir(android.content.Context, java.lang.String, java.lang.String);
+18 −2
Original line number Original line Diff line number Diff line
@@ -349,6 +349,7 @@ public class DownloadManager {
        private String mMimeType;
        private String mMimeType;
        private boolean mRoamingAllowed = true;
        private boolean mRoamingAllowed = true;
        private int mAllowedNetworkTypes = ~0; // default to all network types allowed
        private int mAllowedNetworkTypes = ~0; // default to all network types allowed
        private boolean mAllowedOverMetered = true;
        private boolean mIsVisibleInDownloadsUi = true;
        private boolean mIsVisibleInDownloadsUi = true;
        private boolean mScannable = false;
        private boolean mScannable = false;
        private boolean mUseSystemCache = false;
        private boolean mUseSystemCache = false;
@@ -609,8 +610,11 @@ public class DownloadManager {
        }
        }


        /**
        /**
         * Restrict the types of networks over which this download may proceed.  By default, all
         * Restrict the types of networks over which this download may proceed.
         * network types are allowed.
         * By default, all network types are allowed. Consider using
         * {@link #setAllowedOverMetered(boolean)} instead, since it's more
         * flexible.
         *
         * @param flags any combination of the NETWORK_* bit flags.
         * @param flags any combination of the NETWORK_* bit flags.
         * @return this object
         * @return this object
         */
         */
@@ -619,6 +623,17 @@ public class DownloadManager {
            return this;
            return this;
        }
        }


        /**
         * Set whether this download may proceed over a metered network
         * connection. By default, metered networks are allowed.
         *
         * @see ConnectivityManager#isActiveNetworkMetered()
         */
        public Request setAllowedOverMetered(boolean allow) {
            mAllowedOverMetered = allow;
            return this;
        }

        /**
        /**
         * Set whether this download may proceed over a roaming connection.  By default, roaming is
         * Set whether this download may proceed over a roaming connection.  By default, roaming is
         * allowed.
         * allowed.
@@ -672,6 +687,7 @@ public class DownloadManager {
            putIfNonNull(values, Downloads.Impl.COLUMN_DESCRIPTION, mDescription);
            putIfNonNull(values, Downloads.Impl.COLUMN_DESCRIPTION, mDescription);
            putIfNonNull(values, Downloads.Impl.COLUMN_MIME_TYPE, mMimeType);
            putIfNonNull(values, Downloads.Impl.COLUMN_MIME_TYPE, mMimeType);


            // TODO: add COLUMN_ALLOW_METERED and persist
            values.put(Downloads.Impl.COLUMN_VISIBILITY, mNotificationVisibility);
            values.put(Downloads.Impl.COLUMN_VISIBILITY, mNotificationVisibility);
            values.put(Downloads.Impl.COLUMN_ALLOWED_NETWORK_TYPES, mAllowedNetworkTypes);
            values.put(Downloads.Impl.COLUMN_ALLOWED_NETWORK_TYPES, mAllowedNetworkTypes);
            values.put(Downloads.Impl.COLUMN_ALLOW_ROAMING, mRoamingAllowed);
            values.put(Downloads.Impl.COLUMN_ALLOW_ROAMING, mRoamingAllowed);