Loading media/java/android/media/AudioService.java +14 −8 Original line number Original line Diff line number Diff line Loading @@ -5088,19 +5088,24 @@ public class AudioService extends IAudioService.Stub implements OnFinished { // top of the stack for the media button event receivers : simply using the top of the // top of the stack for the media button event receivers : simply using the top of the // stack would make the entry disappear from the RemoteControlDisplay in conditions such as // stack would make the entry disappear from the RemoteControlDisplay in conditions such as // notifications playing during music playback. // notifications playing during music playback. // crawl the AudioFocus stack until an entry is found with the following characteristics: // Crawl the AudioFocus stack from the top until an entry is found with the following // characteristics: // - focus gain on STREAM_MUSIC stream // - focus gain on STREAM_MUSIC stream // - non-transient focus gain on a stream other than music // - non-transient focus gain on a stream other than music FocusStackEntry af = null; FocusStackEntry af = null; Iterator<FocusStackEntry> stackIterator = mFocusStack.iterator(); try { while(stackIterator.hasNext()) { for (int index = mFocusStack.size()-1; index >= 0; index--) { FocusStackEntry fse = (FocusStackEntry)stackIterator.next(); FocusStackEntry fse = mFocusStack.elementAt(index); if ((fse.mStreamType == AudioManager.STREAM_MUSIC) if ((fse.mStreamType == AudioManager.STREAM_MUSIC) || (fse.mFocusChangeType == AudioManager.AUDIOFOCUS_GAIN)) { || (fse.mFocusChangeType == AudioManager.AUDIOFOCUS_GAIN)) { af = fse; af = fse; break; break; } } } } } catch (ArrayIndexOutOfBoundsException e) { Log.e(TAG, "Wrong index accessing audio focus stack when updating RCD: " + e); af = null; } if (af == null) { if (af == null) { clearRemoteControlDisplay_syncAfRcs(); clearRemoteControlDisplay_syncAfRcs(); return; return; Loading @@ -5120,6 +5125,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished { clearRemoteControlDisplay_syncAfRcs(); clearRemoteControlDisplay_syncAfRcs(); return; return; } } // refresh conditions were verified: update the remote controls // refresh conditions were verified: update the remote controls // ok to call: synchronized mAudioFocusLock then on mRCStack, mRCStack is not empty // ok to call: synchronized mAudioFocusLock then on mRCStack, mRCStack is not empty updateRemoteControlDisplay_syncAfRcs(infoChangedFlags); updateRemoteControlDisplay_syncAfRcs(infoChangedFlags); Loading Loading
media/java/android/media/AudioService.java +14 −8 Original line number Original line Diff line number Diff line Loading @@ -5088,19 +5088,24 @@ public class AudioService extends IAudioService.Stub implements OnFinished { // top of the stack for the media button event receivers : simply using the top of the // top of the stack for the media button event receivers : simply using the top of the // stack would make the entry disappear from the RemoteControlDisplay in conditions such as // stack would make the entry disappear from the RemoteControlDisplay in conditions such as // notifications playing during music playback. // notifications playing during music playback. // crawl the AudioFocus stack until an entry is found with the following characteristics: // Crawl the AudioFocus stack from the top until an entry is found with the following // characteristics: // - focus gain on STREAM_MUSIC stream // - focus gain on STREAM_MUSIC stream // - non-transient focus gain on a stream other than music // - non-transient focus gain on a stream other than music FocusStackEntry af = null; FocusStackEntry af = null; Iterator<FocusStackEntry> stackIterator = mFocusStack.iterator(); try { while(stackIterator.hasNext()) { for (int index = mFocusStack.size()-1; index >= 0; index--) { FocusStackEntry fse = (FocusStackEntry)stackIterator.next(); FocusStackEntry fse = mFocusStack.elementAt(index); if ((fse.mStreamType == AudioManager.STREAM_MUSIC) if ((fse.mStreamType == AudioManager.STREAM_MUSIC) || (fse.mFocusChangeType == AudioManager.AUDIOFOCUS_GAIN)) { || (fse.mFocusChangeType == AudioManager.AUDIOFOCUS_GAIN)) { af = fse; af = fse; break; break; } } } } } catch (ArrayIndexOutOfBoundsException e) { Log.e(TAG, "Wrong index accessing audio focus stack when updating RCD: " + e); af = null; } if (af == null) { if (af == null) { clearRemoteControlDisplay_syncAfRcs(); clearRemoteControlDisplay_syncAfRcs(); return; return; Loading @@ -5120,6 +5125,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished { clearRemoteControlDisplay_syncAfRcs(); clearRemoteControlDisplay_syncAfRcs(); return; return; } } // refresh conditions were verified: update the remote controls // refresh conditions were verified: update the remote controls // ok to call: synchronized mAudioFocusLock then on mRCStack, mRCStack is not empty // ok to call: synchronized mAudioFocusLock then on mRCStack, mRCStack is not empty updateRemoteControlDisplay_syncAfRcs(infoChangedFlags); updateRemoteControlDisplay_syncAfRcs(infoChangedFlags); Loading