MediaPolicyFrontendExtension
Frontend extension for the media frontend that configures the frontend to use policyProvider when a policy is required for a media source with sourcePackageName. Policies offer a way to customize the user interface for a specific source, like adjusting browse source, login and settings user flows through the UserFlowPolicy.
Note: Only one MediaPolicyFrontendExtension can be configured for a combination of sourcePackageName and sourceClassName. An IllegalStateException will be thrown otherwise by the media frontend builder.
If sourcePackageName is null
, the policyProvider will be used for sources that are installed in the system, but have no specific policyProvider. By default, a fallbackMediaPolicyFrontendExtension is used for such a purpose, but a custom fallback frontend extension can be created if necessary.
See the fallback policy example app in the Android Studio project in the TomTom Digital Cockpit SDK, in path examples/media/fallbackpolicy/
.
Note: Only one MediaPolicyFrontendExtension can be configured without a sourcePackageName. If the default fallbackMediaPolicyFrontendExtension is still added to the IVI Gradle build, an IllegalStateException will be thrown by the media frontend builder.
An instance of this extension can be added to the media frontend through the corresponding com.tomtom.ivi.platform.gradle.api.common.iviapplication.config.FrontendConfig
instance of the frontend at build time. See FrontendExtension for details.
Examples: All example apps can be found in the Android Studio project inside the TomTom Digital Cockpit SDK.
How to add custom policies for a media source:
examples/media/custompolicies/
How to change the fallback media policy:
examples/media/fallbackpolicy/
How to customize the media source browsing user flow to show a custom panel:
examples/media/userflowpolicy/
Parameters
The package name of the application providing media source. If the policyProvider should be used for all media sources, then this must be null
. sourceClassName must also be default or null
in this case.
The exposed Android MediaBrowserService class. If the sourcePackageName provides a single media browser service, or the policyProvider should be used for all media browser services in the sourcePackageName, then this can be kept at its default of null
. In this case the policy will be applied to all services of sourcePackageName which have the intent filter MediaBrowserService.SERVICE_INTERFACE.
The policies to apply for the given source.