public class MediaSessionRecord extends Object implements IBinder.DeathRecipient
Constructor and Description |
---|
MediaSessionRecord(int ownerPid,
int ownerUid,
int userId,
String ownerPackageName,
ISessionCallback cb,
String tag,
MediaSessionService service,
Handler handler) |
Modifier and Type | Method and Description |
---|---|
void |
adjustVolume(int direction,
int flags,
String packageName,
int uid,
boolean useSuggested)
Send a volume adjustment to the session owner.
|
void |
binderDied() |
void |
dump(PrintWriter pw,
String prefix) |
AudioAttributes |
getAudioAttributes()
Get the local audio stream being used.
|
ISessionCallback |
getCallback() |
ISessionController |
getControllerBinder()
Get the binder for the
MediaController . |
int |
getCurrentVolume()
Get the current volume for this session.
|
long |
getFlags()
Get this session's flags.
|
int |
getMaxVolume()
Get the max volume that can be set.
|
PendingIntent |
getMediaButtonReceiver()
Get the intent the app set for their media button receiver.
|
int |
getOptimisticVolume()
Get the volume we'd like it to be set to.
|
String |
getPackageName()
Get the info for this session.
|
int |
getPlaybackType()
Get the type of playback, either local or remote.
|
ISession |
getSessionBinder()
Get the binder for the
MediaSession . |
String |
getTag()
Get the tag for the session.
|
int |
getUserId()
Get the user id this session was created for.
|
int |
getVolumeControl()
Get the type of volume control.
|
boolean |
hasFlag(int flag)
Check if this session has the specified flag.
|
boolean |
isActive()
Check if this session has been set to active by the app.
|
boolean |
isPlaybackActive(boolean includeRecentlyActive)
Check if the session is currently performing playback.
|
boolean |
isSystemPriority()
Check if this session has system priorty and should receive media buttons
before any other sessions.
|
boolean |
isTransportControlEnabled() |
void |
onDestroy()
Finish cleaning up this session, including disconnecting if connected and
removing the death observer from the callback binder.
|
void |
sendMediaButton(KeyEvent ke,
int sequenceId,
ResultReceiver cb,
int uid,
String packageName) |
void |
setVolumeTo(int value,
int flags,
String packageName,
int uid) |
String |
toString()
Returns a string representation of the object.
|
public MediaSessionRecord(int ownerPid, int ownerUid, int userId, String ownerPackageName, ISessionCallback cb, String tag, MediaSessionService service, Handler handler)
public ISession getSessionBinder()
MediaSession
.public ISessionController getControllerBinder()
MediaController
.public String getPackageName()
public String getTag()
public PendingIntent getMediaButtonReceiver()
public long getFlags()
public boolean hasFlag(int flag)
flag
- The flag to check.public int getUserId()
public boolean isSystemPriority()
public void adjustVolume(int direction, int flags, String packageName, int uid, boolean useSuggested)
AudioManager.ADJUST_LOWER
, AudioManager.ADJUST_RAISE
,
AudioManager.ADJUST_SAME
.direction
- The direction to adjust volume in.flags
- Any of the flags from AudioManager
.packageName
- The package that made the original volume request.uid
- The uid that made the original volume request.useSuggested
- True to use adjustSuggestedStreamVolume instead of
adjustStreamVolume.public void setVolumeTo(int value, int flags, String packageName, int uid)
public boolean isActive()
public boolean isPlaybackActive(boolean includeRecentlyActive)
includeRecentlyActive
- True if playback that was recently paused
should count, false if it shouldn't.public int getPlaybackType()
public AudioAttributes getAudioAttributes()
public int getVolumeControl()
public int getMaxVolume()
public int getCurrentVolume()
public int getOptimisticVolume()
public boolean isTransportControlEnabled()
public void binderDied()
binderDied
in interface IBinder.DeathRecipient
public void onDestroy()
public ISessionCallback getCallback()
public void sendMediaButton(KeyEvent ke, int sequenceId, ResultReceiver cb, int uid, String packageName)
public void dump(PrintWriter pw, String prefix)
public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())