Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e3a8a70 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Audio service: always unduck focus requester when granted" into oc-dev

parents 71c999fe 270f1c9d
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -322,14 +322,23 @@ public class FocusRequester {
                if (mFocusLossWasNotified) {
                    fd.dispatchAudioFocusChange(focusGain, mClientId);
                }
                mFocusController.unduckPlayers(this);
            }
            mFocusController.unduckPlayers(this);
            mFocusLossWasNotified = false;
        } catch (android.os.RemoteException e) {
            Log.e(TAG, "Failure to signal gain of audio focus due to: ", e);
        }
    }

    /**
     * Called synchronized on MediaFocusControl.mAudioFocusLock
     */
    void handleFocusGainFromRequest(int focusRequestResult) {
        if (focusRequestResult == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
            mFocusController.unduckPlayers(this);
        }
    }

    /**
     * Called synchronized on MediaFocusControl.mAudioFocusLock
     */
+1 −0
Original line number Diff line number Diff line
@@ -752,6 +752,7 @@ public class MediaFocusControl implements PlayerFocusEnforcer {

                // push focus requester at the top of the audio focus stack
                mFocusStack.push(nfr);
                nfr.handleFocusGainFromRequest(AudioManager.AUDIOFOCUS_REQUEST_GRANTED);
            }
            notifyExtPolicyFocusGrant_syncAf(nfr.toAudioFocusInfo(),
                    AudioManager.AUDIOFOCUS_REQUEST_GRANTED);