@Immutable public final class PluginConfiguration extends Object implements Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<PluginConfiguration> |
CREATOR
Implements the
Parcelable interface |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
PluginConfiguration(boolean isBackwardsCompatibilityEnabled,
boolean isRequiresConnectivity,
boolean isDisruptsConnectivity,
boolean isBuggy,
boolean isDrainsBattery,
boolean isBlacklisted,
Collection<String> alternatives)
Constructs a new plug-in configuration.
|
Modifier and Type | Method and Description |
---|---|
int |
describeContents() |
boolean |
equals(Object o) |
Collection<String> |
getAlternatives()
Determines whether a third party plug-in has an alternative first party implementation.
|
int |
hashCode() |
boolean |
isBackwardsCompatibilityEnabled()
Determines whether the plug-in requires backwards compatibility.
|
boolean |
isBlacklisted()
Determines whether a plug-in is blacklisted.
|
boolean |
isBuggy()
Determines whether a plug-in is known to be buggy.
|
boolean |
isDisruptsConnectivity() |
boolean |
isDrainsBattery()
Determines whether a plug-in has an extreme impact on battery life.
|
boolean |
isRequiresConnectivity() |
void |
writeToParcel(Parcel dest,
int flags) |
public static final Parcelable.Creator<PluginConfiguration> CREATOR
Parcelable
interfacepublic PluginConfiguration(boolean isBackwardsCompatibilityEnabled, boolean isRequiresConnectivity, boolean isDisruptsConnectivity, boolean isBuggy, boolean isDrainsBattery, boolean isBlacklisted, Collection<String> alternatives)
isBackwardsCompatibilityEnabled
- If backwards compatibility for pre-1.0 plug-in API is
enabled.isRequiresConnectivity
- If the plug-in requires Internet connectivity.isDisruptsConnectivity
- If the plug-in disrupts Internet connectivity.isBuggy
- If the plug-in is known to be buggy.isDrainsBattery
- If the plug-in is known to drain the battery.isBlacklisted
- If the plug-in is to be disabled.alternatives
- Alternatives to the plug-in, as a collection of
registry names.public boolean isBackwardsCompatibilityEnabled()
The
beta version of the plug-in API for Locale released in January 2009 was
slightly different from the final version of the API released in December
2009. Prior to Locale 1.0,
Intent.EXTRA_BUNDLE
didn't exist and
plug-ins stored and retrieved their extras directly from the
Intent.ACTION_EDIT_SETTING
or
Intent.ACTION_FIRE_SETTING
Intents.
Although this backwards compatibility should only apply to Setting plug-ins
(since Conditions weren't supported until the API was finalized in Locale
1.0), some plug-in developers copy-pasted their setting implementations to
create conditions so some conditions need backwards compatibility enabled as
well.
public boolean isRequiresConnectivity()
public boolean isDisruptsConnectivity()
public boolean isBuggy()
A buggy plug-in is different from a blacklisted plug-in, as a buggy plug-in may still provide some working functionality to the user. An example of a buggy plug-in would be a third party location condition plug-in that doesn't implement proper hysteresis. Such a plug-in may work, but the user would perceive the plug-in as not behaving well.
public boolean isDrainsBattery()
Determines whether a plug-in has an extreme impact on battery life. The UI might use this information to display a warning to the user, in order to prevent users from blaming the host app for battery drain caused by a plug-in.
public boolean isBlacklisted()
Determines whether a plug-in is blacklisted. A blacklisted plug-in is not considered a valid plug-in by the host and will be ignored by the host.
While preserving user choice is always important, some plug-ins are so malicious, buggy, otherwise problematic that they must be disabled in order to protect the interests of users. Before anyone panics, it should be noted that plug-ins are only blacklisted under exceptional circumstances. This API is maintained so that the entire ecosystem can quickly be protected if absolutely necessary. The decision whether to blacklist a plug-in is fully at the discretion of two forty four a.m. LLC, although the following guidelines cover the blacklisting process. two forty four a.m. LLC's ability to blacklist does not imply that two forty four a.m. LLC is actively or continuously testing plug-ins, nor does it imply two forty four a.m. LLC has any responsibility to police plug-ins.
Intent.EXTRA_BUNDLE
. Plug-ins are
required to store such credentials in their own app private storage, rather than in the
Bundle. Another example would be a plug-in that logs credentials to logcat.Once a plug-in is identified as a candidate for blacklisting, multiple attempts will be made to contact the plug-in developer via email, Google Play, or whatever other mechanism the developer provides for feedback. If the developer does not respond within 30 days, the plug-in may be blacklisted at the discretion of two forty four a.m. LLC. If the developer does respond and appropriately addresses all concerns, then the plug-in will be unblacklisted.
public Collection<String> getAlternatives()
The UI may decide to inform the user that the first party implementation exists. This is not intended to prevent users from trying third party plug-ins, however it is intended to educate users that built-in functionality may already exist. Given the lack of a review process for plug-ins, often plug-in quality is below that of built-in functionality and educating the user generally improves the user experience without taking away choice.
Note: The first party implementation is not guaranteed to be available, and it is the caller's responsibility to handle such a case. For example, different hosts may have different first party implementations. As another example example, Locale contains a built-in Calendar condition but it is only available on API 14 or greater. When determining whether the user should be presented with alternatives to a third party plug-in, Locale must first determine whether the alternative is actually available or not.
Collections.unmodifiableSet(java.util.Set)
.public int describeContents()
describeContents
in interface Parcelable
public void writeToParcel(Parcel dest, int flags)
writeToParcel
in interface Parcelable