Revert Media 1.0 API changes introduced for making 1.0 updatable

This CL reverts API changes which were introduced by below CLs:
 - "761c475: AML: Make config_mediaMetadataBitmapMaxSize as @SystemApi"
 - "888b791: Make AudioManager.FLAG_FROM_KEY as @SystemApi"
 - "3d1353a: AML: Unhide KeyEvent.isMediaSessionKey()"

Bug: 128245348
Test: atest CtsMediaTestCases:android.media.cts.MediaSessionTest;
      atest CtsMediaTestCases:android.media.cts.MediaControllerTest;
      atest CtsMediaTestCases:android.media.cts.MediaBrowserTest;
Change-Id: I263a958bf340336f699adb28424241fd00e46e28
This commit is contained in:
Hyundo Moon
2019-03-11 20:00:00 +09:00
parent cb0da694b0
commit c3ce09eef7
6 changed files with 26 additions and 30 deletions

View File

@@ -49185,7 +49185,6 @@ package android.view {
method public final boolean isFunctionPressed();
method public static final boolean isGamepadButton(int);
method public final boolean isLongPress();
method public static final boolean isMediaSessionKey(int);
method public final boolean isMetaPressed();
method public static boolean isModifierKey(int);
method public final boolean isNumLockOn();

View File

@@ -231,7 +231,6 @@ package android {
}
public static final class R.dimen {
field public static final int config_mediaMetadataBitmapMaxSize = 17104904; // 0x1050008
field public static final int config_restrictedIconSize = 17104903; // 0x1050007
}
@@ -3483,7 +3482,6 @@ package android.media {
field public static final int AUDIOFOCUS_FLAG_DELAY_OK = 1; // 0x1
field public static final int AUDIOFOCUS_FLAG_LOCK = 4; // 0x4
field public static final int AUDIOFOCUS_FLAG_PAUSES_ON_DUCKABLE_LOSS = 2; // 0x2
field public static final int FLAG_FROM_KEY = 65536; // 0x10000
field public static final int SUCCESS = 0; // 0x0
}

View File

@@ -1805,28 +1805,6 @@ public class KeyEvent extends InputEvent implements Parcelable {
return isWakeKey(mKeyCode);
}
/**
* Returns whether this key will be sent to the
* {@link android.media.session.MediaSession.Callback} if not handled.
*/
public static final boolean isMediaSessionKey(int keyCode) {
switch (keyCode) {
case KeyEvent.KEYCODE_MEDIA_PLAY:
case KeyEvent.KEYCODE_MEDIA_PAUSE:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
case KeyEvent.KEYCODE_MUTE:
case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_STOP:
case KeyEvent.KEYCODE_MEDIA_NEXT:
case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
case KeyEvent.KEYCODE_MEDIA_REWIND:
case KeyEvent.KEYCODE_MEDIA_RECORD:
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
return true;
}
return false;
}
/**
* Returns true if the specified keycode is a gamepad button.
* @return True if the keycode is a gamepad button, such as {@link #KEYCODE_BUTTON_A}.
@@ -1886,6 +1864,30 @@ public class KeyEvent extends InputEvent implements Parcelable {
}
}
/**
* Returns whether this key will be sent to the
* {@link android.media.session.MediaSession.Callback} if not handled.
*
* @hide
*/
public static final boolean isMediaSessionKey(int keyCode) {
switch (keyCode) {
case KeyEvent.KEYCODE_MEDIA_PLAY:
case KeyEvent.KEYCODE_MEDIA_PAUSE:
case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
case KeyEvent.KEYCODE_MUTE:
case KeyEvent.KEYCODE_HEADSETHOOK:
case KeyEvent.KEYCODE_MEDIA_STOP:
case KeyEvent.KEYCODE_MEDIA_NEXT:
case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
case KeyEvent.KEYCODE_MEDIA_REWIND:
case KeyEvent.KEYCODE_MEDIA_RECORD:
case KeyEvent.KEYCODE_MEDIA_FAST_FORWARD:
return true;
}
return false;
}
/** Is this a system key? System keys can not be used for menu shortcuts.
* @hide
*/

View File

@@ -3006,8 +3006,6 @@
<public-group type="dimen" first-id="0x01050007">
<!-- @hide @SystemApi -->
<public name="config_restrictedIconSize" />
<!-- @hide @SystemApi -->
<public name="config_mediaMetadataBitmapMaxSize" />
</public-group>
<public-group type="color" first-id="0x0106001c">

View File

@@ -553,8 +553,7 @@ public class AudioManager {
* request is from a hardware key press. (e.g. {@link MediaController}).
* @hide
*/
@SystemApi
public static final int FLAG_FROM_KEY = 1 << 16;
public static final int FLAG_FROM_KEY = 1 << 12;
// The iterator of TreeMap#entrySet() returns the entries in ascending key order.
private static final TreeMap<Integer, String> FLAG_NAMES = new TreeMap<>();

View File

@@ -166,7 +166,7 @@ public final class MediaSession {
SessionLink sessionLink = manager.createSession(cbLink, tag, sessionInfo);
mImpl = new MediaSessionEngine(context, sessionLink, cbLink);
mMaxBitmapSize = context.getResources().getDimensionPixelSize(
android.R.dimen.config_mediaMetadataBitmapMaxSize);
com.android.internal.R.dimen.config_mediaMetadataBitmapMaxSize);
} catch (RuntimeException e) {
throw new RuntimeException("Remote error creating session.", e);
}