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

Commit 03e1a19e authored by Hyundo Moon's avatar Hyundo Moon
Browse files

Replace hidden AudioManager.FLAG_FROM_KEY usage

This CL copies the hidden AudioManager.FLAG_FROM_KEY usage into
MediaUtils, and replace the usages with it.

Bug: 119790339
Test: mmm . (under frameworks/av/packages/MediaComponents)
Change-Id: I1a5ba5bc06e10fea9bf5fca0f88c8ca4f6ed2a7d
parent 0395ec61
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -7,6 +7,12 @@ import android.view.KeyEvent;
 */
public class MediaUtils {

    /**
     * Adjusting the volume due to a hardware key press.
     * (Copied version of hidden AudioManager.FLAG_FROM_KEY)
     */
    public static final int AUDIO_MANAGER_FLAG_FROM_KEY = 1 << 12;

    // Keep sync with KeyEvent#isMediaKey().
    public static boolean isMediaKey(int keyCode) {
        switch (keyCode) {
+2 −3
Original line number Diff line number Diff line
@@ -197,9 +197,8 @@ public final class MediaController {
            }

            case KeyEvent.ACTION_UP: {
                //TODO(b/119790339): Resolve hidden API usage. AudioManager.FLAG_FROM_KEY
                final int flags = AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_VIBRATE;
                        //| AudioManager.FLAG_FROM_KEY;
                final int flags = AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_VIBRATE
                        | MediaUtils.AUDIO_MANAGER_FLAG_FROM_KEY;
                try {
                    mSessionBinder.adjustVolume("mContext.getOpPackageName()", mCbStub, true, 0,
                            flags);