OSDN Git Service

Notification visibility APIs.
authorDan Sandler <dsandler@android.com>
Sun, 22 Dec 2013 05:33:41 +0000 (23:33 -0600)
committerDan Sandler <dsandler@android.com>
Thu, 30 Jan 2014 17:26:30 +0000 (12:26 -0500)
commit0bf2ed8ae394b327af1bc6e853a698c2dac67aaa
tree3c9646f9988582e4372f89d211d03e3780259c66
parent015d67f449307f86343efb862b4cb2a9be2e9ad3
Notification visibility APIs.

The new visibility property allows an application to signal
to SystemUI whether a notification's contents are safe to
show in "public" situations, i.e. outside of a secure
lockscreen, or whether they should be treated as "private"
(where only the icon is revealed).

Apps that post information that includes no personal or
sensitive information (e.g. a weather alert) can use
VISIBILITY_PUBLIC to allow users to see (and potentially
even dismiss) this kind of notification without unlocking
their devices.

The historical treatment of Android notifications
corresponds to VISIBILITY_PRIVATE, which is the default
visibility setting for all notifications, including apps
that are not aware of this API.

VISIBILITY_PRIVATE notifications may optionally specify a
publicVersion, which is a whole other Notification object
whose contentView will be shown in public contexts. This
allows an app to provide a "redacted" public version of its
notification that is more useful than the system-supplied
version (showing just the icon and app name) but still
conceals private information. For example, a messaging app
that today posts a Notification including the sender and
contents of each message could additionally specify a
publicVersion that says, simply, "N new messages".

There's also VISIBILITY_SECRET for notifications that should
be totally concealed (that is, no icon) in public contexts.
To reveal any hint of this kind of notification would
require the user to unlock the device.

Change-Id: I1552db36c469954d27d3c92ba21ac5c703d47ae1
api/current.txt
core/java/android/app/Notification.java