Bug 1311245 - part4 : remove redundant state. r=sebastian
authorAlastor Wu <alwu@mozilla.com>
Thu, 27 Oct 2016 10:12:32 +0800
changeset 319678 f06568be151385e5fff32d1211afea54d5eb5566
parent 319677 e86ad7e506451c029bef8363bc60c52a6881d52c
child 319679 65930c6cc816104b51ea7957f4db200242115f94
push id30875
push usercbook@mozilla.com
push dateThu, 27 Oct 2016 14:42:46 +0000
treeherdermozilla-central@23cbe1a93a98 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssebastian
bugs1311245
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1311245 - part4 : remove redundant state. r=sebastian 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";
@@ -179,19 +178,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();
@@ -239,20 +235,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);
                 }
             }