Merge "Refactor AudioPlaybackConfiguration to reduce usages of hidden APIs"
This commit is contained in:
@@ -3732,6 +3732,7 @@ package android.media {
|
|||||||
method public android.media.PlayerProxy getPlayerProxy();
|
method public android.media.PlayerProxy getPlayerProxy();
|
||||||
method public int getPlayerState();
|
method public int getPlayerState();
|
||||||
method public int getPlayerType();
|
method public int getPlayerType();
|
||||||
|
method public boolean isActive();
|
||||||
field public static final int PLAYER_STATE_IDLE = 1; // 0x1
|
field public static final int PLAYER_STATE_IDLE = 1; // 0x1
|
||||||
field public static final int PLAYER_STATE_PAUSED = 3; // 0x3
|
field public static final int PLAYER_STATE_PAUSED = 3; // 0x3
|
||||||
field public static final int PLAYER_STATE_RELEASED = 0; // 0x0
|
field public static final int PLAYER_STATE_RELEASED = 0; // 0x0
|
||||||
|
|||||||
@@ -400,6 +400,7 @@ public final class AudioPlaybackConfiguration implements Parcelable {
|
|||||||
* configurations
|
* configurations
|
||||||
* @return true if active
|
* @return true if active
|
||||||
*/
|
*/
|
||||||
|
@SystemApi
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
switch (mPlayerState) {
|
switch (mPlayerState) {
|
||||||
case PLAYER_STATE_STARTED:
|
case PLAYER_STATE_STARTED:
|
||||||
@@ -420,18 +421,7 @@ public final class AudioPlaybackConfiguration implements Parcelable {
|
|||||||
* @param pw
|
* @param pw
|
||||||
*/
|
*/
|
||||||
public void dump(PrintWriter pw) {
|
public void dump(PrintWriter pw) {
|
||||||
pw.println(" " + toLogFriendlyString(this));
|
pw.println(" " + this);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public static String toLogFriendlyString(AudioPlaybackConfiguration apc) {
|
|
||||||
return new String("ID:" + apc.mPlayerIId
|
|
||||||
+ " -- type:" + toLogFriendlyPlayerType(apc.mPlayerType)
|
|
||||||
+ " -- u/pid:" + apc.mClientUid +"/" + apc.mClientPid
|
|
||||||
+ " -- state:" + toLogFriendlyPlayerState(apc.mPlayerState)
|
|
||||||
+ " -- attr:" + apc.mPlayerAttr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final @android.annotation.NonNull Parcelable.Creator<AudioPlaybackConfiguration> CREATOR
|
public static final @android.annotation.NonNull Parcelable.Creator<AudioPlaybackConfiguration> CREATOR
|
||||||
@@ -498,6 +488,15 @@ public final class AudioPlaybackConfiguration implements Parcelable {
|
|||||||
&& (mClientPid == that.mClientPid));
|
&& (mClientPid == that.mClientPid));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "AudioPlaybackConfiguration piid:" + mPlayerIId
|
||||||
|
+ " type:" + toLogFriendlyPlayerType(mPlayerType)
|
||||||
|
+ " u/pid:" + mClientUid + "/" + mClientPid
|
||||||
|
+ " state:" + toLogFriendlyPlayerState(mPlayerState)
|
||||||
|
+ " attr:" + mPlayerAttr;
|
||||||
|
}
|
||||||
|
|
||||||
//=====================================================================
|
//=====================================================================
|
||||||
// Inner class for corresponding IPlayer and its death monitoring
|
// Inner class for corresponding IPlayer and its death monitoring
|
||||||
static final class IPlayerShell implements IBinder.DeathRecipient {
|
static final class IPlayerShell implements IBinder.DeathRecipient {
|
||||||
|
|||||||
@@ -240,8 +240,7 @@ class AudioPlayerStateMonitor {
|
|||||||
if (!mPrevActiveAudioPlaybackConfigs.containsKey(
|
if (!mPrevActiveAudioPlaybackConfigs.containsKey(
|
||||||
config.getPlayerInterfaceId())) {
|
config.getPlayerInterfaceId())) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "Found a new active media playback. "
|
Log.d(TAG, "Found a new active media playback. " + config);
|
||||||
+ AudioPlaybackConfiguration.toLogFriendlyString(config));
|
|
||||||
}
|
}
|
||||||
// New active audio playback.
|
// New active audio playback.
|
||||||
int index = mSortedAudioPlaybackClientUids.indexOf(uid);
|
int index = mSortedAudioPlaybackClientUids.indexOf(uid);
|
||||||
|
|||||||
Reference in New Issue
Block a user