22 #include "mpxmessagequeue.h" |
22 #include "mpxmessagequeue.h" |
23 #include "mpxclientlistobserver.h" |
23 #include "mpxclientlistobserver.h" |
24 #include "mpxclientlist.h" |
24 #include "mpxclientlist.h" |
25 #include <mpxsubscription.h> |
25 #include <mpxsubscription.h> |
26 |
26 |
|
27 // ============================ LOCAL FUNCTIONS ============================== |
|
28 |
|
29 // ---------------------------------------------------------------------------- |
|
30 // Searches process id for target selector plugin. |
|
31 // When the player has been opened in a mode, which is bound to the same engine |
|
32 // than certain application's engine, then need to fetch its process id. |
|
33 // (As a reference for parameter aMode see MMPXPlaybackUtility modes.) |
|
34 // Otherwise target selector plugin is notified wrongly about registered client |
|
35 // and key events are not propagated to correct application. |
|
36 // ---------------------------------------------------------------------------- |
|
37 // |
|
38 static void FindProcessIdForTsp( TInt aMode, TProcessId& aProcessId ) |
|
39 { |
|
40 TBool processFound( EFalse ); |
|
41 TFindProcess processFinder; |
|
42 TFullName processName; |
|
43 |
|
44 while ( processFinder.Next( processName ) == KErrNone && !processFound ) |
|
45 { |
|
46 RProcess process; |
|
47 TInt err = process.Open( processFinder ); |
|
48 if( err == KErrNone ) |
|
49 { |
|
50 if( process.SecureId().iId == aMode && process.ExitType() == EExitPending ) |
|
51 { |
|
52 MPX_DEBUG4("FindProcessIdForTsp(): pid changed from %d to %d (mode 0x%x)", |
|
53 TUint(aProcessId), TUint(process.Id()), aMode); |
|
54 aProcessId = process.Id(); |
|
55 processFound = ETrue; |
|
56 } |
|
57 process.Close(); |
|
58 } |
|
59 } |
|
60 } |
|
61 |
27 // ============================ MEMBER FUNCTIONS ============================== |
62 // ============================ MEMBER FUNCTIONS ============================== |
28 |
63 |
29 // ---------------------------------------------------------------------------- |
64 // ---------------------------------------------------------------------------- |
30 // Two-phased constructor. |
65 // Two-phased constructor. |
31 // ---------------------------------------------------------------------------- |
66 // ---------------------------------------------------------------------------- |
107 if (iClientProcesses.Find(pid)==KErrNotFound) |
142 if (iClientProcesses.Find(pid)==KErrNotFound) |
108 { |
143 { |
109 iClientProcesses.AppendL(pid); |
144 iClientProcesses.AppendL(pid); |
110 if (iObserver) |
145 if (iObserver) |
111 { |
146 { |
|
147 FindProcessIdForTsp(aMode, pid); |
112 iObserver->HandleClientChange(pid, MMPXClientlistObserver::EAdd); |
148 iObserver->HandleClientChange(pid, MMPXClientlistObserver::EAdd); |
113 } |
149 } |
114 } |
150 } |
115 } |
151 } |
116 // ---------------------------------------------------------------------------- |
152 // ---------------------------------------------------------------------------- |
174 TInt i=iClientProcesses.Find(id->iPid); |
211 TInt i=iClientProcesses.Find(id->iPid); |
175 if (KErrNotFound != i) |
212 if (KErrNotFound != i) |
176 { |
213 { |
177 if (iObserver) |
214 if (iObserver) |
178 { |
215 { |
179 iObserver->HandleClientChange(id->iPid, MMPXClientlistObserver::ERemove); |
216 TProcessId pid(id->iPid); |
|
217 FindProcessIdForTsp(id->iMode, pid); |
|
218 iObserver->HandleClientChange(pid, MMPXClientlistObserver::ERemove); |
180 } |
219 } |
181 iClientProcesses.Remove(i); |
220 iClientProcesses.Remove(i); |
182 } |
221 } |
183 } |
222 } |
184 delete id; |
223 delete id; |
491 CMPXMessageQueue* aMsgQueue, |
530 CMPXMessageQueue* aMsgQueue, |
492 TInt aCategory) |
531 TInt aCategory) |
493 : iTid(aTid), |
532 : iTid(aTid), |
494 iPid(aPid), |
533 iPid(aPid), |
495 iMode(aMode), |
534 iMode(aMode), |
496 iMsgQueue(aMsgQueue), |
535 iCategory(aCategory), |
497 iCategory(aCategory) |
536 iMsgQueue(aMsgQueue) |
498 {} |
537 {} |
499 |
538 |
500 // ----------------------------------------------------------------------------- |
539 // ----------------------------------------------------------------------------- |
501 // C++ constructor |
540 // C++ constructor |
502 // ----------------------------------------------------------------------------- |
541 // ----------------------------------------------------------------------------- |