Merge "Refactor AudioPlaybackConfiguration to reduce usages of hidden APIs"
am: dcb8aa7cba
Change-Id: I652c9ab83726f41c5e22b485b1dafe90f264c735
This commit is contained in:
@@ -3732,6 +3732,7 @@ package android.media {
|
||||
method public android.media.PlayerProxy getPlayerProxy();
|
||||
method public int getPlayerState();
|
||||
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_PAUSED = 3; // 0x3
|
||||
field public static final int PLAYER_STATE_RELEASED = 0; // 0x0
|
||||
|
||||
@@ -400,6 +400,7 @@ public final class AudioPlaybackConfiguration implements Parcelable {
|
||||
* configurations
|
||||
* @return true if active
|
||||
*/
|
||||
@SystemApi
|
||||
public boolean isActive() {
|
||||
switch (mPlayerState) {
|
||||
case PLAYER_STATE_STARTED:
|
||||
@@ -420,18 +421,7 @@ public final class AudioPlaybackConfiguration implements Parcelable {
|
||||
* @param pw
|
||||
*/
|
||||
public void dump(PrintWriter pw) {
|
||||
pw.println(" " + toLogFriendlyString(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);
|
||||
pw.println(" " + this);
|
||||
}
|
||||
|
||||
public static final @android.annotation.NonNull Parcelable.Creator<AudioPlaybackConfiguration> CREATOR
|
||||
@@ -498,6 +488,15 @@ public final class AudioPlaybackConfiguration implements Parcelable {
|
||||
&& (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
|
||||
static final class IPlayerShell implements IBinder.DeathRecipient {
|
||||
|
||||
@@ -240,8 +240,7 @@ class AudioPlayerStateMonitor {
|
||||
if (!mPrevActiveAudioPlaybackConfigs.containsKey(
|
||||
config.getPlayerInterfaceId())) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Found a new active media playback. "
|
||||
+ AudioPlaybackConfiguration.toLogFriendlyString(config));
|
||||
Log.d(TAG, "Found a new active media playback. " + config);
|
||||
}
|
||||
// New active audio playback.
|
||||
int index = mSortedAudioPlaybackClientUids.indexOf(uid);
|
||||
|
||||
Reference in New Issue
Block a user