Bug 1241810 - Review follow-up: Rename actions to be more descriptive. r=me
authorSebastian Kaspari <s.kaspari@gmail.com>
Wed, 23 Mar 2016 16:07:52 +0100
changeset 290392 f409361bb6d5184d246f059f2e2ac71ec493e1b5
parent 290391 ef6b86cd60a4aa3535469da584e2a3b6807a2cb2
child 290393 27e3abf6da862ba8f0e0b61e4fc5cf539ee52b66
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1241810
milestone48.0a1
Bug 1241810 - Review follow-up: Rename actions to be more descriptive. r=me MozReview-Commit-ID: 5VbOQv4W7CZ
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/feeds/FeedService.java
mobile/android/base/java/org/mozilla/gecko/feeds/action/BaseAction.java
mobile/android/base/java/org/mozilla/gecko/feeds/action/CheckAction.java
mobile/android/base/java/org/mozilla/gecko/feeds/action/CheckForUpdatesAction.java
mobile/android/base/java/org/mozilla/gecko/feeds/action/EnrollAction.java
mobile/android/base/java/org/mozilla/gecko/feeds/action/EnrollSubscriptionsAction.java
mobile/android/base/java/org/mozilla/gecko/feeds/action/FeedAction.java
mobile/android/base/java/org/mozilla/gecko/feeds/action/SetupAction.java
mobile/android/base/java/org/mozilla/gecko/feeds/action/SetupAlarmsAction.java
mobile/android/base/java/org/mozilla/gecko/feeds/action/SubscribeAction.java
mobile/android/base/java/org/mozilla/gecko/feeds/action/SubscribeToFeedAction.java
mobile/android/base/java/org/mozilla/gecko/feeds/action/WithdrawAction.java
mobile/android/base/java/org/mozilla/gecko/feeds/action/WithdrawSubscriptionsAction.java
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
mobile/android/base/moz.build
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -22,17 +22,17 @@ import org.mozilla.gecko.db.BrowserContr
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.SuggestedSites;
 import org.mozilla.gecko.distribution.Distribution;
 import org.mozilla.gecko.dlc.DownloadContentService;
 import org.mozilla.gecko.favicons.Favicons;
 import org.mozilla.gecko.favicons.OnFaviconLoadedListener;
 import org.mozilla.gecko.favicons.decoders.IconDirectoryEntry;
 import org.mozilla.gecko.feeds.FeedService;
-import org.mozilla.gecko.feeds.action.CheckAction;
+import org.mozilla.gecko.feeds.action.CheckForUpdatesAction;
 import org.mozilla.gecko.firstrun.FirstrunAnimationContainer;
 import org.mozilla.gecko.gfx.DynamicToolbarAnimator;
 import org.mozilla.gecko.gfx.DynamicToolbarAnimator.PinReason;
 import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
 import org.mozilla.gecko.gfx.LayerView;
 import org.mozilla.gecko.home.BrowserSearch;
 import org.mozilla.gecko.home.HomeBanner;
 import org.mozilla.gecko.home.HomeConfig;
@@ -3768,17 +3768,17 @@ public class BrowserApp extends GeckoApp
         // Custom intent action for opening multiple URLs at once
         if (isViewMultipleAction) {
             List<String> urls = intent.getStringArrayListExtra("urls");
             if (urls != null) {
                 openUrls(urls);
             }
 
             // Launched from a "content notification"
-            if (intent.hasExtra(CheckAction.EXTRA_CONTENT_NOTIFICATION)) {
+            if (intent.hasExtra(CheckForUpdatesAction.EXTRA_CONTENT_NOTIFICATION)) {
                 Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.NOTIFICATION, "content_update");
             }
         }
 
         if (!mInitialized || !Intent.ACTION_MAIN.equals(action)) {
             return;
         }
 
--- a/mobile/android/base/java/org/mozilla/gecko/feeds/FeedService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/feeds/FeedService.java
@@ -15,22 +15,22 @@ import android.support.v4.net.Connectivi
 import android.util.Log;
 
 import com.keepsafe.switchboard.SwitchBoard;
 
 import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.GeckoProfile;
 import org.mozilla.gecko.GeckoSharedPrefs;
 import org.mozilla.gecko.db.BrowserDB;
-import org.mozilla.gecko.feeds.action.BaseAction;
-import org.mozilla.gecko.feeds.action.CheckAction;
-import org.mozilla.gecko.feeds.action.EnrollAction;
-import org.mozilla.gecko.feeds.action.SetupAction;
-import org.mozilla.gecko.feeds.action.SubscribeAction;
-import org.mozilla.gecko.feeds.action.WithdrawAction;
+import org.mozilla.gecko.feeds.action.FeedAction;
+import org.mozilla.gecko.feeds.action.CheckForUpdatesAction;
+import org.mozilla.gecko.feeds.action.EnrollSubscriptionsAction;
+import org.mozilla.gecko.feeds.action.SetupAlarmsAction;
+import org.mozilla.gecko.feeds.action.SubscribeToFeedAction;
+import org.mozilla.gecko.feeds.action.WithdrawSubscriptionsAction;
 import org.mozilla.gecko.preferences.GeckoPreferences;
 import org.mozilla.gecko.util.Experiments;
 
 /**
  * Background service for subscribing to and checking website feeds to notify the user about updates.
  */
 public class FeedService extends IntentService {
     private static final String LOGTAG = "GeckoFeedService";
@@ -45,17 +45,17 @@ public class FeedService extends IntentS
         Intent intent = new Intent(context, FeedService.class);
         intent.setAction(ACTION_SETUP);
         context.startService(intent);
     }
 
     public static void subscribe(Context context, String feedUrl) {
         Intent intent = new Intent(context, FeedService.class);
         intent.setAction(ACTION_SUBSCRIBE);
-        intent.putExtra(SubscribeAction.EXTRA_FEED_URL, feedUrl);
+        intent.putExtra(SubscribeToFeedAction.EXTRA_FEED_URL, feedUrl);
         context.startService(intent);
     }
 
     public FeedService() {
         super(LOGTAG);
     }
 
     private BrowserDB browserDB;
@@ -76,17 +76,17 @@ public class FeedService extends IntentS
         Log.d(LOGTAG, "Service started with action: " + intent.getAction());
 
         try {
             if (!SwitchBoard.isInExperiment(this, Experiments.CONTENT_NOTIFICATIONS)) {
                 Log.d(LOGTAG, "Not in content notifications experiment. Skipping.");
                 return;
             }
 
-            BaseAction action = createActionForIntent(intent);
+            FeedAction action = createActionForIntent(intent);
             if (action == null) {
                 Log.d(LOGTAG, "No action to process");
                 return;
             }
 
             if (action.requiresPreferenceEnabled() && !isPreferenceEnabled()) {
                 Log.d(LOGTAG, "Preference is disabled. Skipping.");
                 return;
@@ -103,34 +103,34 @@ public class FeedService extends IntentS
         } finally {
             FeedAlarmReceiver.completeWakefulIntent(intent);
         }
 
         Log.d(LOGTAG, "Done.");
     }
 
     @Nullable
-    private BaseAction createActionForIntent(Intent intent) {
+    private FeedAction createActionForIntent(Intent intent) {
         final Context context = getApplicationContext();
 
         switch (intent.getAction()) {
             case ACTION_SETUP:
-                return new SetupAction(context);
+                return new SetupAlarmsAction(context);
 
             case ACTION_SUBSCRIBE:
-                return new SubscribeAction(context);
+                return new SubscribeToFeedAction(context);
 
             case ACTION_CHECK:
-                return new CheckAction(context);
+                return new CheckForUpdatesAction(context);
 
             case ACTION_ENROLL:
-                return new EnrollAction(context);
+                return new EnrollSubscriptionsAction(context);
 
             case ACTION_WITHDRAW:
-                return new WithdrawAction(context);
+                return new WithdrawSubscriptionsAction(context);
 
             default:
                 throw new AssertionError("Unknown action: " + intent.getAction());
         }
     }
 
     private boolean isConnectedToUnmeteredNetwork() {
         ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
rename from mobile/android/base/java/org/mozilla/gecko/feeds/action/CheckAction.java
rename to mobile/android/base/java/org/mozilla/gecko/feeds/action/CheckForUpdatesAction.java
--- a/mobile/android/base/java/org/mozilla/gecko/feeds/action/CheckAction.java
+++ b/mobile/android/base/java/org/mozilla/gecko/feeds/action/CheckForUpdatesAction.java
@@ -33,29 +33,29 @@ import org.mozilla.gecko.feeds.subscript
 import org.mozilla.gecko.preferences.GeckoPreferences;
 import org.mozilla.gecko.util.StringUtils;
 
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
 /**
- * CheckAction: Check if feeds we subscribed to have new content available.
+ * CheckForUpdatesAction: Check if feeds we subscribed to have new content available.
  */
-public class CheckAction extends BaseAction {
+public class CheckForUpdatesAction extends FeedAction {
     /**
      * This extra will be added to Intents fired by the notification.
      */
     public static final String EXTRA_CONTENT_NOTIFICATION = "content-notification";
 
     private static final String LOGTAG = "FeedCheckAction";
 
     private Context context;
 
-    public CheckAction(Context context) {
+    public CheckForUpdatesAction(Context context) {
         this.context = context;
     }
 
     @Override
     public void perform(BrowserDB browserDB, Intent intent) {
         final UrlAnnotations urlAnnotations = browserDB.getUrlAnnotations();
         final ContentResolver resolver = context.getContentResolver();
         final List<Feed> updatedFeeds = new ArrayList<>();
rename from mobile/android/base/java/org/mozilla/gecko/feeds/action/EnrollAction.java
rename to mobile/android/base/java/org/mozilla/gecko/feeds/action/EnrollSubscriptionsAction.java
--- a/mobile/android/base/java/org/mozilla/gecko/feeds/action/EnrollAction.java
+++ b/mobile/android/base/java/org/mozilla/gecko/feeds/action/EnrollSubscriptionsAction.java
@@ -16,30 +16,30 @@ import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.UrlAnnotations;
 import org.mozilla.gecko.feeds.FeedService;
 import org.mozilla.gecko.feeds.knownsites.KnownSiteBlogger;
 import org.mozilla.gecko.feeds.knownsites.KnownSite;
 import org.mozilla.gecko.feeds.knownsites.KnownSiteMedium;
 import org.mozilla.gecko.feeds.knownsites.KnownSiteWordpress;
 
 /**
- * EnrollAction: Search for bookmarks of known sites we can subscribe to.
+ * EnrollSubscriptionsAction: Search for bookmarks of known sites we can subscribe to.
  */
-public class EnrollAction extends BaseAction {
+public class EnrollSubscriptionsAction extends FeedAction {
     private static final String LOGTAG = "FeedEnrollAction";
 
     private static final KnownSite[] knownSites = {
         new KnownSiteMedium(),
         new KnownSiteBlogger(),
         new KnownSiteWordpress(),
     };
 
     private Context context;
 
-    public EnrollAction(Context context) {
+    public EnrollSubscriptionsAction(Context context) {
         this.context = context;
     }
 
     @Override
     public void perform(BrowserDB db, Intent intent) {
         log("Searching for bookmarks to enroll in updates");
 
         final ContentResolver contentResolver = context.getContentResolver();
rename from mobile/android/base/java/org/mozilla/gecko/feeds/action/BaseAction.java
rename to mobile/android/base/java/org/mozilla/gecko/feeds/action/FeedAction.java
--- a/mobile/android/base/java/org/mozilla/gecko/feeds/action/BaseAction.java
+++ b/mobile/android/base/java/org/mozilla/gecko/feeds/action/FeedAction.java
@@ -8,17 +8,17 @@ package org.mozilla.gecko.feeds.action;
 import android.content.Intent;
 import android.util.Log;
 
 import org.mozilla.gecko.db.BrowserDB;
 
 /**
  * Interface for actions run by FeedService.
  */
-public abstract class BaseAction {
+public abstract class FeedAction {
     public static final boolean DEBUG_LOG = false;
 
     /**
      * Perform this action.
      *
      * @param browserDB database instance to perform the action.
      * @param intent used to start the service.
      */
rename from mobile/android/base/java/org/mozilla/gecko/feeds/action/SetupAction.java
rename to mobile/android/base/java/org/mozilla/gecko/feeds/action/SetupAlarmsAction.java
--- a/mobile/android/base/java/org/mozilla/gecko/feeds/action/SetupAction.java
+++ b/mobile/android/base/java/org/mozilla/gecko/feeds/action/SetupAlarmsAction.java
@@ -11,24 +11,24 @@ import android.content.Context;
 import android.content.Intent;
 import android.os.SystemClock;
 
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.feeds.FeedAlarmReceiver;
 import org.mozilla.gecko.feeds.FeedService;
 
 /**
- * SetupAction: Set up alarms to run various actions every now and then.
+ * SetupAlarmsAction: Set up alarms to run various actions every now and then.
  */
-public class SetupAction extends BaseAction {
+public class SetupAlarmsAction extends FeedAction {
     private static final String LOGTAG = "FeedSetupAction";
 
     private Context context;
 
-    public SetupAction(Context context) {
+    public SetupAlarmsAction(Context context) {
         this.context = context;
     }
 
     @Override
     public void perform(BrowserDB browserDB, Intent intent) {
         final AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
 
         cancelPreviousAlarms(alarmManager);
rename from mobile/android/base/java/org/mozilla/gecko/feeds/action/SubscribeAction.java
rename to mobile/android/base/java/org/mozilla/gecko/feeds/action/SubscribeToFeedAction.java
--- a/mobile/android/base/java/org/mozilla/gecko/feeds/action/SubscribeAction.java
+++ b/mobile/android/base/java/org/mozilla/gecko/feeds/action/SubscribeToFeedAction.java
@@ -12,26 +12,26 @@ import android.os.Bundle;
 import org.mozilla.gecko.Telemetry;
 import org.mozilla.gecko.TelemetryContract;
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.UrlAnnotations;
 import org.mozilla.gecko.feeds.FeedFetcher;
 import org.mozilla.gecko.feeds.subscriptions.FeedSubscription;
 
 /**
- * SubscribeAction: Try to fetch a feed and create a subscription if successful.
+ * SubscribeToFeedAction: Try to fetch a feed and create a subscription if successful.
  */
-public class SubscribeAction extends BaseAction {
+public class SubscribeToFeedAction extends FeedAction {
     private static final String LOGTAG = "FeedSubscribeAction";
 
     public static final String EXTRA_FEED_URL = "feed_url";
 
     private Context context;
 
-    public SubscribeAction(Context context) {
+    public SubscribeToFeedAction(Context context) {
         this.context = context;
     }
 
     @Override
     public void perform(BrowserDB browserDB, Intent intent) {
         final UrlAnnotations urlAnnotations = browserDB.getUrlAnnotations();
 
         final Bundle extras = intent.getExtras();
rename from mobile/android/base/java/org/mozilla/gecko/feeds/action/WithdrawAction.java
rename to mobile/android/base/java/org/mozilla/gecko/feeds/action/WithdrawSubscriptionsAction.java
--- a/mobile/android/base/java/org/mozilla/gecko/feeds/action/WithdrawAction.java
+++ b/mobile/android/base/java/org/mozilla/gecko/feeds/action/WithdrawSubscriptionsAction.java
@@ -12,24 +12,24 @@ import android.database.Cursor;
 
 import org.json.JSONException;
 import org.mozilla.gecko.db.BrowserContract;
 import org.mozilla.gecko.db.BrowserDB;
 import org.mozilla.gecko.db.UrlAnnotations;
 import org.mozilla.gecko.feeds.subscriptions.FeedSubscription;
 
 /**
- * WithdrawAction: Look for feeds to unsubscribe from.
+ * WithdrawSubscriptionsAction: Look for feeds to unsubscribe from.
  */
-public class WithdrawAction extends BaseAction {
+public class WithdrawSubscriptionsAction extends FeedAction {
     private static final String LOGTAG = "FeedWithdrawAction";
 
     private Context context;
 
-    public WithdrawAction(Context context) {
+    public WithdrawSubscriptionsAction(Context context) {
         this.context = context;
     }
 
     @Override
     public void perform(BrowserDB browserDB, Intent intent) {
         log("Searching for subscriptions to remove..");
 
         final UrlAnnotations urlAnnotations = browserDB.getUrlAnnotations();
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -27,17 +27,17 @@ import org.mozilla.gecko.R;
 import org.mozilla.gecko.Restrictions;
 import org.mozilla.gecko.SnackbarHelper;
 import org.mozilla.gecko.Telemetry;
 import org.mozilla.gecko.TelemetryContract;
 import org.mozilla.gecko.TelemetryContract.Method;
 import org.mozilla.gecko.background.common.GlobalConstants;
 import org.mozilla.gecko.db.BrowserContract.SuggestedSites;
 import org.mozilla.gecko.feeds.FeedService;
-import org.mozilla.gecko.feeds.action.CheckAction;
+import org.mozilla.gecko.feeds.action.CheckForUpdatesAction;
 import org.mozilla.gecko.permissions.Permissions;
 import org.mozilla.gecko.restrictions.Restrictable;
 import org.mozilla.gecko.tabqueue.TabQueueHelper;
 import org.mozilla.gecko.tabqueue.TabQueuePrompt;
 import org.mozilla.gecko.updater.UpdateService;
 import org.mozilla.gecko.updater.UpdateServiceHelper;
 import org.mozilla.gecko.util.EventCallback;
 import org.mozilla.gecko.util.Experiments;
@@ -68,17 +68,16 @@ import android.os.Bundle;
 import android.preference.CheckBoxPreference;
 import android.preference.EditTextPreference;
 import android.preference.ListPreference;
 import android.preference.Preference;
 import android.preference.Preference.OnPreferenceChangeListener;
 import android.preference.Preference.OnPreferenceClickListener;
 import android.preference.PreferenceActivity;
 import android.preference.PreferenceGroup;
-import android.preference.PreferenceScreen;
 import android.preference.TwoStatePreference;
 import android.support.design.widget.Snackbar;
 import android.support.design.widget.TextInputLayout;
 import android.text.Editable;
 import android.text.InputType;
 import android.text.TextUtils;
 import android.text.TextWatcher;
 import android.util.Log;
@@ -383,17 +382,17 @@ OnSharedPreferenceChangeListener
         // If launched from notification, explicitly cancel the notification.
         if (intentExtras != null && intentExtras.containsKey(DataReportingNotification.ALERT_NAME_DATAREPORTING_NOTIFICATION)) {
             Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH, Method.NOTIFICATION, "settings-data-choices");
             NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
             notificationManager.cancel(DataReportingNotification.ALERT_NAME_DATAREPORTING_NOTIFICATION.hashCode());
         }
 
         // Launched from "Notifications settings" action button in a notification.
-        if (intentExtras != null && intentExtras.containsKey(CheckAction.EXTRA_CONTENT_NOTIFICATION)) {
+        if (intentExtras != null && intentExtras.containsKey(CheckForUpdatesAction.EXTRA_CONTENT_NOTIFICATION)) {
             Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, Method.BUTTON, "notification-settings");
         }
     }
 
     /**
      * Initializes the action bar configuration in code.
      *
      * Declaring these attributes in XML does not work on some devices for an unknown reason
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -268,22 +268,22 @@ gbjar.sources += ['java/org/mozilla/geck
     'favicons/decoders/FaviconDecoder.java',
     'favicons/decoders/ICODecoder.java',
     'favicons/decoders/IconDirectoryEntry.java',
     'favicons/decoders/LoadFaviconResult.java',
     'favicons/Favicons.java',
     'favicons/LoadFaviconTask.java',
     'favicons/OnFaviconLoadedListener.java',
     'favicons/RemoteFavicon.java',
-    'feeds/action/BaseAction.java',
-    'feeds/action/CheckAction.java',
-    'feeds/action/EnrollAction.java',
-    'feeds/action/SetupAction.java',
-    'feeds/action/SubscribeAction.java',
-    'feeds/action/WithdrawAction.java',
+    'feeds/action/CheckForUpdatesAction.java',
+    'feeds/action/EnrollSubscriptionsAction.java',
+    'feeds/action/FeedAction.java',
+    'feeds/action/SetupAlarmsAction.java',
+    'feeds/action/SubscribeToFeedAction.java',
+    'feeds/action/WithdrawSubscriptionsAction.java',
     'feeds/FeedAlarmReceiver.java',
     'feeds/FeedFetcher.java',
     'feeds/FeedService.java',
     'feeds/knownsites/KnownSite.java',
     'feeds/knownsites/KnownSiteBlogger.java',
     'feeds/knownsites/KnownSiteMedium.java',
     'feeds/knownsites/KnownSiteWordpress.java',
     'feeds/parser/Feed.java',