Bug 1311245 - part3 : mActionState should only store resume/pause/stop. r=sebastian
authorAlastor Wu <alwu@mozilla.com>
Thu, 27 Oct 2016 10:12:30 +0800
changeset 319674 e86ad7e506451c029bef8363bc60c52a6881d52c
parent 319673 b2066343565f4442de99a02e5950ba338a47835e
child 319675 f06568be151385e5fff32d1211afea54d5eb5566
push id33581
push useralwu@mozilla.com
push dateThu, 27 Oct 2016 08:45:55 +0000
treeherderautoland@f06568be1513 [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 - part3 : mActionState should only store resume/pause/stop. r=sebastian There is no big difference between 'ACTION_RESUME' and 'ACTION_RESUME_BY_AUDIO_FOCUS', we can simplify it. MozReview-Commit-ID: 4nqfgoopuJ6
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
@@ -129,18 +129,17 @@ public class MediaControlService extends
                         ACTION_PAUSE : ACTION_RESUME;
                     notifyControlInterfaceChanged(actionForPendingIntent);
                 }
                 break;
         }
     }
 
     private boolean isMediaPlaying() {
-        return mActionState.equals(ACTION_RESUME) ||
-               mActionState.equals(ACTION_RESUME_BY_AUDIO_FOCUS);
+        return mActionState.equals(ACTION_RESUME);
     }
 
     private void initialize() {
         if (mInitialize ||
             !isAndroidVersionLollopopOrHigher()) {
             return;
         }
 
@@ -246,21 +245,19 @@ public class MediaControlService extends
             @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)) {
                     Log.d(LOGTAG, "Controller, pause by audio focus changed");
                     notifyControlInterfaceChanged(ACTION_RESUME);
-                    mActionState = ACTION_PAUSE_BY_AUDIO_FOCUS;
                 } else if (action.equals(ACTION_RESUME_BY_AUDIO_FOCUS)) {
                     Log.d(LOGTAG, "Controller, resume by audio focus changed");
                     notifyControlInterfaceChanged(ACTION_PAUSE);
-                    mActionState = ACTION_RESUME_BY_AUDIO_FOCUS;
                 }
             }
 
             @Override
             public void onPlay() {
                 Log.d(LOGTAG, "Controller, onPlay");
                 super.onPlay();
                 notifyControlInterfaceChanged(ACTION_PAUSE);