Bug 1033560 - Enable chromecast support in dev builds. r=gps,blassey

This commit is contained in:
Wes Johnston 2014-07-08 09:15:50 -07:00
Родитель d979d4ad0f
Коммит abe8fffd97
10 изменённых файлов: 34 добавлений и 25 удалений

Просмотреть файл

@ -3895,6 +3895,7 @@ MOZ_SAFE_BROWSING=
MOZ_HELP_VIEWER=
MOZ_SPELLCHECK=1
MOZ_ANDROID_OMTC=
MOZ_NATIVE_CASTING=1
MOZ_TOOLKIT_SEARCH=1
MOZ_UI_LOCALE=en-US
MOZ_UNIVERSALCHARDET=1
@ -7668,6 +7669,19 @@ else
OMNIJAR_NAME=omni.ja
fi
dnl ========================================================
dnl = --disable-native-casting
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(native-casting,
[ --disable-native-casting Disable native casting devices],
MOZ_NATIVE_CASTING=,
MOZ_NATIVE_CASTING=1)
if test "$MOZ_NATIVE_CASTING"; then
AC_DEFINE(MOZ_NATIVE_CASTING)
fi
AC_SUBST(MOZ_NATIVE_CASTING)
AC_SUBST(OMNIJAR_NAME)
AC_SUBST(MOZ_OMNIJAR)
AC_SUBST(MOZ_PACKAGER_FORMAT)

Просмотреть файл

@ -92,7 +92,7 @@
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true"/>
#ifdef MOZ_NATIVE_DEVICES
#ifdef MOZ_NATIVE_CASTING
<!-- This resources comes from Google Play Services. Required for casting support. -->
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
#endif

Просмотреть файл

@ -164,7 +164,7 @@ public class AppConstants {
#endif
public static final boolean MOZ_MEDIA_PLAYER =
#ifdef MOZ_NATIVE_DEVICES
#ifdef MOZ_NATIVE_CASTING
true;
#else
false;

Просмотреть файл

@ -550,19 +550,6 @@ public class BrowserApp extends GeckoApp
Distribution.init(this);
// Shipping Native casting is optional and dependent on whether you've downloaded the support
// and google play libraries
if (AppConstants.MOZ_MEDIA_PLAYER) {
try {
Class<?> mediaManagerClass = Class.forName("org.mozilla.gecko.MediaPlayerManager");
Method init = mediaManagerClass.getMethod("init", Context.class);
init.invoke(null, this);
} catch(Exception ex) {
// Ignore failures
Log.i(LOGTAG, "No native casting support", ex);
}
}
JavaAddonManager.getInstance().init(getApplicationContext());
mSharedPreferencesHelper = new SharedPreferencesHelper(getApplicationContext());
mOrderedBroadcastHelper = new OrderedBroadcastHelper(getApplicationContext());

Просмотреть файл

@ -19,10 +19,12 @@ import com.google.android.gms.cast.MediaMetadata;
import com.google.android.gms.cast.MediaStatus;
import com.google.android.gms.cast.RemoteMediaPlayer;
import com.google.android.gms.cast.RemoteMediaPlayer.MediaChannelResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.common.GooglePlayServicesUtil;
import android.content.Context;
import android.os.Bundle;
@ -131,6 +133,11 @@ class ChromeCast implements GeckoMediaPlayer {
}
public ChromeCast(Context context, RouteInfo route) {
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context);
if (status != ConnectionResult.SUCCESS) {
throw new IllegalStateException("Play services are required for Chromecast support (go status code " + status + ")");
}
this.context = context;
this.route = route;
}

Просмотреть файл

@ -67,7 +67,7 @@ JAVA_BOOTCLASSPATH = \
JAVA_BOOTCLASSPATH := $(subst $(NULL) ,:,$(strip $(JAVA_BOOTCLASSPATH)))
# If native devices are enabled, add Google Play Services and some of the v7 compat libraries
ifdef MOZ_NATIVE_DEVICES
ifdef MOZ_NATIVE_CASTING
JAVA_CLASSPATH += \
$(GOOGLE_PLAY_SERVICES_LIB) \
$(ANDROID_MEDIAROUTER_LIB) \
@ -304,7 +304,7 @@ generated/android/support/v7/appcompat/R.java: .aapt.deps ;
generated/android/support/v7/mediarouter/R.java: .aapt.deps ;
generated/com/google/android/gms/R.java: .aapt.deps ;
ifdef MOZ_NATIVE_DEVICES
ifdef MOZ_NATIVE_CASTING
extra_packages += android.support.v7.appcompat
extra_res_dirs += $(ANDROID_APPCOMPAT_RES)

Просмотреть файл

@ -5,6 +5,7 @@
package org.mozilla.gecko;
import org.mozilla.gecko.util.EventCallback;
import org.mozilla.gecko.mozglue.JNITarget;
import org.mozilla.gecko.util.NativeEventListener;
import org.mozilla.gecko.util.NativeJSObject;
@ -36,7 +37,7 @@ interface GeckoMediaPlayer {
* from Gecko to the correct caster based on the id of the display
*/
class MediaPlayerManager implements NativeEventListener,
GeckoAppShell.AppStateListener {
GeckoAppShell.AppStateListener {
private static final String LOGTAG = "GeckoMediaPlayerManager";
private static final boolean SHOW_DEBUG = false;
@ -58,6 +59,7 @@ class MediaPlayerManager implements NativeEventListener,
private final HashMap<String, GeckoMediaPlayer> displays = new HashMap<String, GeckoMediaPlayer>();
private static MediaPlayerManager instance;
@JNITarget
public static void init(Context context) {
if (instance != null) {
debug("MediaPlayerManager initialized twice");
@ -84,6 +86,7 @@ class MediaPlayerManager implements NativeEventListener,
"MediaPlayer:End");
}
@JNITarget
public static void onDestroy() {
if (instance == null) {
return;

Просмотреть файл

@ -17,7 +17,7 @@ resjar.generated_sources += [
'org/mozilla/gecko/R.java',
]
if CONFIG['MOZ_NATIVE_DEVICES']:
if CONFIG['MOZ_NATIVE_CASTING']:
resjar.generated_sources += ['com/google/android/gms/R.java']
resjar.generated_sources += ['android/support/v7/appcompat/R.java']
resjar.generated_sources += ['android/support/v7/mediarouter/R.java']
@ -473,7 +473,7 @@ gbjar.extra_jars = [
'websockets.jar',
]
if CONFIG['MOZ_NATIVE_DEVICES']:
if CONFIG['MOZ_NATIVE_CASTING']:
gbjar.extra_jars += [CONFIG['ANDROID_APPCOMPAT_LIB']]
gbjar.extra_jars += [CONFIG['ANDROID_MEDIAROUTER_LIB']]
gbjar.extra_jars += [CONFIG['GOOGLE_PLAY_SERVICES_LIB']]
@ -530,7 +530,7 @@ ANDROID_GENERATED_RESFILES += [
]
for var in ('MOZ_ANDROID_ANR_REPORTER', 'MOZ_LINKER_EXTRACT', 'MOZILLA_OFFICIAL', 'MOZ_DEBUG',
'MOZ_ANDROID_SEARCH_ACTIVITY', 'MOZ_NATIVE_DEVICES'):
'MOZ_ANDROID_SEARCH_ACTIVITY', 'MOZ_NATIVE_CASTING'):
if CONFIG[var]:
DEFINES[var] = 1
@ -613,7 +613,7 @@ cpe = main.add_classpathentry('src', SRCDIR,
'org/mozilla/gecko/resources/**'])
if not CONFIG['MOZ_CRASHREPORTER']:
cpe.exclude_patterns += ['org/mozilla/gecko/CrashReporter.java']
if not CONFIG['MOZ_NATIVE_DEVICES']:
if not CONFIG['MOZ_NATIVE_CASTING']:
cpe.exclude_patterns += ['org/mozilla/gecko/ChromeCast.java']
cpe.exclude_patterns += ['org/mozilla/gecko/MediaPlayerManager.java']
main.add_classpathentry('generated', OBJDIR + '/generated',

Просмотреть файл

@ -32,6 +32,7 @@ ac_add_options --with-android-gnu-compiler-version=4.7
ac_add_options --with-android-version=9
ac_add_options --with-system-zlib
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --disable-native-casting # Disable native casting support until the builders are updated
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
ac_add_options --enable-warnings-as-errors

Просмотреть файл

@ -69,8 +69,5 @@ MOZ_LOCALE_SWITCHER=1
# Enable second screen and casting support for external devices.
MOZ_DEVICES=1
# Enable second screen using native Android libraries
MOZ_NATIVE_DEVICES=
# Don't enable the Search Activity.
# MOZ_ANDROID_SEARCH_ACTIVITY=1