Added in API level 37

AppFunctionObserver


public interface AppFunctionObserver

android.app.appfunctions.AppFunctionObserver


Interface for observing changes to app functions provided to AppFunctionManager.observeAppFunctions.

Summary

Public methods

abstract void onAppFunctionMetadataChanged(Set<String> changedPackageNames)

Called when changes occur to a package exposing app functions that may impact the state or metadata of its contained functions.

abstract void onAppFunctionStatesChanged(Set<AppFunctionName> changedFunctionNames)

Called when the runtime state of one or more app functions changes.

Public methods

onAppFunctionMetadataChanged

Added in API level 37
public abstract void onAppFunctionMetadataChanged (Set<String> changedPackageNames)

Called when changes occur to a package exposing app functions that may impact the state or metadata of its contained functions.

This includes changes such as:

  • The definition of a function metadata exposed by the package has changed (e.g, the parameters of the function have changed).
  • All functions within the package are added or removed due to the package being installed or uninstalled.
  • The package's AppFunctionPackageMetadata has been updated.

Upon receiving this notification, clients can call AppFunctionManager.searchAppFunctions with AppFunctionSearchSpec.Builder.setPackageNames to retrieve the updated AppFunctionMetadata for affected functions.

Clients should call AppFunctionManager.getAppFunctionStates to retrieve the latest AppFunctionState for packages affected by these changes.

Note: If packages are reported to have changed but are not returned from AppFunctionManager.searchAppFunctions, it means that the packages have been uninstalled or no longer have functions.

Parameters
changedPackageNames Set: The names of the updated packages.
This value cannot be null.

onAppFunctionStatesChanged

Added in API level 37
public abstract void onAppFunctionStatesChanged (Set<AppFunctionName> changedFunctionNames)

Called when the runtime state of one or more app functions changes.

Upon receiving this notification, clients can call AppFunctionManager.getAppFunctionStates to retrieve the updated AppFunctionState for the affected functions.

Parameters
changedFunctionNames Set: The list of AppFunctionNames for the functions whose state has changed.
This value cannot be null.