Bug 1384021 - Enable Activity Stream for all users and remove experiment/setting. r?mcomella
MozReview-Commit-ID: NDTBevZfX1
--- a/mobile/android/app/src/main/res/xml/preferences_advanced.xml
+++ b/mobile/android/app/src/main/res/xml/preferences_advanced.xml
@@ -73,22 +73,16 @@
android:persistent="false"
url="https://developer.mozilla.org/docs/Tools/Remote_Debugging/Debugging_Firefox_for_Android_with_WebIDE" />
</PreferenceCategory>
<PreferenceCategory
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" />
<SwitchPreference android:key="android.not_a_preference.pwa"
android:title="@string/pref_pwa"
android:summary="@string/pref_pwa_summary"
--- a/mobile/android/base/java/org/mozilla/gecko/Experiments.java
+++ b/mobile/android/base/java/org/mozilla/gecko/Experiments.java
@@ -51,25 +51,16 @@ public class Experiments {
public static final String URLBAR_SHOW_ORIGIN_ONLY = "urlbar-show-origin-only";
// Show name of organization (EV cert) instead of full URL in URL bar (Bug 1249594).
public static final String URLBAR_SHOW_EV_CERT_OWNER = "urlbar-show-ev-cert-owner";
// Play HLS videos in a VideoView (Bug 1313391)
public static final String HLS_VIDEO_PLAYBACK = "hls-video-playback";
- // Make new activity stream panel available (to replace top sites) (Bug 1313316)
- public static final String ACTIVITY_STREAM = "activity-stream";
-
- // Show a setting in "experimental features" for enabling/disabling activity stream.
- public static final String ACTIVITY_STREAM_SETTING = "activity-stream-setting";
-
- // Enable Activity stream by default for users in the "opt out" group.
- public static final String ACTIVITY_STREAM_OPT_OUT = "activity-stream-opt-out";
-
// Show AddOns menu-item in top level menu
public static final String TOP_ADDONS_MENU = "top-addons-menu";
// Enable full bookmark management(full-page dialog, bookmark/folder modification, etc.)
public static final String FULL_BOOKMARK_MANAGEMENT = "full-bookmark-management";
// Enable Leanplum SDK
public static final String LEANPLUM = "leanplum-start";
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/ActivityStream.java
+++ b/mobile/android/base/java/org/mozilla/gecko/activitystream/ActivityStream.java
@@ -45,106 +45,23 @@ public class ActivityStream {
*/
private static final List<String> UNDESIRED_LABELS = Arrays.asList(
"render",
"login",
"edit"
);
/**
- * Returns true if the user has made an active decision: Enabling or disabling Activity Stream.
- */
- public static boolean hasUserEnabledOrDisabled(Context context) {
- final SharedPreferences preferences = GeckoSharedPrefs.forApp(context);
- return preferences.contains(GeckoPreferences.PREFS_ACTIVITY_STREAM);
- }
-
- /**
- * Set the user's decision: Enable or disable Activity Stream.
- */
- public static void setUserEnabled(Context context, boolean value) {
- GeckoSharedPrefs.forApp(context).edit()
- .putBoolean(GeckoPreferences.PREFS_ACTIVITY_STREAM, value)
- .apply();
- }
-
- /**
- * Returns true if Activity Stream has been enabled by the user. Before calling this method
- * hasUserEnabledOrDisabled() should be used to determine whether the user actually has made
- * a decision.
- */
- public static boolean isEnabledByUser(Context context) {
- final SharedPreferences preferences = GeckoSharedPrefs.forApp(context);
- if (!preferences.contains(GeckoPreferences.PREFS_ACTIVITY_STREAM)) {
- throw new IllegalStateException("User hasn't made a decision. Call hasUserEnabledOrDisabled() before calling this method");
- }
-
- return preferences.getBoolean(GeckoPreferences.PREFS_ACTIVITY_STREAM, /* should not be used */ false);
- }
-
- /**
- * Is Activity Stream enabled by an A/B experiment?
- */
- public static boolean isEnabledByExperiment(Context context) {
- // For users in the "opt out" group Activity Stream is enabled by default.
- return SwitchBoard.isInExperiment(context, Experiments.ACTIVITY_STREAM_OPT_OUT);
- }
-
- /**
- * Is Activity Stream enabled? Either actively by the user or by an experiment?
+ * Is Activity Stream enabled?
*/
public static boolean isEnabled(Context context) {
- // (1) Can Activity Steam be enabled on this device?
- if (!canBeEnabled(context)) {
- return false;
- }
-
- // (2) Has Activity Stream be enabled/disabled by the user?
- if (hasUserEnabledOrDisabled(context)) {
- return isEnabledByUser(context);
- }
-
- // (3) Is Activity Stream enabled by an experiment?
- return isEnabledByExperiment(context);
- }
-
- /**
- * Can the user enable/disable Activity Stream (Returns true) or is this completely controlled by us?
- */
- public static boolean isUserSwitchable(Context context) {
- // (1) Can Activity Steam be enabled on this device?
- if (!canBeEnabled(context)) {
- return false;
- }
-
- // (2) Is the user part of the experiment for showing the settings UI?
- return SwitchBoard.isInExperiment(context, Experiments.ACTIVITY_STREAM_SETTING);
- }
-
- /**
- * This method returns true if Activity Stream can be enabled - by the user or an experiment.
- * Whether a setting shows up or whether the user is in an experiment group is evaluated
- * separately from this method. However if this methods returns false then Activity Stream
- * should never be visible/enabled - no matter what build or what experiments are active.
- */
- public static boolean canBeEnabled(Context context) {
- if (!AppConstants.NIGHTLY_BUILD) {
- // If this is not a Nightly build then hide Activity Stream completely. We can control
- // this via the Switchboard experiment too but I want to make really sure that this
- // isn't riding the trains accidentally.
- return false;
- }
-
- if (!SwitchBoard.isInExperiment(context, Experiments.ACTIVITY_STREAM)) {
- // This is our kill switch. If the user is not part of this experiment then show no
- // Activity Stream UI.
- return false;
- }
-
- // Activity stream can be enabled. Whether it is depends on other experiments and settings.
+ // Fennec 57+ here we come!
+ // The only reason this method still exists is so that the old home panel code isn't
+ // suddenly unused and triggers all kinds of lint errors. However we should clean
+ // this up soon (Bug 1386725).
return true;
}
/**
* Query whether we want to display Activity Stream as a Home Panel (within the HomePager),
* or as a HomePager replacement.
*/
public static boolean isHomePanel() {
deleted file mode 100644
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/ActivityStreamPreference.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.activitystream;
-
-import android.content.Context;
-import android.content.Intent;
-import android.preference.SwitchPreference;
-import android.util.AttributeSet;
-
-import org.mozilla.gecko.AppConstants;
-import org.mozilla.gecko.GeckoApplication;
-import org.mozilla.gecko.util.ThreadUtils;
-
-/**
- * A custom switch preference that is used while we allow users to opt-out from using Activity Stream.
- */
-public class ActivityStreamPreference extends SwitchPreference {
- @SuppressWarnings("unused") // Used from XML
- public ActivityStreamPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
- super(context, attrs, defStyleAttr, defStyleRes);
- init(context);
- }
-
- @SuppressWarnings("unused") // Used from XML
- public ActivityStreamPreference(Context context, AttributeSet attrs, int defStyleAttr) {
- super(context, attrs, defStyleAttr);
- init(context);
- }
-
- @SuppressWarnings("unused") // Used from XML
- public ActivityStreamPreference(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(context);
- }
-
- @SuppressWarnings("unused") // Used from XML
- public ActivityStreamPreference(Context context) {
- super(context);
- init(context);
- }
-
- private void init(Context context) {
- // The SwitchPreference shouldn't do any persistence itself. We want to avoid that a value
- // is written that is not set by the user but set from an experiment.
- setPersistent(false);
-
- setChecked(ActivityStream.isEnabled(context));
- }
-
- @Override
- public boolean isPersistent() {
- // Just be absolutely sure that no one re-sets this value since calling init().
- return false;
- }
-
- @Override
- protected void onClick() {
- super.onClick();
-
- ActivityStream.setUserEnabled(getContext(), isChecked());
-
- // We require a restart for this change to take effect. This is not nice, but this setting
- // is not something we want to ship outside of Nightly anyways.
- ThreadUtils.postDelayedToUiThread(new Runnable() {
- @Override
- public void run() {
- final Intent restartIntent = new Intent(Intent.ACTION_MAIN);
- restartIntent.setClassName(getContext().getApplicationContext(),
- AppConstants.MOZ_ANDROID_BROWSER_INTENT_CLASS);
- GeckoApplication.shutdown(restartIntent);
- }
- }, 1000);
- }
-}
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -158,17 +158,16 @@ public class GeckoPreferences
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_PWA = NON_PREF_PREFIX + "pwa";
- 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";
public static final String PREFS_DIST_HOMEPAGE = NON_PREF_PREFIX + "distribution.homepage";
@@ -672,18 +671,17 @@ public class GeckoPreferences
}
} 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_PWA
- && !AppConstants.MOZ_ANDROID_CUSTOM_TABS
- && !ActivityStream.isUserSwitchable(this)) {
+ && !AppConstants.MOZ_ANDROID_CUSTOM_TABS) {
preferences.removePreference(pref);
i--;
continue;
}
setupPreferences((PreferenceGroup) pref, prefs);
} else {
if (HANDLERS.containsKey(key)) {
PrefHandler handler = HANDLERS.get(key);
@@ -871,21 +869,16 @@ public class GeckoPreferences
} else if (PREFS_CUSTOM_TABS.equals(key) && !AppConstants.MOZ_ANDROID_CUSTOM_TABS) {
preferences.removePreference(pref);
i--;
continue;
} else if (PREFS_PWA.equals(key) && !AppConstants.MOZ_ANDROID_PWA) {
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);
i--;
continue;
}
}
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -293,20 +293,16 @@
<!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">
<!ENTITY pref_pwa "Progressive Web Apps">
<!ENTITY pref_pwa_summary "Allow web apps to be added to home screen">
-<!-- Localization note (pref_activity_stream): Experimental feature, see https://testpilot.firefox.com/experiments/activity-stream -->
-<!ENTITY pref_activity_stream "Activity Stream">
-<!ENTITY pref_activity_stream_summary "A rich visual history feed and a reimagined home page make it easier than ever to find exactly what you\'re looking for in &brandShortName;.">
-
<!ENTITY tracking_protection_prompt_title "Now with Tracking Protection">
<!ENTITY tracking_protection_prompt_text "Actively block tracking elements so you don\'t have to worry.">
<!ENTITY tracking_protection_prompt_tip_text "Visit Privacy settings to learn more">
<!ENTITY tracking_protection_prompt_action_button "Got it!">
<!ENTITY tab_queue_toast_message3 "Tab saved in &brandShortName;">
<!ENTITY tab_queue_toast_action "Open now">
<!ENTITY tab_queue_prompt_title "Opening multiple links?">
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -494,17 +494,16 @@ gbjar = add_java_jar('gecko-browser')
gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
'AboutPages.java',
'AccountsHelper.java',
'ActionBarTextSelection.java',
'ActionModeCompat.java',
'ActionModeCompatView.java',
'ActivityHandlerHelper.java',
'activitystream/ActivityStream.java',
- 'activitystream/ActivityStreamPreference.java',
'activitystream/ActivityStreamTelemetry.java',
'activitystream/homepanel/ActivityStreamHomeFragment.java',
'activitystream/homepanel/ActivityStreamHomeScreen.java',
'activitystream/homepanel/ActivityStreamPanel.java',
'activitystream/homepanel/HighlightsDividerItemDecoration.java',
'activitystream/homepanel/HighlightsLoader.java',
'activitystream/homepanel/menu/ActivityStreamContextMenu.java',
'activitystream/homepanel/menu/BottomSheetContextMenu.java',
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -245,19 +245,16 @@
<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_pwa">&pref_pwa;</string>
<string name="pref_pwa_summary">&pref_pwa_summary;</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>
<string name="pref_char_encoding_on">&pref_char_encoding_on;</string>
<string name="pref_char_encoding_off">&pref_char_encoding_off;</string>
<string name="pref_clear_private_data_now">&pref_clear_private_data2;</string>
<string name="pref_clear_private_data_now_tablet">&pref_clear_private_data_now_tablet;</string>
<string name="pref_clear_on_exit_title">&pref_clear_on_exit_title3;</string>
<string name="pref_clear_on_exit_summary2">&pref_clear_on_exit_summary2;</string>
<string name="pref_clear_on_exit_dialog_title">&pref_clear_on_exit_dialog_title;</string>