From db8a361629f06f62b9e1c40d4413b3b5099bd124 Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Fri, 26 Aug 2011 19:10:51 -0700 Subject: [PATCH] Update IRemoteControlDisplay when it registers. When an IRemoteControlDisplay registers, it must receive information from the current client. Change-Id: Id845e7a87ac74c2db2c59e0281b28a45f8d20528 --- media/java/android/media/AudioService.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index a5c9053376065..dbe4115e0c903 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -3084,7 +3084,7 @@ public class AudioService extends IAudioService.Stub { mRcDisplay.setCurrentClientId( newClientGeneration, newClientEventReceiver, clearing); } catch (RemoteException e) { - Log.e(TAG, "Dead display in onRcDisplayUpdate() "+e); + Log.e(TAG, "Dead display in setNewRcClientOnDisplays_syncRcsCurrc() "+e); // if we had a display before, stop monitoring its death rcDisplay_stopDeathMonitor_syncRcStack(); mRcDisplay = null; @@ -3103,7 +3103,7 @@ public class AudioService extends IAudioService.Stub { try { se.mRcClient.setCurrentClientGenerationId(newClientGeneration); } catch (RemoteException e) { - Log.w(TAG, "Dead client in onRcDisplayUpdate()"+e); + Log.w(TAG, "Dead client in setNewRcClientGenerationOnClients_syncRcsCurrc()"+e); stackIterator.remove(); se.unlinkToRcClientDeath(); } @@ -3160,7 +3160,7 @@ public class AudioService extends IAudioService.Stub { rcse.mReceiverComponent /*event receiver*/, false /*clearing*/); - // ask the current client that it needs to send info + // tell the current client that it needs to send info try { mCurrentRcClient.onInformationRequested(mCurrentRcClientGen, flags, mArtworkExpectedWidth, mArtworkExpectedHeight); @@ -3457,6 +3457,21 @@ public class AudioService extends IAudioService.Stub { } } } + + // we have a new display, tell the current client that it needs to send info + // (following lock order: mRCStack then mCurrentRcLock) + synchronized(mCurrentRcLock) { + if (mCurrentRcClient != null) { + // tell the current client that it needs to send info + try { + mCurrentRcClient.onInformationRequested(mCurrentRcClientGen, + RC_INFO_ALL, mArtworkExpectedWidth, mArtworkExpectedHeight); + } catch (RemoteException e) { + Log.e(TAG, "Current valid remote client is dead: "+e); + mCurrentRcClient = null; + } + } + } } }