packages/apps/Music
Révision | 533fc44c8055b708c71537dbdf04f7588c9492da (tree) |
---|---|
l'heure | 2010-04-07 09:33:32 |
Auteur | Marco Nelissen <marcone@goog...> |
Commiter | Marco Nelissen |
Pause requests that come in while a phone call is in progress should override
the auto resume behavior. This makes it so that music playback will not auto
resume after undocking or unplugging to answer a call (because we get pause
requests for those, because they are routing changes).
Fixes bug 2474691.
Change-Id: I583b614c6c394064bc8b625e673781e33c931fb9
@@ -160,8 +160,8 @@ public class MediaPlaybackService extends Service { | ||
160 | 160 | if (state == TelephonyManager.CALL_STATE_RINGING) { |
161 | 161 | AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); |
162 | 162 | int ringvolume = audioManager.getStreamVolume(AudioManager.STREAM_RING); |
163 | + mResumeAfterCall = (isPlaying() || mResumeAfterCall) && (getAudioId() >= 0); | |
163 | 164 | if (ringvolume > 0) { |
164 | - mResumeAfterCall = (isPlaying() || mResumeAfterCall) && (getAudioId() >= 0); | |
165 | 165 | pause(); |
166 | 166 | } |
167 | 167 | } else if (state == TelephonyManager.CALL_STATE_OFFHOOK) { |
@@ -250,13 +250,16 @@ public class MediaPlaybackService extends Service { | ||
250 | 250 | } else if (CMDTOGGLEPAUSE.equals(cmd) || TOGGLEPAUSE_ACTION.equals(action)) { |
251 | 251 | if (isPlaying()) { |
252 | 252 | pause(); |
253 | + mResumeAfterCall = false; | |
253 | 254 | } else { |
254 | 255 | play(); |
255 | 256 | } |
256 | 257 | } else if (CMDPAUSE.equals(cmd) || PAUSE_ACTION.equals(action)) { |
257 | 258 | pause(); |
259 | + mResumeAfterCall = false; | |
258 | 260 | } else if (CMDSTOP.equals(cmd)) { |
259 | 261 | pause(); |
262 | + mResumeAfterCall = false; | |
260 | 263 | seek(0); |
261 | 264 | } else if (MediaAppWidgetProvider.CMDAPPWIDGETUPDATE.equals(cmd)) { |
262 | 265 | // Someone asked us to refresh a set of specific widgets, probably |
@@ -631,13 +634,16 @@ public class MediaPlaybackService extends Service { | ||
631 | 634 | } else if (CMDTOGGLEPAUSE.equals(cmd) || TOGGLEPAUSE_ACTION.equals(action)) { |
632 | 635 | if (isPlaying()) { |
633 | 636 | pause(); |
637 | + mResumeAfterCall = false; | |
634 | 638 | } else { |
635 | 639 | play(); |
636 | 640 | } |
637 | 641 | } else if (CMDPAUSE.equals(cmd) || PAUSE_ACTION.equals(action)) { |
638 | 642 | pause(); |
643 | + mResumeAfterCall = false; | |
639 | 644 | } else if (CMDSTOP.equals(cmd)) { |
640 | 645 | pause(); |
646 | + mResumeAfterCall = false; | |
641 | 647 | seek(0); |
642 | 648 | } |
643 | 649 | } |