Loading core/java/android/app/DownloadManager.java +14 −17 Original line number Diff line number Diff line Loading @@ -347,9 +347,9 @@ public class DownloadManager { private CharSequence mTitle; private CharSequence mDescription; private String mMimeType; private boolean mRoamingAllowed = true; private int mAllowedNetworkTypes = ~0; // default to all network types allowed private boolean mAllowedOverMetered = true; private boolean mRoamingAllowed = true; private boolean mMeteredAllowed = true; private boolean mIsVisibleInDownloadsUi = true; private boolean mScannable = false; private boolean mUseSystemCache = false; Loading Loading @@ -623,17 +623,6 @@ 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 @@ -645,6 +634,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) { mMeteredAllowed = allow; return this; } /** * Set whether this download should be displayed in the system's Downloads UI. True by * default. Loading Loading @@ -687,10 +687,10 @@ 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); values.put(Downloads.Impl.COLUMN_ALLOW_METERED, mMeteredAllowed); values.put(Downloads.Impl.COLUMN_IS_VISIBLE_IN_DOWNLOADS_UI, mIsVisibleInDownloadsUi); return values; Loading Loading @@ -1340,9 +1340,6 @@ public class DownloadManager { 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; } Loading core/java/android/provider/Downloads.java +15 −4 Original line number Diff line number Diff line Loading @@ -328,6 +328,14 @@ public final class Downloads { */ public static final String COLUMN_IS_PUBLIC_API = "is_public_api"; /** * The name of the column holding a bitmask of allowed network types. This is only used for * public API downloads. * <P>Type: INTEGER</P> * <P>Owner can Init/Read</P> */ public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types"; /** * The name of the column indicating whether roaming connections can be used. This is only * used for public API downloads. Loading @@ -337,12 +345,12 @@ public final class Downloads { public static final String COLUMN_ALLOW_ROAMING = "allow_roaming"; /** * The name of the column holding a bitmask of allowed network types. This is only used for * public API downloads. * <P>Type: INTEGER</P> * The name of the column indicating whether metered connections can be used. This is only * used for public API downloads. * <P>Type: BOOLEAN</P> * <P>Owner can Init/Read</P> */ public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types"; public static final String COLUMN_ALLOW_METERED = "allow_metered"; /** * Whether or not this download should be displayed in the system's Downloads UI. Defaults Loading Loading @@ -701,7 +709,10 @@ public final class Downloads { * blocked by {@link NetworkPolicyManager}. * * @hide * @deprecated since behavior now uses * {@link #STATUS_WAITING_FOR_NETWORK} */ @Deprecated public static final int STATUS_BLOCKED = 498; /** {@hide} */ Loading services/java/com/android/server/ConnectivityService.java +24 −12 Original line number Diff line number Diff line Loading @@ -865,6 +865,9 @@ private NetworkStateTracker makeWimaxStateTracker() { @Override public NetworkQuotaInfo getActiveNetworkQuotaInfo() { enforceAccessPermission(); final long token = Binder.clearCallingIdentity(); try { final NetworkState state = getNetworkStateUnchecked(mActiveDefaultNetwork); if (state != null) { try { Loading @@ -873,11 +876,17 @@ private NetworkStateTracker makeWimaxStateTracker() { } } return null; } finally { Binder.restoreCallingIdentity(token); } } @Override public boolean isActiveNetworkMetered() { enforceAccessPermission(); final long token = Binder.clearCallingIdentity(); try { final NetworkState state = getNetworkStateUnchecked(mActiveDefaultNetwork); if (state != null) { try { Loading @@ -886,6 +895,9 @@ private NetworkStateTracker makeWimaxStateTracker() { } } return false; } finally { Binder.restoreCallingIdentity(token); } } public boolean setRadios(boolean turnOn) { Loading Loading
core/java/android/app/DownloadManager.java +14 −17 Original line number Diff line number Diff line Loading @@ -347,9 +347,9 @@ public class DownloadManager { private CharSequence mTitle; private CharSequence mDescription; private String mMimeType; private boolean mRoamingAllowed = true; private int mAllowedNetworkTypes = ~0; // default to all network types allowed private boolean mAllowedOverMetered = true; private boolean mRoamingAllowed = true; private boolean mMeteredAllowed = true; private boolean mIsVisibleInDownloadsUi = true; private boolean mScannable = false; private boolean mUseSystemCache = false; Loading Loading @@ -623,17 +623,6 @@ 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 @@ -645,6 +634,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) { mMeteredAllowed = allow; return this; } /** * Set whether this download should be displayed in the system's Downloads UI. True by * default. Loading Loading @@ -687,10 +687,10 @@ 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); values.put(Downloads.Impl.COLUMN_ALLOW_METERED, mMeteredAllowed); values.put(Downloads.Impl.COLUMN_IS_VISIBLE_IN_DOWNLOADS_UI, mIsVisibleInDownloadsUi); return values; Loading Loading @@ -1340,9 +1340,6 @@ public class DownloadManager { 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; } Loading
core/java/android/provider/Downloads.java +15 −4 Original line number Diff line number Diff line Loading @@ -328,6 +328,14 @@ public final class Downloads { */ public static final String COLUMN_IS_PUBLIC_API = "is_public_api"; /** * The name of the column holding a bitmask of allowed network types. This is only used for * public API downloads. * <P>Type: INTEGER</P> * <P>Owner can Init/Read</P> */ public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types"; /** * The name of the column indicating whether roaming connections can be used. This is only * used for public API downloads. Loading @@ -337,12 +345,12 @@ public final class Downloads { public static final String COLUMN_ALLOW_ROAMING = "allow_roaming"; /** * The name of the column holding a bitmask of allowed network types. This is only used for * public API downloads. * <P>Type: INTEGER</P> * The name of the column indicating whether metered connections can be used. This is only * used for public API downloads. * <P>Type: BOOLEAN</P> * <P>Owner can Init/Read</P> */ public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types"; public static final String COLUMN_ALLOW_METERED = "allow_metered"; /** * Whether or not this download should be displayed in the system's Downloads UI. Defaults Loading Loading @@ -701,7 +709,10 @@ public final class Downloads { * blocked by {@link NetworkPolicyManager}. * * @hide * @deprecated since behavior now uses * {@link #STATUS_WAITING_FOR_NETWORK} */ @Deprecated public static final int STATUS_BLOCKED = 498; /** {@hide} */ Loading
services/java/com/android/server/ConnectivityService.java +24 −12 Original line number Diff line number Diff line Loading @@ -865,6 +865,9 @@ private NetworkStateTracker makeWimaxStateTracker() { @Override public NetworkQuotaInfo getActiveNetworkQuotaInfo() { enforceAccessPermission(); final long token = Binder.clearCallingIdentity(); try { final NetworkState state = getNetworkStateUnchecked(mActiveDefaultNetwork); if (state != null) { try { Loading @@ -873,11 +876,17 @@ private NetworkStateTracker makeWimaxStateTracker() { } } return null; } finally { Binder.restoreCallingIdentity(token); } } @Override public boolean isActiveNetworkMetered() { enforceAccessPermission(); final long token = Binder.clearCallingIdentity(); try { final NetworkState state = getNetworkStateUnchecked(mActiveDefaultNetwork); if (state != null) { try { Loading @@ -886,6 +895,9 @@ private NetworkStateTracker makeWimaxStateTracker() { } } return false; } finally { Binder.restoreCallingIdentity(token); } } public boolean setRadios(boolean turnOn) { Loading