Loading media/java/android/media/AudioService.java +8 −4 Original line number Diff line number Diff line Loading @@ -4183,10 +4183,11 @@ public class AudioService extends IAudioService.Stub implements OnFinished { private void notifyTopOfAudioFocusStack() { // notify the top of the stack it gained focus if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) { if (canReassignAudioFocus()) { String clientId = mFocusStack.peek().mClientId; if (canReassignAudioFocusTo(clientId)) { try { mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange( AudioManager.AUDIOFOCUS_GAIN, mFocusStack.peek().mClientId); AudioManager.AUDIOFOCUS_GAIN, clientId); } catch (RemoteException e) { Log.e(TAG, "Failure to signal gain of audio control focus due to "+ e); e.printStackTrace(); Loading Loading @@ -4334,9 +4335,12 @@ public class AudioService extends IAudioService.Stub implements OnFinished { * Helper function: * Returns true if the system is in a state where the focus can be reevaluated, false otherwise. */ private boolean canReassignAudioFocus() { private boolean canReassignAudioFocusTo(String clientId) { // focus requests are rejected during a phone call or when the phone is ringing // this is equivalent to IN_VOICE_COMM_FOCUS_ID having the focus if (IN_VOICE_COMM_FOCUS_ID.equals(clientId)) { return true; } if (!mFocusStack.isEmpty() && IN_VOICE_COMM_FOCUS_ID.equals(mFocusStack.peek().mClientId)) { return false; } Loading Loading @@ -4381,7 +4385,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished { } synchronized(mAudioFocusLock) { if (!canReassignAudioFocus()) { if (!canReassignAudioFocusTo(clientId)) { return AudioManager.AUDIOFOCUS_REQUEST_FAILED; } Loading Loading
media/java/android/media/AudioService.java +8 −4 Original line number Diff line number Diff line Loading @@ -4183,10 +4183,11 @@ public class AudioService extends IAudioService.Stub implements OnFinished { private void notifyTopOfAudioFocusStack() { // notify the top of the stack it gained focus if (!mFocusStack.empty() && (mFocusStack.peek().mFocusDispatcher != null)) { if (canReassignAudioFocus()) { String clientId = mFocusStack.peek().mClientId; if (canReassignAudioFocusTo(clientId)) { try { mFocusStack.peek().mFocusDispatcher.dispatchAudioFocusChange( AudioManager.AUDIOFOCUS_GAIN, mFocusStack.peek().mClientId); AudioManager.AUDIOFOCUS_GAIN, clientId); } catch (RemoteException e) { Log.e(TAG, "Failure to signal gain of audio control focus due to "+ e); e.printStackTrace(); Loading Loading @@ -4334,9 +4335,12 @@ public class AudioService extends IAudioService.Stub implements OnFinished { * Helper function: * Returns true if the system is in a state where the focus can be reevaluated, false otherwise. */ private boolean canReassignAudioFocus() { private boolean canReassignAudioFocusTo(String clientId) { // focus requests are rejected during a phone call or when the phone is ringing // this is equivalent to IN_VOICE_COMM_FOCUS_ID having the focus if (IN_VOICE_COMM_FOCUS_ID.equals(clientId)) { return true; } if (!mFocusStack.isEmpty() && IN_VOICE_COMM_FOCUS_ID.equals(mFocusStack.peek().mClientId)) { return false; } Loading Loading @@ -4381,7 +4385,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished { } synchronized(mAudioFocusLock) { if (!canReassignAudioFocus()) { if (!canReassignAudioFocusTo(clientId)) { return AudioManager.AUDIOFOCUS_REQUEST_FAILED; } Loading