@@ -2958,7 +2958,7 @@ public void binderDied() {
29582958 Log .w (TAG , " RemoteControlClient died" );
29592959 // remote control client died, make sure the displays don't use it anymore
29602960 // by setting its remote control client to null
2961- registerRemoteControlClient (mMediaIntent , null , null /*ignored*/ );
2961+ registerRemoteControlClient (mMediaIntent , null /*rcClient*/ , null /*ignored*/ );
29622962 }
29632963
29642964 public IBinder getBinder () {
@@ -3366,7 +3366,12 @@ public void unregisterMediaButtonIntent(PendingIntent mediaIntent, ComponentName
33663366 }
33673367 }
33683368
3369- /** see AudioManager.registerRemoteControlClient(ComponentName eventReceiver, ...) */
3369+ /**
3370+ * see AudioManager.registerRemoteControlClient(ComponentName eventReceiver, ...)
3371+ * Note: using this method with rcClient == null is a way to "disable" the IRemoteControlClient
3372+ * without modifying the RC stack, but while still causing the display to refresh (will
3373+ * become blank as a result of this)
3374+ */
33703375 public void registerRemoteControlClient (PendingIntent mediaIntent ,
33713376 IRemoteControlClient rcClient , String callingPackageName ) {
33723377 if (DEBUG_RC ) Log .i (TAG , "Register remote control client rcClient=" +rcClient );
@@ -3384,6 +3389,15 @@ public void registerRemoteControlClient(PendingIntent mediaIntent,
33843389 }
33853390 // save the new remote control client
33863391 rcse .mRcClient = rcClient ;
3392+ rcse .mCallingPackageName = callingPackageName ;
3393+ rcse .mCallingUid = Binder .getCallingUid ();
3394+ if (rcClient == null ) {
3395+ rcse .mRcClientDeathHandler = null ;
3396+ break ;
3397+ }
3398+
3399+ // there is a new (non-null) client:
3400+ // 1/ give the new client the current display (if any)
33873401 if (mRcDisplay != null ) {
33883402 try {
33893403 rcse .mRcClient .plugRemoteControlDisplay (mRcDisplay );
@@ -3392,14 +3406,8 @@ public void registerRemoteControlClient(PendingIntent mediaIntent,
33923406 e .printStackTrace ();
33933407 }
33943408 }
3395- rcse .mCallingPackageName = callingPackageName ;
3396- rcse .mCallingUid = Binder .getCallingUid ();
3397- if (rcClient == null ) {
3398- rcse .mRcClientDeathHandler = null ;
3399- break ;
3400- }
3401- // monitor the new client's death
3402- IBinder b = rcClient .asBinder ();
3409+ // 2/ monitor the new client's death
3410+ IBinder b = rcse .mRcClient .asBinder ();
34033411 RcClientDeathHandler rcdh =
34043412 new RcClientDeathHandler (b , rcse .mMediaIntent );
34053413 try {
0 commit comments