ActivityFilter


public final class ActivityFilter


Filter for ActivityRule and SplitPlaceholderRule that checks for component name match when a new activity is started. If the filter matches the started activity Intent, the activity will then apply the rule based on the match result. This filter allows a wildcard symbol in the end or instead of the package name, and a wildcard symbol in the end or instead of the class name.

Summary

Public constructors

ActivityFilter(@NonNull ComponentName componentName, String intentAction)

Constructs a new ActivityFilter using a ComponentName and an Intent action.

Public methods

boolean
equals(Object other)
final @NonNull ComponentName

ComponentName that the ActivityFilter will use to match Activity and Intent.

final String

Action used for activity launch intent.

int
final boolean

Returns true if the ActivityFilter matches this Activity.

final boolean

Returns true if the ActivityFilter matches this Intent.

@NonNull String

Public constructors

ActivityFilter

Added in 1.0.0
public ActivityFilter(@NonNull ComponentName componentName, String intentAction)

Constructs a new ActivityFilter using a ComponentName and an Intent action.

Parameters
@NonNull ComponentName componentName

Component name in the intent for the activity. Must be non-empty. Can contain a single wildcard at the end. Supported formats: - package/class - package/* - package/suffix.* - */*

String intentAction

Action used for activity launch intent. If it is not null, the ActivityFilter will check the activity Intent.getAction besides the component name. If it is null, Intent.getAction will be ignored.

Public methods

equals

public boolean equals(Object other)

getComponentName

Added in 1.0.0
public final @NonNull ComponentName getComponentName()

ComponentName that the ActivityFilter will use to match Activity and Intent.

getIntentAction

Added in 1.0.0
public final String getIntentAction()

Action used for activity launch intent.

If it is not null, the ActivityFilter will check the activity Intent.getAction besides the component name. If it is null, Intent.getAction will be ignored.

hashCode

public int hashCode()

matchesActivity

Added in 1.0.0
public final boolean matchesActivity(@NonNull Activity activity)

Returns true if the ActivityFilter matches this Activity. If the ActivityFilter is created with an intent action, the filter will also compare it with Intent.getAction of Activity.getIntent.

Parameters
@NonNull Activity activity

the Activity to test against.

matchesIntent

Added in 1.0.0
public final boolean matchesIntent(@NonNull Intent intent)

Returns true if the ActivityFilter matches this Intent. If the ActivityFilter is created with an intent action, the filter will also compare it with Intent.getAction.

Parameters
@NonNull Intent intent

the Intent to test against.

toString

public @NonNull String toString()