Backed out changeset 3e06253547af (bug 1329152) on developers request / bug 1371561
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 12 Jun 2017 08:58:10 +0200
changeset 592464 27cad9749cddf68e11fdd4e5d73dad84a8f8cf23
parent 592463 3c60b0f8edb0f107d05f1a1822ac47a284c8f35c
child 592465 b7946b29fbed0bce2419f730816f24e55a909701
child 592469 601390e03132687befc9205771161b9253d20262
child 592475 9a748cdee2d58e84dd19aec207108884246f186c
child 592479 3f1e26c28393f9877cb23ab263854bd6b481f790
child 592489 cb075c8f2faac680dc45511b1283523c867ccd01
child 592525 8c7211cc49637cec922b1d4b141a44c7007f9bb6
child 592530 ad5ac5e96838d419aa182bea5bf3d658ede17838
child 592561 5013b05ad735668d055fee91fdd683fbcd6dab78
child 592628 29ab4f6aa41c3c4d5fc2c8c2f3494e942e75d8c6
child 592660 3a000fcfb3d5c75110dd11eb13b9d55f740012da
child 592665 745c8c409be856f22d9d201bae62e73df5b719b0
child 592666 57f938d25ea21a3b048f1838030fba54e80e5a1d
child 592828 7fe6bf145e0af391714063f086e5e0fde916cd24
child 592966 2339ff7a94835102fb8953287a486361be11576d
child 593203 267c4283d08c4c23b88f055227488443be100db3
child 593214 026de069e0627629614e4762bb7a7311818b19ac
child 593333 41e6ce21e4037cd593a878844980c2f74925d04d
child 593468 f2506be2cf060134d2119ddba26997ba493827f5
child 593497 560c9c18d0cb660e9dad19439d1877615894e595
child 593766 3b09b55cd258bcec98b163e753907fd08316cd2b
child 593790 35469e0a023d05f5046183d51671e1ffe3eb24e4
child 593917 cc5b0089b63b6036ad1a242dd3441ab3d3b6243c
child 593926 919216e21da137a8d3d7d8ef3f9172feaa317f49
child 593944 1b4ac63db5804ed7c526da1f365afb33904cd04d
child 594653 783abfda4e70f1500fe31e6103b7e87f72d20f56
child 595993 aef18e65ce7edde20fb9c7984752cf8abec50dc3
child 600416 1ef84683356dd0009811bc6c641e8af02ffbfb8e
child 600420 1be6a5f9da67eaf7a5e2a418d30f3c12f79b34c0
child 600447 9e53b5b79e3c1a7a725f2271b4fe7462eaee0ef0
push id63406
push userrthijssen@mozilla.com
push dateMon, 12 Jun 2017 09:22:22 +0000
bugs1329152, 1371561
milestone55.0a1
backs out3e06253547af5bc7e5889a9dca25d6d10d4b9c08
Backed out changeset 3e06253547af (bug 1329152) on developers request / bug 1371561
mobile/android/base/AndroidManifest.xml.in
mobile/android/base/AppConstants.java.in
mobile/android/base/generate_build_config.py
mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
mobile/android/base/locales/en-US/android_strings.dtd
mobile/android/base/resources/xml/preferences_advanced.xml
mobile/android/base/strings.xml.in
mobile/android/moz.configure
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -307,20 +307,22 @@
             <intent-filter>
                 <action android:name="android.intent.action.SEND" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <data android:mimeType="text/plain" />
             </intent-filter>
 
         </activity>
 
+#ifdef MOZ_ANDROID_CUSTOM_TABS
         <activity android:name="org.mozilla.gecko.customtabs.CustomTabsActivity"
                   android:configChanges="keyboard|keyboardHidden|mcc|mnc|orientation|screenSize|locale|layoutDirection|smallestScreenSize|screenLayout"
                   android:windowSoftInputMode="stateUnspecified|adjustResize"
                   android:theme="@style/GeckoCustomTabs" />
+#endif
 
         <activity android:name="org.mozilla.gecko.webapps.WebAppActivity"
             android:theme="@style/Theme.AppCompat.NoActionBar" />
 
         <!-- Declare a predefined number of WebApp<num> activities. These are
              used so that each web app can launch in its own activity. -->
 #define FRAGMENT WebAppManifestFragment.xml.frag.in
 #include WebAppFragmentRepeater.inc
@@ -414,23 +416,25 @@
                 <action android:name="android.intent.action.MY_PACKAGE_REPLACED"></action>
             </intent-filter>
         </receiver>
 
         <service
           android:name="org.mozilla.gecko.telemetry.TelemetryUploadService"
           android:exported="false"/>
 
+#ifdef MOZ_ANDROID_CUSTOM_TABS
         <service
             android:name="org.mozilla.gecko.customtabs.GeckoCustomTabsService"
             android:exported="true">
             <intent-filter>
                 <action android:name="android.support.customtabs.action.CustomTabsService" />
             </intent-filter>
         </service>
+#endif
 
 #include ../services/manifests/FxAccountAndroidManifest_services.xml.in
 
         <service
             android:name="org.mozilla.gecko.tabqueue.TabReceivedService"
             android:exported="false" />
 
 
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -304,16 +304,23 @@ public class AppConstants {
 
     public static final boolean MOZ_ANDROID_DOWNLOAD_CONTENT_SERVICE =
 //#ifdef MOZ_ANDROID_DOWNLOAD_CONTENT_SERVICE
     true;
 //#else
     false;
 //#endif
 
+    public static final boolean MOZ_ANDROID_CUSTOM_TABS =
+//#ifdef MOZ_ANDROID_CUSTOM_TABS
+    true;
+//#else
+    false;
+//#endif
+
     // (bug 1266820) Temporarily disabled since no one is working on it.
     public static final boolean SCREENSHOTS_IN_BOOKMARKS_ENABLED = false;
 
     public static final boolean MOZ_ANDROID_ACTIVITY_STREAM =
 //#ifdef MOZ_ANDROID_ACTIVITY_STREAM
         true;
 //#else
         false;
--- a/mobile/android/base/generate_build_config.py
+++ b/mobile/android/base/generate_build_config.py
@@ -34,16 +34,17 @@ from mozbuild.android_version_code impor
 def _defines():
     CONFIG = defaultdict(lambda: None)
     CONFIG.update(buildconfig.substs)
     DEFINES = dict(buildconfig.defines)
 
     for var in ('MOZ_ANDROID_ACTIVITY_STREAM'
                 'MOZ_ANDROID_ANR_REPORTER',
                 'MOZ_ANDROID_BEAM',
+                'MOZ_ANDROID_CUSTOM_TABS',
                 'MOZ_ANDROID_DOWNLOADS_INTEGRATION',
                 'MOZ_ANDROID_DOWNLOAD_CONTENT_SERVICE',
                 'MOZ_ANDROID_EXCLUDE_FONTS',
                 'MOZ_ANDROID_GCM',
                 'MOZ_ANDROID_MLS_STUMBLER',
                 'MOZ_ANDROID_MMA',
                 'MOZ_ANDROID_MOZILLA_ONLINE',
                 'MOZ_LEANPLUM_SDK_KEY',
--- a/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/LauncherActivity.java
@@ -60,17 +60,19 @@ public class LauncherActivity extends Ac
         // Is this web app?
         } else if (isWebAppIntent(safeIntent)) {
             dispatchWebAppIntent();
 
         // If it's not a view intent, it won't be a custom tabs intent either. Just launch!
         } else if (!isViewIntentWithURL(safeIntent)) {
             dispatchNormalIntent();
 
-        } else if (isCustomTabsIntent(safeIntent)) {
+        // Is this a custom tabs intent, and are custom tabs enabled?
+        } else if (AppConstants.MOZ_ANDROID_CUSTOM_TABS && isCustomTabsIntent(safeIntent)
+                && isCustomTabsEnabled()) {
             dispatchCustomTabsIntent();
 
         // Can we dispatch this VIEW action intent to the tab queue service?
         } else if (!safeIntent.getBooleanExtra(BrowserContract.SKIP_TAB_QUEUE_FLAG, false)
                 && TabQueueHelper.TAB_QUEUE_ENABLED
                 && TabQueueHelper.isTabQueueEnabled(this)) {
             dispatchTabQueueIntent();
 
@@ -151,16 +153,20 @@ public class LauncherActivity extends Ac
         return isViewIntentWithURL(safeIntent)
                 && safeIntent.hasExtra(CustomTabsIntent.EXTRA_SESSION);
     }
 
     private static boolean isWebAppIntent(@NonNull final SafeIntent safeIntent) {
         return GeckoApp.ACTION_WEBAPP.equals(safeIntent.getAction());
     }
 
+    private boolean isCustomTabsEnabled() {
+        return GeckoSharedPrefs.forApp(this).getBoolean(GeckoPreferences.PREFS_CUSTOM_TABS, false);
+    }
+
     private boolean isDeepLink(SafeIntent intent) {
         if (intent == null || intent.getData() == null || intent.getData().getScheme() == null
                 || intent.getAction() == null) {
             return false;
         }
         boolean schemeMatched = intent.getData().getScheme().equalsIgnoreCase(DEEP_LINK_SCHEME);
         boolean actionMatched = intent.getAction().equals(Intent.ACTION_VIEW);
         return schemeMatched && actionMatched;
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -156,16 +156,17 @@ public class GeckoPreferences
     private static final String PREFS_FAQ_LINK = NON_PREF_PREFIX + "faq.link";
     private static final String PREFS_FEEDBACK_LINK = NON_PREF_PREFIX + "feedback.link";
     public static final String PREFS_NOTIFICATIONS_CONTENT = NON_PREF_PREFIX + "notifications.content";
     public static final String PREFS_NOTIFICATIONS_CONTENT_LEARN_MORE = NON_PREF_PREFIX + "notifications.content.learn_more";
     public static final String PREFS_NOTIFICATIONS_WHATS_NEW = NON_PREF_PREFIX + "notifications.whats_new";
     public static final String PREFS_APP_UPDATE_LAST_BUILD_ID = "app.update.last_build_id";
     public static final String PREFS_READ_PARTNER_CUSTOMIZATIONS_PROVIDER = NON_PREF_PREFIX + "distribution.read_partner_customizations_provider";
     public static final String PREFS_READ_PARTNER_BOOKMARKS_PROVIDER = NON_PREF_PREFIX + "distribution.read_partner_bookmarks_provider";
+    public static final String PREFS_CUSTOM_TABS = NON_PREF_PREFIX + "customtabs";
     public static final String PREFS_ACTIVITY_STREAM = NON_PREF_PREFIX + "experiments.activitystream";
     public static final String PREFS_CATEGORY_EXPERIMENTAL_FEATURES = NON_PREF_PREFIX + "category_experimental";
     public static final String PREFS_COMPACT_TABS = NON_PREF_PREFIX + "compact_tabs";
     public static final String PREFS_SHOW_QUIT_MENU = NON_PREF_PREFIX + "distribution.show_quit_menu";
     public static final String PREFS_SEARCH_SUGGESTIONS_ENABLED = "browser.search.suggest.enabled";
     public static final String PREFS_DEFAULT_BROWSER = NON_PREF_PREFIX + "default_browser.link";
     public static final String PREFS_SYSTEM_FONT_SIZE = NON_PREF_PREFIX + "font.size.use_system_font_size";
     public static final String PREFS_SET_AS_HOMEPAGE = NON_PREF_PREFIX + "distribution.set_as_homepage";
@@ -690,16 +691,17 @@ public class GeckoPreferences
                         continue;
                     }
                 } else if (PREFS_SCREEN_ADVANCED.equals(key) &&
                         !Restrictions.isAllowed(this, Restrictable.ADVANCED_SETTINGS)) {
                     preferences.removePreference(pref);
                     i--;
                     continue;
                 } else if (PREFS_CATEGORY_EXPERIMENTAL_FEATURES.equals(key)
+                        && !AppConstants.MOZ_ANDROID_CUSTOM_TABS
                         && !ActivityStream.isUserSwitchable(this)) {
                     preferences.removePreference(pref);
                     i--;
                     continue;
                 }
                 setupPreferences((PreferenceGroup) pref, prefs);
             } else {
                 if (HANDLERS.containsKey(key)) {
@@ -880,16 +882,20 @@ public class GeckoPreferences
                     }
                 } else if (PREFS_NOTIFICATIONS_CONTENT.equals(key) ||
                         PREFS_NOTIFICATIONS_CONTENT_LEARN_MORE.equals(key)) {
                     if (!FeedService.isInExperiment(this)) {
                         preferences.removePreference(pref);
                         i--;
                         continue;
                     }
+                } else if (PREFS_CUSTOM_TABS.equals(key) && !AppConstants.MOZ_ANDROID_CUSTOM_TABS) {
+                    preferences.removePreference(pref);
+                    i--;
+                    continue;
                 } else if (PREFS_ACTIVITY_STREAM.equals(key)
                         && !ActivityStream.isUserSwitchable(this)) {
                     preferences.removePreference(pref);
                     i--;
                     continue;
                 } else if (PREFS_COMPACT_TABS.equals(key)) {
                     if (HardwareUtils.isTablet()) {
                         preferences.removePreference(pref);
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -278,16 +278,21 @@
 
 <!ENTITY pref_whats_new_notification "What\'s new in &brandShortName;">
 <!ENTITY pref_whats_new_notification_summary "Learn about new features after an update">
 
 <!-- Localization note (pref_category_experimental): Title of a sub category in the 'advanced' category
      for experimental features. -->
 <!ENTITY pref_category_experimental "Experimental features">
 
+<!-- Custom Tabs is an Android API for allowing third-party apps to open URLs in a customized UI.
+     Instead of switching to the browser it appears as if the user stays in the third-party app.
+     For more see: https://developer.chrome.com/multidevice/android/customtabs -->
+<!ENTITY pref_custom_tabs "Custom Tabs">
+<!ENTITY pref_custom_tabs_summary3 "Allow apps to open websites using a customized version of &brandShortName;">
 <!-- Localization note (custom_tabs_menu_item_open_in): The variable is replaced by the name of
      default browser from user's preference, such as "Open in Firefox" -->
 <!ENTITY custom_tabs_menu_item_open_in "Open in &formatS;">
 <!ENTITY custom_tabs_menu_footer "Powered by &brandShortName;">
 <!-- Long-click title of CustomTabsActivity will copy URL to clipboard and display this hint -->
 <!ENTITY custom_tabs_hint_url_copy "URL copied">
 
 <!-- Localization note (pref_activity_stream): Experimental feature, see https://testpilot.firefox.com/experiments/activity-stream  -->
--- a/mobile/android/base/resources/xml/preferences_advanced.xml
+++ b/mobile/android/base/resources/xml/preferences_advanced.xml
@@ -84,11 +84,17 @@
         android:key="android.not_a_preference.category_experimental"
         android:title="@string/pref_category_experimental">
 
         <org.mozilla.gecko.activitystream.ActivityStreamPreference
             android:key="android.not_a_preference.experiments.activitystream"
             android:title="@string/pref_activity_stream"
             android:summary="@string/pref_activity_stream_summary" />
 
+
+        <SwitchPreference android:key="android.not_a_preference.customtabs"
+            android:title="@string/pref_custom_tabs"
+            android:summary="@string/pref_custom_tabs_summary"
+            android:defaultValue="false" />
+
     </PreferenceCategory>
 
 </PreferenceScreen>
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -236,16 +236,18 @@
   <string name="pref_tracking_protection_enabled_pb">&pref_tracking_protection_enabled_pb;</string>
   <string name="pref_tracking_protection_disabled">&pref_tracking_protection_disabled;</string>
 
   <string name="pref_whats_new_notification">&pref_whats_new_notification;</string>
   <string name="pref_whats_new_notification_summary">&pref_whats_new_notification_summary;</string>
 
   <string name="pref_category_experimental">&pref_category_experimental;</string>
 
+  <string name="pref_custom_tabs">&pref_custom_tabs;</string>
+  <string name="pref_custom_tabs_summary">&pref_custom_tabs_summary3;</string>
   <string name="custom_tabs_menu_item_open_in">&custom_tabs_menu_item_open_in;</string>
   <string name="custom_tabs_menu_footer">&custom_tabs_menu_footer;</string>
   <string name="custom_tabs_hint_url_copy">&custom_tabs_hint_url_copy;</string>
 
   <string name="pref_activity_stream">&pref_activity_stream;</string>
   <string name="pref_activity_stream_summary">&pref_activity_stream_summary;</string>
 
   <string name="pref_char_encoding">&pref_char_encoding;</string>
--- a/mobile/android/moz.configure
+++ b/mobile/android/moz.configure
@@ -63,16 +63,20 @@ project_flag('MOZ_ANDROID_SEARCH_ACTIVIT
 project_flag('MOZ_ANDROID_MLS_STUMBLER',
              help='Include Mozilla Location Service Stumbler on Android',
              default=True)
 
 project_flag('MOZ_ANDROID_DOWNLOAD_CONTENT_SERVICE',
              help='Background service for downloading additional content at runtime',
              default=True)
 
+project_flag('MOZ_ANDROID_CUSTOM_TABS',
+             help='Enable support for Android custom tabs',
+             default=milestone.is_nightly)
+
 # Enable the Switchboard A/B framework code.
 # Note: The framework is always included in the app. This flag controls
 # usage of the framework.
 project_flag('MOZ_SWITCHBOARD',
              help='Include Switchboard A/B framework on Android',
              default=True)
 
 project_flag('MOZ_ANDROID_HLS_SUPPORT',