Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -3251,6 +3251,7 @@ package android.app { method public android.app.DownloadManager.Request addRequestHeader(java.lang.String, java.lang.String); method public void allowScanningByMediaScanner(); 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 setDescription(java.lang.CharSequence); method public android.app.DownloadManager.Request setDestinationInExternalFilesDir(android.content.Context, java.lang.String, java.lang.String); core/java/android/app/DownloadManager.java +18 −2 Original line number Diff line number Diff line Loading @@ -349,6 +349,7 @@ public class DownloadManager { private String mMimeType; private boolean mRoamingAllowed = true; private int mAllowedNetworkTypes = ~0; // default to all network types allowed private boolean mAllowedOverMetered = true; private boolean mIsVisibleInDownloadsUi = true; private boolean mScannable = false; private boolean mUseSystemCache = false; Loading Loading @@ -609,8 +610,11 @@ public class DownloadManager { } /** * Restrict the types of networks over which this download may proceed. By default, all * network types are allowed. * Restrict the types of networks over which this download may proceed. * 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. * @return this object */ Loading @@ -619,6 +623,17 @@ public class DownloadManager { 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 * allowed. Loading Loading @@ -672,6 +687,7 @@ public class DownloadManager { putIfNonNull(values, Downloads.Impl.COLUMN_DESCRIPTION, mDescription); 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_ALLOWED_NETWORK_TYPES, mAllowedNetworkTypes); values.put(Downloads.Impl.COLUMN_ALLOW_ROAMING, mRoamingAllowed); Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -3251,6 +3251,7 @@ package android.app { method public android.app.DownloadManager.Request addRequestHeader(java.lang.String, java.lang.String); method public void allowScanningByMediaScanner(); 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 setDescription(java.lang.CharSequence); method public android.app.DownloadManager.Request setDestinationInExternalFilesDir(android.content.Context, java.lang.String, java.lang.String);
core/java/android/app/DownloadManager.java +18 −2 Original line number Diff line number Diff line Loading @@ -349,6 +349,7 @@ public class DownloadManager { private String mMimeType; private boolean mRoamingAllowed = true; private int mAllowedNetworkTypes = ~0; // default to all network types allowed private boolean mAllowedOverMetered = true; private boolean mIsVisibleInDownloadsUi = true; private boolean mScannable = false; private boolean mUseSystemCache = false; Loading Loading @@ -609,8 +610,11 @@ public class DownloadManager { } /** * Restrict the types of networks over which this download may proceed. By default, all * network types are allowed. * Restrict the types of networks over which this download may proceed. * 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. * @return this object */ Loading @@ -619,6 +623,17 @@ public class DownloadManager { 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 * allowed. Loading Loading @@ -672,6 +687,7 @@ public class DownloadManager { putIfNonNull(values, Downloads.Impl.COLUMN_DESCRIPTION, mDescription); 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_ALLOWED_NETWORK_TYPES, mAllowedNetworkTypes); values.put(Downloads.Impl.COLUMN_ALLOW_ROAMING, mRoamingAllowed); Loading