Bug 1311245 - part4 : remove redundant state. draft
authorAlastor Wu <alwu@mozilla.com>
Thu, 27 Oct 2016 10:12:32 +0800
changeset 430054 51969251342b81ada27e816704fbcbbb9efa30b5
parent 430053 0466619fca39b3617105255dd077dd3d78c172a5
child 535110 eb1689029ff60e7c672f1245da140963fddf015a
push id33722
push useralwu@mozilla.com
push dateThu, 27 Oct 2016 02:13:11 +0000
bugs1311245
milestone52.0a1
Bug 1311245 - part4 : remove redundant state. After lots changing in media control's code, we don't need 'ACTION_START' anymore. MozReview-Commit-ID: 3KktTrY4HoR
mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java
--- a/mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java
@@ -28,17 +28,16 @@ import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.util.ThreadUtils;
 
 import java.lang.ref.WeakReference;
 
 public class MediaControlService extends Service implements Tabs.OnTabsChangedListener {
     private static final String LOGTAG = "MediaControlService";
 
     public static final String ACTION_INIT           = "action_init";
-    public static final String ACTION_START          = "action_start";
     public static final String ACTION_RESUME         = "action_resume";
     public static final String ACTION_PAUSE          = "action_pause";
     public static final String ACTION_STOP           = "action_stop";
     public static final String ACTION_RESUME_BY_AUDIO_FOCUS = "action_resume_audio_focus";
     public static final String ACTION_PAUSE_BY_AUDIO_FOCUS  = "action_pause_audio_focus";
 
     private static final int MEDIA_CONTROL_ID = 1;
     private static final String MEDIA_CONTROL_PREF = "dom.audiochannel.mediaControl";
@@ -171,19 +170,16 @@ public class MediaControlService extends
 
         Log.d(LOGTAG, "HandleIntent, action = " + intent.getAction() + ", actionState = " + mActionState);
         switch (intent.getAction()) {
             case ACTION_INIT :
                 // This action is used to create a service and do the initialization,
                 // the actual operation would be executed via control interface's
                 // pending intent.
                 break;
-            case ACTION_START :
-                mController.getTransportControls().sendCustomAction(ACTION_START, null);
-                break;
             case ACTION_RESUME :
                 mController.getTransportControls().play();
                 break;
             case ACTION_PAUSE :
                 mController.getTransportControls().pause();
                 break;
             case ACTION_STOP :
                 mController.getTransportControls().stop();
@@ -231,20 +227,17 @@ public class MediaControlService extends
         mSession = new MediaSession(getApplicationContext(),
                                     "fennec media session");
         mController = new MediaController(getApplicationContext(),
                                           mSession.getSessionToken());
 
         mSession.setCallback(new MediaSession.Callback() {
             @Override
             public void onCustomAction(String action, Bundle extras) {
-                if (action.equals(ACTION_START)) {
-                    Log.d(LOGTAG, "Controller, onStart");
-                    notifyControlInterfaceChanged(ACTION_PAUSE);
-                } else if (action.equals(ACTION_PAUSE_BY_AUDIO_FOCUS)) {
+                if (action.equals(ACTION_PAUSE_BY_AUDIO_FOCUS)) {
                     Log.d(LOGTAG, "Controller, pause by audio focus changed");
                     notifyControlInterfaceChanged(ACTION_RESUME);
                 } else if (action.equals(ACTION_RESUME_BY_AUDIO_FOCUS)) {
                     Log.d(LOGTAG, "Controller, resume by audio focus changed");
                     notifyControlInterfaceChanged(ACTION_PAUSE);
                 }
             }