Commit c7a54ab0 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

WebLayer: enable casting by default.

Provide the CastOptionsProvider in the public AndroidManifest.xml so
that no client integration is required. This could cause a conflict with
a client that already integrates with GMSCore cast library and has a
CastOptionsProvider, but current clients do not.

Bug: 1057099, 1148410
Change-Id: I8b342f7515f6b8c5b00b63a5eb86aefe2ea45692
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2534176Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarClark DuVall <cduvall@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827124}
parent 48cc55bd
...@@ -8,6 +8,11 @@ package org.chromium.weblayer_private.interfaces; ...@@ -8,6 +8,11 @@ package org.chromium.weblayer_private.interfaces;
public interface RemoteMediaServiceConstants { public interface RemoteMediaServiceConstants {
// Used as a key in the client's AndroidManifest.xml to enable remote media playback, i.e. // Used as a key in the client's AndroidManifest.xml to enable remote media playback, i.e.
// Presentation API, Remote Playback API, and Media Fling (automatic casting of html5 videos). // Presentation API, Remote Playback API, and Media Fling (automatic casting of html5 videos).
// This exists because clients that already integrate with GMSCore cast framework may find WL's
// integration problematic and need to turn it off. To use this, the application's
// AndroidManifest.xml should have a meta-data tag with this name and value of false. The
// default is true, i.e. enabled.
// TODO(crbug.com/1148410): remove this.
String FEATURE_ENABLED_KEY = "org.chromium.weblayer.ENABLE_REMOTE_MEDIA"; String FEATURE_ENABLED_KEY = "org.chromium.weblayer.ENABLE_REMOTE_MEDIA";
// Used internally by WebLayer as a key to the various values of remote media service // Used internally by WebLayer as a key to the various values of remote media service
......
...@@ -26,6 +26,7 @@ import org.chromium.components.media_router.MediaRouterClient; ...@@ -26,6 +26,7 @@ import org.chromium.components.media_router.MediaRouterClient;
import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContents;
import org.chromium.weblayer_private.IntentUtils; import org.chromium.weblayer_private.IntentUtils;
import org.chromium.weblayer_private.TabImpl; import org.chromium.weblayer_private.TabImpl;
import org.chromium.weblayer_private.WebLayerFactoryImpl;
import org.chromium.weblayer_private.WebLayerImpl; import org.chromium.weblayer_private.WebLayerImpl;
import org.chromium.weblayer_private.interfaces.RemoteMediaServiceConstants; import org.chromium.weblayer_private.interfaces.RemoteMediaServiceConstants;
...@@ -94,13 +95,15 @@ public class MediaRouterClientImpl extends MediaRouterClient { ...@@ -94,13 +95,15 @@ public class MediaRouterClientImpl extends MediaRouterClient {
@CalledByNative @CalledByNative
public static boolean isMediaRouterEnabled() { public static boolean isMediaRouterEnabled() {
if (WebLayerFactoryImpl.getClientMajorVersion() < 88) return false;
Context context = ContextUtils.getApplicationContext(); Context context = ContextUtils.getApplicationContext();
try { try {
ApplicationInfo ai = context.getPackageManager().getApplicationInfo( ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
context.getPackageName(), PackageManager.GET_META_DATA); context.getPackageName(), PackageManager.GET_META_DATA);
return ai.metaData.getBoolean(RemoteMediaServiceConstants.FEATURE_ENABLED_KEY); return ai.metaData.getBoolean(RemoteMediaServiceConstants.FEATURE_ENABLED_KEY, true);
} catch (NameNotFoundException e) { } catch (NameNotFoundException e) {
return false; return true;
} }
} }
......
...@@ -98,5 +98,11 @@ ...@@ -98,5 +98,11 @@
android:exported="false" android:exported="false"
android:isolatedProcess="true" android:isolatedProcess="true"
android:process=":decoder_service" /> android:process=":decoder_service" />
<!-- Cast support -->
<!-- TODO(crbug.com/1148410): remove this. -->
<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="org.chromium.components.media_router.caf.CastOptionsProvider"/>
</application> </application>
</manifest> </manifest>
...@@ -53,14 +53,6 @@ ...@@ -53,14 +53,6 @@
</intent-filter> </intent-filter>
</activity> </activity>
<!-- Cast support -->
<meta-data
android:name="org.chromium.weblayer.ENABLE_REMOTE_MEDIA" android:value="true"/>
<meta-data
android:name=
"com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="org.chromium.components.media_router.caf.CastOptionsProvider"/>
{% if weblayer_package is defined %} {% if weblayer_package is defined %}
<meta-data android:name="org.chromium.weblayer.WebLayerPackage" <meta-data android:name="org.chromium.weblayer.WebLayerPackage"
android:value="{{ weblayer_package }}"/> android:value="{{ weblayer_package }}"/>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment