From 521312c6f8c26461bc0823389482c11e67c6eb03 Mon Sep 17 00:00:00 2001 From: Grisha Kruglov Date: Tue, 18 Jun 2019 16:37:51 -0700 Subject: [PATCH] Disable send tab for non-nightly, non-debug builds (#3542) * Put deviceCapabilities list behind a SEND_TAB_ENABLED flag * Disable SEND_TAB for non-debug, non-nightly builds --- app/build.gradle | 4 +++- .../mozilla/fenix/components/BackgroundServices.kt | 12 +++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ddf4e18144..2f9f9b769b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -258,7 +258,9 @@ android.applicationVariants.all { variant -> // ------------------------------------------------------------------------------------------------- // Feature build flags // ------------------------------------------------------------------------------------------------- - buildConfigField 'Boolean', 'SEND_TAB_ENABLED', (true).toString() + // NB: flipping SEND_TAB_ENABLED flag back and worth is currently not well supported and may need hand-holding. + // Consult with the android-components peers before changing. + buildConfigField 'Boolean', 'SEND_TAB_ENABLED', (buildType == "nightly" || isDebug).toString() buildConfigField 'Boolean', 'PULL_TO_REFRESH_ENABLED', (false).toString() } diff --git a/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt b/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt index 928f0f4012..b69e1cbbe1 100644 --- a/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt +++ b/app/src/main/java/org/mozilla/fenix/components/BackgroundServices.kt @@ -22,6 +22,7 @@ import mozilla.components.service.fxa.Config import mozilla.components.service.fxa.manager.DeviceTuple import mozilla.components.service.fxa.manager.FxaAccountManager import mozilla.components.support.base.log.logger.Logger +import org.mozilla.fenix.BuildConfig import org.mozilla.fenix.Experiments import org.mozilla.fenix.R import org.mozilla.fenix.isInExperiment @@ -77,11 +78,20 @@ class BackgroundServices( } } + // NB: flipping this flag back and worth is currently not well supported and may need hand-holding. + // Consult with the android-components peers before changing. + // See https://github.com/mozilla/application-services/issues/1308 + private val deviceCapabilities = if (BuildConfig.SEND_TAB_ENABLED) { + listOf(DeviceCapability.SEND_TAB) + } else { + emptyList() + } + val accountManager = FxaAccountManager( context, config, scopes, - DeviceTuple(context.getString(R.string.app_name), DeviceType.MOBILE, listOf(DeviceCapability.SEND_TAB)), + DeviceTuple(context.getString(R.string.app_name), DeviceType.MOBILE, deviceCapabilities), syncManager ).also { it.registerForDeviceEvents(deviceEventObserver, ProcessLifecycleOwner.get(), true)