Bug 1311245 - part3 : mActionState should only store resume/pause/stop.
There is no big difference between 'ACTION_RESUME' and 'ACTION_RESUME_BY_AUDIO_FOCUS', we can simplify it.
MozReview-Commit-ID: 4nqfgoopuJ6
--- a/mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/media/MediaControlService.java
@@ -121,18 +121,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;
}
@@ -238,21 +237,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);