Make downloads visible by default.

Change-Id: I8f8b325658d8afc964bddd3f1c03ed20e6bd10aa
This commit is contained in:
Steve Howard
2010-07-28 17:12:40 -07:00
parent 818490ab2a
commit 8e15afe799
3 changed files with 22 additions and 43 deletions

View File

@ -96558,19 +96558,6 @@
<parameter name="value" type="java.lang.String"> <parameter name="value" type="java.lang.String">
</parameter> </parameter>
</method> </method>
<method name="setShowNotification"
return="android.net.DownloadManager.Request"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="flags" type="int">
</parameter>
</method>
<method name="setTitle" <method name="setTitle"
return="android.net.DownloadManager.Request" return="android.net.DownloadManager.Request"
abstract="false" abstract="false"
@ -96617,17 +96604,6 @@
visibility="public" visibility="public"
> >
</field> </field>
<field name="NOTIFICATION_WHEN_RUNNING"
type="int"
transient="false"
volatile="false"
value="1"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
</class> </class>
<class name="LocalServerSocket" <class name="LocalServerSocket"
extends="java.lang.Object" extends="java.lang.Object"

View File

@ -240,12 +240,6 @@ public class DownloadManager {
* only required parameter. * only required parameter.
*/ */
public static class Request { public static class Request {
/**
* Bit flag for {@link #setShowNotification} indicating a notification should be created
* while the download is running.
*/
public static final int NOTIFICATION_WHEN_RUNNING = 1;
/** /**
* Bit flag for {@link #setAllowedNetworkTypes} corresponding to * Bit flag for {@link #setAllowedNetworkTypes} corresponding to
* {@link ConnectivityManager#TYPE_MOBILE}. * {@link ConnectivityManager#TYPE_MOBILE}.
@ -269,7 +263,7 @@ public class DownloadManager {
private Map<String, String> mRequestHeaders = new HashMap<String, String>(); private Map<String, String> mRequestHeaders = new HashMap<String, String>();
private String mTitle; private String mTitle;
private String mDescription; private String mDescription;
private int mNotificationFlags = 0; private boolean mShowNotification = true;
private String mMediaType; private String mMediaType;
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
@ -344,15 +338,20 @@ public class DownloadManager {
} }
/** /**
* Control system notifications posted by the download manager for this download. If * Control whether a system notification is posted by the download manager while this
* enabled, the download manager posts notifications about downloads through the system * download is running. If enabled, the download manager posts notifications about downloads
* {@link android.app.NotificationManager}. By default, no notification is shown. * through the system {@link android.app.NotificationManager}. By default, a notification is
* shown.
* *
* @param flags any combination of the NOTIFICATION_* bit flags * If set to false, this requires the permission
* android.permission.DOWNLOAD_WITHOUT_NOTIFICATION.
*
* @param show whether the download manager should show a notification for this download.
* @return this object * @return this object
* @hide
*/ */
public Request setShowNotification(int flags) { public Request setShowRunningNotification(boolean show) {
mNotificationFlags = flags; mShowNotification = show;
return this; return this;
} }
@ -404,11 +403,9 @@ public class DownloadManager {
putIfNonNull(values, Downloads.COLUMN_DESCRIPTION, mDescription); putIfNonNull(values, Downloads.COLUMN_DESCRIPTION, mDescription);
putIfNonNull(values, Downloads.COLUMN_MIME_TYPE, mMediaType); putIfNonNull(values, Downloads.COLUMN_MIME_TYPE, mMediaType);
int visibility = Downloads.VISIBILITY_HIDDEN; values.put(Downloads.COLUMN_VISIBILITY,
if ((mNotificationFlags & NOTIFICATION_WHEN_RUNNING) != 0) { mShowNotification ? Downloads.VISIBILITY_VISIBLE
visibility = Downloads.VISIBILITY_VISIBLE; : Downloads.VISIBILITY_HIDDEN);
}
values.put(Downloads.COLUMN_VISIBILITY, visibility);
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);

View File

@ -624,12 +624,18 @@ public final class Downloads {
"android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS"; "android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS";
/** /**
* The permission to downloads files to the cache partition that won't be automatically * The permission to download files to the cache partition that won't be automatically
* purged when space is needed. * purged when space is needed.
*/ */
public static final String PERMISSION_CACHE_NON_PURGEABLE = public static final String PERMISSION_CACHE_NON_PURGEABLE =
"android.permission.DOWNLOAD_CACHE_NON_PURGEABLE"; "android.permission.DOWNLOAD_CACHE_NON_PURGEABLE";
/**
* The permission to download files without any system notification being shown.
*/
public static final String PERMISSION_NO_NOTIFICATION =
"android.permission.DOWNLOAD_WITHOUT_NOTIFICATION";
/** /**
* The content:// URI for the data table in the provider * The content:// URI for the data table in the provider
*/ */