public final class EventPermission extends java.security.Permission
EventPermissionallows access to system events. An
EventPermissionobject contains a name (also referred to as a "target name") and actions.
The target name is the name of the event ("BATTERY_LEVEL", "com.MyCompany.MyEvent", etc). The naming convention follows the hierarchical property naming convention. Also, an asterisk MAY appear at the end of the name, following a ".", or by itself, to signify a wildcard match. For example: "com.MyCompany.*" or "*" is valid, "*MyCompany" or "a*b" is not valid.
The actions to be granted are passed to the constructor in a non-empty string,
containing a list of comma-separated keywords. Trailing and leading white
spaces as well as those between the keywords and commas in the list are not
allowed and lead to an
IllegalArgumentException. The possible
keywords are "post", "postsystem", "read" and "register". Their meaning is
defined as follows:
|| Permission to post an event. Allows the
|| Permission to post a system event. Allows the
|| Permission to read an event. Allows the
|| Permission to register and unregister applications to launch
in response to events. Allows the
Care should be taken before granting application permission to access certain events. For example, granting permission to post events could allow a badly behaving application to interfere with the operation of the device.
|Constructor and Description|
Creates a new
|Modifier and Type||Method and Description|
Checks if another object is "equal" to this one.
Gets the canonical string representing the actions.
Gets the hash code value for this object.
Checks if the specified permission is "implied" by this object.
public EventPermission(java.lang.String event, java.lang.String actions)
EventPermissionobject with the specified name and actions. If an action is listed multiple times, the second and following occurences are ignored, means
"post,post"has the same effect as
event- The name of the event for which to grant permission, not empty.
actions- Valid actions are "post", "postsystem", "read" and "register".
actionsinclude any string other than those allowed, or if
eventargument is an empty string, or a string that consists of white space(s) only.
public boolean implies(java.security.Permission p)
p- the permission to check against.
trueif the passed permission is equal to or implied by this permission,
public java.lang.String getActions()
EventPermissionobject allows both, post and read actions, a call to
getActionswill return the string
public int hashCode()
public boolean equals(java.lang.Object object)
object- an object to compare
trueif the objects are of the same type and the event and action are equal.
Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.