Fields Summary |
---|
private static final String | TAG |
private static final boolean | DEBUG |
private static int | sLastRccIdA global counter for RemoteControlClient identifiers |
public static MediaFocusControl | sController |
private final android.app.PendingIntent | mMediaIntentThe target for the ACTION_MEDIA_BUTTON events.
Always non null. //FIXME verify |
private final android.content.ComponentName | mReceiverComponentThe registered media button event receiver. |
private int | mRccId |
private android.os.IBinder | mTokenA non-null token implies this record tracks a "live" player whose death is being monitored. |
private String | mCallingPackageName |
private int | mCallingUid |
private IRemoteControlClient | mRcClientProvides access to the information to display on the remote control.
May be null (when a media button event receiver is registered,
but no remote control client has been registered) |
private RcClientDeathHandler | mRcClientDeathHandler |
public int | mPlaybackTypeInformation only used for non-local playback |
public int | mPlaybackVolume |
public int | mPlaybackVolumeMax |
public int | mPlaybackVolumeHandling |
public int | mPlaybackStream |
public RccPlaybackState | mPlaybackState |
public IRemoteVolumeObserver | mRemoteVolumeObs |
Methods Summary |
---|
public void | binderDied()
sController.unregisterMediaButtonIntentAsync(mMediaIntent);
|
public void | destroy()
unlinkToRcClientDeath();
if (mToken != null) {
mToken.unlinkToDeath(this, 0);
mToken = null;
}
|
void | dump(java.io.PrintWriter pw, boolean registrationInfo)
if (registrationInfo) {
pw.println(" pi: " + mMediaIntent +
" -- pack: " + mCallingPackageName +
" -- ercvr: " + mReceiverComponent +
" -- client: " + mRcClient +
" -- uid: " + mCallingUid +
" -- type: " + mPlaybackType +
" state: " + mPlaybackState);
} else {
// emphasis on state
pw.println(" uid: " + mCallingUid +
" -- id: " + mRccId +
" -- type: " + mPlaybackType +
" -- state: " + mPlaybackState +
" -- vol handling: " + mPlaybackVolumeHandling +
" -- vol: " + mPlaybackVolume +
" -- volMax: " + mPlaybackVolumeMax +
" -- volObs: " + mRemoteVolumeObs);
}
|
protected void | finalize()
destroy(); // unlink exception handled inside method
super.finalize();
|
protected android.app.PendingIntent | getMediaButtonIntent()
return mMediaIntent;
|
protected android.content.ComponentName | getMediaButtonReceiver()
return mReceiverComponent;
|
protected IRemoteControlClient | getRcc()
return mRcClient;
|
protected int | getRccId()
return mRccId;
|
protected boolean | hasMatchingMediaButtonIntent(android.app.PendingIntent pi)
if (mToken != null) {
return mMediaIntent.equals(pi);
} else {
if (mReceiverComponent != null) {
return mReceiverComponent.equals(pi.getIntent().getComponent());
} else {
return false;
}
}
|
protected boolean | isPlaybackActive()
return MediaFocusControl.isPlaystateActive(mPlaybackState.mState);
|
protected void | resetControllerInfoForNoRcc()
// stop monitoring the RCC death
unlinkToRcClientDeath();
// reset the RCC-related fields
mRcClient = null;
mCallingPackageName = null;
|
protected void | resetControllerInfoForRcc(IRemoteControlClient rcClient, java.lang.String callingPackageName, int uid)
// already had a remote control client?
if (mRcClientDeathHandler != null) {
// stop monitoring the old client's death
unlinkToRcClientDeath();
}
// save the new remote control client
mRcClient = rcClient;
mCallingPackageName = callingPackageName;
mCallingUid = uid;
if (rcClient == null) {
// here mcse.mRcClientDeathHandler is null;
resetPlaybackInfo();
} else {
IBinder b = mRcClient.asBinder();
RcClientDeathHandler rcdh =
new RcClientDeathHandler(b, mMediaIntent);
try {
b.linkToDeath(rcdh, 0);
} catch (RemoteException e) {
// remote control client is DOA, disqualify it
Log.w(TAG, "registerRemoteControlClient() has a dead client " + b);
mRcClient = null;
}
mRcClientDeathHandler = rcdh;
}
|
public void | resetPlaybackInfo()
mPlaybackType = RemoteControlClient.PLAYBACK_TYPE_LOCAL;
mPlaybackVolume = RemoteControlClient.DEFAULT_PLAYBACK_VOLUME;
mPlaybackVolumeMax = RemoteControlClient.DEFAULT_PLAYBACK_VOLUME;
mPlaybackVolumeHandling = RemoteControlClient.DEFAULT_PLAYBACK_VOLUME_HANDLING;
mPlaybackStream = AudioManager.STREAM_MUSIC;
mPlaybackState.reset();
mRemoteVolumeObs = null;
|
protected static void | setMediaFocusControl(MediaFocusControl mfc)
sController = mfc;
|
public void | unlinkToRcClientDeath()
if ((mRcClientDeathHandler != null) && (mRcClientDeathHandler.mCb != null)) {
try {
mRcClientDeathHandler.mCb.unlinkToDeath(mRcClientDeathHandler, 0);
mRcClientDeathHandler = null;
} catch (java.util.NoSuchElementException e) {
// not much we can do here
Log.e(TAG, "Error in unlinkToRcClientDeath()", e);
}
}
|