uifw/AknGlobalUI/AknCapServer/clientsrc/AknCapServerClient.cpp
changeset 0 2f259fa3e83a
child 33 b3425bf29f82
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 #include <eiknotapi.h>
       
    19 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    20 #include <uikon.hrh>
       
    21 #else
       
    22 #include <uikon.hrh>
       
    23 #include <uiklaf/private/pluginuid.hrh>
       
    24 #endif
       
    25 #include "AknCapServerClient.h"
       
    26 #include "AknCapServerDefs.h"
       
    27 #include <eiksrvs.h>
       
    28 #include <apgcli.h>
       
    29 #include <apasvst.h>
       
    30 #include <aknconsts.h>
       
    31 #include <AknNotifierControllerUtilities.h>
       
    32 
       
    33 // For global note.
       
    34 #include <AknGlobalNote.h>
       
    35 #include <avkon.rsg>
       
    36 
       
    37 #include "akndiscreetpopupdata.h"
       
    38 
       
    39 _LIT(KAknCapServerExecutable, "z:\\sys\\bin\\akncapserver.exe");
       
    40 _LIT(KAknNfySrvThreadName, "aknnfysrv");
       
    41 
       
    42 TInt RAknUiServer::ConnectAknServer()
       
    43     {
       
    44 #ifdef _DEBUG
       
    45     RThread me;
       
    46     TName name = me.Name();
       
    47     RDebug::Print( _L( "RAknUiServer::ConnectAknServer(), handle %d, %S" ), Handle(), &name );    
       
    48 #endif
       
    49     TInt err = KErrNone;
       
    50     if (Handle() == NULL)
       
    51         {
       
    52         _LIT(KServerNameFormat, "%08x_%08x_AppServer");
       
    53         TFullName serverName;
       
    54         
       
    55         serverName.Format(
       
    56             KServerNameFormat, 
       
    57             KUikonUidPluginInterfaceNotifiers, 
       
    58             KAknCapServerUid.iUid);
       
    59             
       
    60         TRAP(err, ConnectExistingByNameL(serverName));
       
    61         if (err == KErrNotFound) // This should be never true when starter is in use!
       
    62             {
       
    63             TRAP_IGNORE(StartAknCapserverL());
       
    64             User::After(500000); // No problem to wait synchronously as pure RnD support.
       
    65             TRAP(err,ConnectExistingByNameL(serverName));
       
    66             }
       
    67         }
       
    68 #ifdef _DEBUG
       
    69     RDebug::Print(_L("RAknUiServer::ConnectAknServer() end"));    
       
    70 #endif
       
    71     return err;
       
    72     }
       
    73     
       
    74 // This method must be able to connest eikon server always, used by notifiers running inside
       
    75 // eikon server.
       
    76 EXPORT_C TInt RAknUiServer::ConnectAndSendAppsKeySuppress(TBool aSuppress)
       
    77     {
       
    78     TInt ret = ConnectAknServer();
       
    79     if (ret == KErrNone)
       
    80         {
       
    81         TInt param = aSuppress ? EAknAppsKeyBlockAddCount : EAknAppsKeyBlockDecreaseCount;
       
    82         ret = SendReceive(EAknSSuppressAppsKey, TIpcArgs( param ));
       
    83         }
       
    84     return ret;
       
    85     }
       
    86 
       
    87 EXPORT_C TInt RAknUiServer::HideApplicationFromFsw(TBool aHide, TInt aMyUid)
       
    88     {
       
    89     RThread thread;
       
    90     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
    91         {
       
    92         return KErrNone;
       
    93         }
       
    94 
       
    95     TInt ret = ConnectAknServer();
       
    96     if (ret == KErrNone)
       
    97         {
       
    98         ret = SendReceive(EAknSHideApplicationFromFWS, TIpcArgs( aMyUid, aHide ));
       
    99         }
       
   100     return ret;
       
   101     }
       
   102 
       
   103 EXPORT_C void RAknUiServer::UnlockMedia(TInt aDrive, TBool aStore, TRequestStatus& aStatus)
       
   104     {
       
   105     TInt ret = ConnectAknServer();
       
   106     if (ret == KErrNone)
       
   107         {
       
   108         SendReceive(EAknSUnlockMedia, TIpcArgs( EFalse, aDrive, aStore ), aStatus);
       
   109         }
       
   110     else
       
   111         {
       
   112         TRequestStatus* ptr = &aStatus;  
       
   113         User::RequestComplete(ptr, ret);        
       
   114         }       
       
   115     }
       
   116     
       
   117 EXPORT_C void RAknUiServer::CancelUnlockMedia()
       
   118     {
       
   119     TInt ret = ConnectAknServer();
       
   120     if (ret == KErrNone)
       
   121         {
       
   122         ret = SendReceive(EAknSUnlockMedia, TIpcArgs( ETrue ));
       
   123         }
       
   124     }
       
   125     
       
   126 EXPORT_C TInt RAknUiServer::EnableTaskList(TBool aEnable)
       
   127     {
       
   128     RThread thread;
       
   129     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   130         {
       
   131         return KErrNone;
       
   132         }
       
   133 
       
   134     TInt ret = ConnectAknServer();
       
   135     if (ret == KErrNone)
       
   136         {
       
   137         ret = SendReceive(EAknSEnableTaskList, TIpcArgs( aEnable ));
       
   138         }
       
   139     return ret;
       
   140     }
       
   141     
       
   142 EXPORT_C TInt RAknUiServer::MakeTaskListVisible(TBool aShow)
       
   143     {
       
   144     RThread thread;
       
   145     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   146         {
       
   147         return KErrNone;        
       
   148         }
       
   149 
       
   150     TInt ret = ConnectAknServer();
       
   151     if (ret == KErrNone)
       
   152         {
       
   153         ret = SendReceive(EAknsLaunchTaskList, TIpcArgs( aShow));
       
   154         }
       
   155     return ret;
       
   156     }
       
   157     
       
   158 EXPORT_C TInt RAknUiServer::UpdateTaskList()
       
   159     {
       
   160     RThread thread;
       
   161     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   162         {
       
   163         return KErrNone;
       
   164         }
       
   165 
       
   166     TInt ret = ConnectAknServer();
       
   167     if (ret == KErrNone)
       
   168         {
       
   169         Send(EAknSRefreshTaskList);
       
   170         }
       
   171     return ret; 
       
   172     }
       
   173 
       
   174 EXPORT_C TInt RAknUiServer::SetSgcParams(TInt aWgId, TBitFlags aAppFlags, TInt aSpLayout, 
       
   175     TInt aSpFlags)
       
   176     {
       
   177     return SetSgcParams(aWgId, aAppFlags, aSpLayout, aSpFlags, KAknScreenModeUnset);
       
   178     }
       
   179 
       
   180 EXPORT_C TInt RAknUiServer::SetSgcParams(TInt aWgId, TBitFlags aAppFlags, TInt aSpLayout, 
       
   181     TInt aSpFlags, TInt aAppScreenMode)
       
   182     {
       
   183     RThread thread;
       
   184     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   185         {
       
   186         return KErrNone;        
       
   187         }
       
   188     
       
   189     SAknCapServerSetSgcParams params;
       
   190     params.iWgId = aWgId;
       
   191     params.iAppFlags = aAppFlags;
       
   192     params.iSpLayout = aSpLayout;
       
   193     params.iSpFlags = aSpFlags;
       
   194     params.iAppScreenMode = aAppScreenMode;
       
   195     TPckg<SAknCapServerSetSgcParams> pack(params);
       
   196 
       
   197     TIpcArgs args(&pack);
       
   198     return SendReceive(EAknEikAppUiSetSgcParams, args);
       
   199     }
       
   200 
       
   201 EXPORT_C TInt RAknUiServer::BlockServerStatusPaneRedraws()
       
   202     {
       
   203     RThread thread;
       
   204     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   205         {
       
   206         return KErrNone;        
       
   207         }
       
   208     
       
   209     return SendReceive(EAknEikAppUiBlockServerStatusPaneRedraws,TIpcArgs());
       
   210     }
       
   211 
       
   212 EXPORT_C TInt RAknUiServer::RedrawServerStatusPane()
       
   213     {
       
   214     RThread thread;
       
   215     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   216         {
       
   217         return KErrNone;        
       
   218         }
       
   219     
       
   220     return SendReceive(EAknEikAppUiRedrawServerStatusPane,TIpcArgs());
       
   221     }
       
   222 
       
   223 EXPORT_C TInt RAknUiServer::PrepareForAppExit(TInt aWgId)
       
   224     {
       
   225     RThread thread;
       
   226     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   227         {
       
   228         return KErrNone;        
       
   229         }
       
   230     
       
   231     TIpcArgs args( aWgId );
       
   232     return SendReceive(EAknEikAppUiPrepareForAppExit, args);
       
   233     }
       
   234 
       
   235 EXPORT_C TInt RAknUiServer::SetSystemFaded(TBool aFade)
       
   236     {
       
   237     RThread thread;
       
   238     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   239         {
       
   240         return KErrNone;        
       
   241         }
       
   242     
       
   243     TIpcArgs args( aFade );
       
   244     return SendReceive(EAknEikAppUiSetSystemFaded, args);
       
   245     }
       
   246 
       
   247 EXPORT_C TInt RAknUiServer::IsSystemFaded(TBool& aFade) const
       
   248     {
       
   249     RThread thread;
       
   250     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   251         {
       
   252         return KErrNone;        
       
   253         }
       
   254     
       
   255     TPckg<TBool> pckg(aFade);
       
   256     TIpcArgs args( &pckg );
       
   257     return SendReceive(EAknEikAppUiIsSystemFaded, args);
       
   258     }
       
   259 
       
   260 EXPORT_C TInt RAknUiServer::Connect()
       
   261     {
       
   262     RThread thread;
       
   263     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   264         {
       
   265         return KErrNone;        
       
   266         }
       
   267 
       
   268     return ConnectAknServer();
       
   269     }
       
   270 
       
   271 EXPORT_C TInt RAknUiServer::RelinquishPriorityToForegroundApp()
       
   272     {
       
   273     if (!Handle())
       
   274         {
       
   275         return KErrNone;        
       
   276         }
       
   277     
       
   278     return SendReceive(EAknEikAppUiRelinquishPriorityToForegroundApp);
       
   279     }
       
   280     
       
   281 EXPORT_C TInt RAknUiServer::SetStatusPaneFlags(TInt aFlags) const
       
   282     {
       
   283     RThread thread;
       
   284     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   285         {
       
   286         return KErrNone;        
       
   287         }
       
   288         
       
   289     return SendReceive(EAknSSetStatusPaneFlags,TIpcArgs(aFlags));
       
   290     }
       
   291 
       
   292 EXPORT_C TInt RAknUiServer::SetStatusPaneLayout(TInt aLayoutResId) const
       
   293     {
       
   294     RThread thread;
       
   295     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   296         {
       
   297         return KErrNone;        
       
   298         }
       
   299         
       
   300     return SendReceive(EAknSSetStatusPaneLayout,TIpcArgs(aLayoutResId));
       
   301     }
       
   302 
       
   303 EXPORT_C TInt RAknUiServer::BlankScreen() const
       
   304     {
       
   305     RThread thread;
       
   306     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   307         {
       
   308         return KErrNone;        
       
   309         }
       
   310     
       
   311     if ( thread.Name() == KAknNfySrvThreadName )
       
   312     //Notifier Server should not blank the screen, if not, flickers show
       
   313         {
       
   314         return KErrNone;
       
   315         }
       
   316         
       
   317     return SendReceive(EAknSBlankScreen,TIpcArgs());
       
   318     }
       
   319 
       
   320 EXPORT_C TInt RAknUiServer::UnblankScreen() const
       
   321     {
       
   322     RThread thread;
       
   323     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   324         {
       
   325         return KErrNone;        
       
   326         }
       
   327     
       
   328     if ( thread.Name() == KAknNfySrvThreadName )
       
   329         {
       
   330         return KErrNone;        
       
   331         }
       
   332         
       
   333     return SendReceive(EAknSUnblankScreen,TIpcArgs());
       
   334     }
       
   335 
       
   336 EXPORT_C TUid RAknUiServer::ServiceUid() const 
       
   337     {
       
   338     return KAknCapServiceUid;
       
   339     }   
       
   340 
       
   341 EXPORT_C TInt RAknUiServer::SetKeyboardRepeatRate(TAknDefaultKeyboardRepeatRate aRate)
       
   342     {
       
   343     RThread thread;
       
   344     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   345         {
       
   346         return KErrNone;        
       
   347         }
       
   348         
       
   349     return SendReceive(EAknSSetKeyboardRepeatRate,TIpcArgs(aRate));
       
   350     }
       
   351 
       
   352 EXPORT_C TInt RAknUiServer::SetKeyblockMode(TAknKeySoundOpcode aMode)
       
   353     {
       
   354     RThread thread;
       
   355     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   356         {
       
   357         return KErrNone;        
       
   358         }
       
   359         
       
   360     return SendReceive(EAknSUpdateKeyBlockMode,TIpcArgs(aMode));
       
   361     }
       
   362 
       
   363 EXPORT_C TInt RAknUiServer::DoEikonServerConnect()
       
   364     {
       
   365     return ConnectAknServer();
       
   366     }
       
   367 
       
   368 EXPORT_C TInt RAknUiServer::ShowKeysLockedNote(TBool& aIsKeyPadLocked)
       
   369     {
       
   370     TInt ret = SendReceive(EAknSShowLockedNote);
       
   371     if (ret >= 0) // no error 
       
   372         {
       
   373         aIsKeyPadLocked = ret;    
       
   374         ret = KErrNone;
       
   375         } 
       
   376     return ret;
       
   377     }
       
   378 
       
   379 EXPORT_C void RAknUiServer::ShutdownApps(const TUid aRequesterUID, 
       
   380     const TInt aTimeoutInMicroseconds, TRequestStatus& aStatus) const
       
   381     {
       
   382     TIpcArgs args( aRequesterUID.iUid, aTimeoutInMicroseconds );
       
   383     SendReceive(EAknSShutdownApps, args, aStatus);
       
   384     }
       
   385     
       
   386 EXPORT_C void RAknUiServer::CancelShutdownApps()
       
   387     {
       
   388     SendReceive(EAknSCancelShutdownApps);
       
   389     }
       
   390 
       
   391 EXPORT_C TInt RAknUiServer::ShowGlobalNoteL(const TDesC& aNoteText, TInt aGlobalNoteType)
       
   392     {
       
   393     if (!Handle())
       
   394         {
       
   395         return KErrNotReady;
       
   396         }
       
   397 
       
   398     CBufFlat* buffer = CBufFlat::NewL(128);
       
   399     CleanupStack::PushL(buffer);
       
   400     
       
   401     CAknGlobalNote::DoGlobaNoteBufferL(
       
   402         aGlobalNoteType,
       
   403         0,
       
   404         R_AVKON_SOFTKEYS_OK_EMPTY,
       
   405         -1,
       
   406         -1,
       
   407         -1,
       
   408         -1,
       
   409         EFalse,
       
   410         ETrue,
       
   411         aNoteText,
       
   412         buffer
       
   413         );
       
   414         
       
   415     TPtrC8 bufferPtr;
       
   416     bufferPtr.Set(buffer->Ptr(0));
       
   417     TPckgBuf<SAknGlobalNoteReturnParams> retPckg;
       
   418     TInt ret = SendReceive(EStartNotifier, TIpcArgs(KAknGlobalNoteUid.iUid, &bufferPtr, &retPckg));
       
   419     CleanupStack::PopAndDestroy(); // buffer
       
   420     return ret;
       
   421     }
       
   422     
       
   423 EXPORT_C TInt RAknUiServer::StatusPaneResourceId()
       
   424     { 
       
   425     if (!Handle()) // either eikon server has not yet connected to aknserver or we are in aknserver   
       
   426         {
       
   427         return 0; // zero is invalid resource id -> indicates problem accessing sp
       
   428         }
       
   429 
       
   430     TInt ret = 0;
       
   431     TPckg<TInt> pckg(ret);
       
   432     TInt err = SendReceive(EAknSStatusPaneResourceId, TIpcArgs(&pckg));
       
   433     return ((err == KErrNone)?ret:0);   
       
   434     }
       
   435 
       
   436 EXPORT_C TInt RAknUiServer::CreateActivateViewEventL(const TVwsViewId& aViewId, 
       
   437     TUid aCustomMessageId, const TDesC8& aCustomMessage)
       
   438     {
       
   439     return SendReceive(EAknSLaunchView, TIpcArgs(
       
   440         aViewId.iAppUid.iUid,
       
   441         aViewId.iViewUid.iUid,
       
   442         aCustomMessageId.iUid,
       
   443         &aCustomMessage));
       
   444     }
       
   445 
       
   446 EXPORT_C HBufC8* RAknUiServer::GetPackedConfigL() const
       
   447     {
       
   448     TInt size = 0;
       
   449     TPckg<TInt> pckg(size);
       
   450     User::LeaveIfError(SendReceive(EAknEikAppUiLayoutConfigSize, TIpcArgs(&pckg)));
       
   451     
       
   452     HBufC8* buf = HBufC8::NewMaxLC(size);
       
   453     TPtr8 ptr = buf->Des();
       
   454     User::LeaveIfError(SendReceive(EAknEikAppUiGetLayoutConfig, TIpcArgs(&ptr)));
       
   455     
       
   456     CleanupStack::Pop(buf);
       
   457     return buf;
       
   458     }
       
   459 
       
   460 EXPORT_C TInt RAknUiServer::CurrentAppStatuspaneResource()
       
   461     {
       
   462     if (!Handle()) // either eikon server has not yet connected to aknserver or we are in aknserver   
       
   463         {
       
   464         return 0; // zero is invalid resource id -> indicates problem accessing sp
       
   465         }
       
   466 
       
   467     TInt ret = 0;
       
   468     TPckg<TInt> pckg(ret);
       
   469     TInt err = SendReceive(EAknSStatusPaneAppResourceId, TIpcArgs(&pckg));
       
   470     return ((err == KErrNone)?ret:0);   
       
   471     }
       
   472     
       
   473 EXPORT_C TInt RAknUiServer::SetCurrentAppStatuspaneResource(TInt aResourceId)
       
   474     {
       
   475     RThread thread;
       
   476     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   477         {
       
   478         return KErrNone;        
       
   479         }
       
   480         
       
   481     return SendReceive(EAknSSetStatusPaneAppResourceId,TIpcArgs(aResourceId));      
       
   482     }
       
   483 
       
   484 EXPORT_C TInt RAknUiServer::RotateScreen()
       
   485     {
       
   486     return SendReceive(EAknSRotateScreen, TIpcArgs());
       
   487     }
       
   488 
       
   489 EXPORT_C TBool RAknUiServer::TaskSwitchingSupressed()
       
   490     {
       
   491     if (ConnectAknServer() == KErrNone)
       
   492         {
       
   493         // Mimics also boolean EFalse, in any error or posivite value we assume that appswitch is 
       
   494         // forbidden.
       
   495         return !(SendReceive(EAknSAppsKeyBlocked) == KErrNone); 
       
   496         }                                                      
       
   497     else 
       
   498         {
       
   499         return ETrue; // Capserver not available -> no app switching allowed either    
       
   500         }
       
   501     }
       
   502 
       
   503 EXPORT_C TInt RAknUiServer::ShowLongTapAnimation( const TPointerEvent& aEvent)
       
   504     {
       
   505     if ( !Handle() )
       
   506         {
       
   507         return KErrCouldNotConnect;
       
   508         }
       
   509     
       
   510     return SendReceive(
       
   511         EAknSShowLongTapAnimation, 
       
   512         TIpcArgs(aEvent.iParentPosition.iX, aEvent.iParentPosition.iY));
       
   513     }
       
   514     
       
   515 EXPORT_C TInt RAknUiServer::HideLongTapAnimation()
       
   516     {
       
   517     if ( !Handle() )
       
   518         {
       
   519         return KErrCouldNotConnect;
       
   520         }
       
   521 
       
   522     return SendReceive(EAknSHideLongTapAnimation, TIpcArgs());
       
   523     }
       
   524 
       
   525 EXPORT_C TInt RAknUiServer::GetAliasKeyCode(TUint& aCode, const TKeyEvent& aKeyEvent, 
       
   526     TEventCode aType)
       
   527     {
       
   528     TPckgC<TKeyEvent> buf(aKeyEvent);
       
   529     TPckg<TUint> pckg(aCode);
       
   530 
       
   531     return SendReceive(EAknGetAliasKeyCode, TIpcArgs(&pckg, &buf, aType));
       
   532     }
       
   533 
       
   534 EXPORT_C TInt RAknUiServer::GetPhoneIdleViewId( TVwsViewId& aViewId )
       
   535     {
       
   536     TPckg<TVwsViewId> pckg(aViewId);
       
   537     return SendReceive(EAknSGetPhoneIdleViewId, TIpcArgs(&pckg));
       
   538     }
       
   539 
       
   540 EXPORT_C void RAknUiServer::StartAknCapserverL()
       
   541     {
       
   542     AknStartupApaServerProcess();
       
   543     
       
   544     RApaLsSession apa;
       
   545     User::LeaveIfError(apa.Connect());
       
   546     CleanupClosePushL(apa);
       
   547 
       
   548     CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
       
   549     cmdLine->SetExecutableNameL( KAknCapServerExecutable );
       
   550     cmdLine->SetServerRequiredL(KUikonUidPluginInterfaceNotifiers);
       
   551     cmdLine->SetCommandL(EApaCommandBackground);
       
   552     TThreadId dummy;
       
   553     
       
   554     TRequestStatus requestStatusForRendezvous;
       
   555     User::LeaveIfError(apa.StartApp(*cmdLine, dummy, &requestStatusForRendezvous));
       
   556     User::WaitForRequest(requestStatusForRendezvous);
       
   557     User::LeaveIfError(requestStatusForRendezvous.Int());
       
   558     CleanupStack::PopAndDestroy(2, &apa);   // cmdLine and apa    
       
   559     }
       
   560 
       
   561 
       
   562 /* Copied from \common\generic\app-framework\apparc\apgrfx\apscli.cpp
       
   563  * so that a command line can be passed to apparc.
       
   564  */ 
       
   565 EXPORT_C TInt AknStartupApaServerProcess()
       
   566     {
       
   567     _LIT(KNameApaImage,"APSEXE");
       
   568     const TUid KServerUid3 = { 0x10003A3F };
       
   569     const TUidType uidType(KNullUid, KNullUid, KServerUid3);
       
   570     
       
   571     _LIT(KApaCommandLine, "-IDLE_TIMEOUT_PERIODIC_DELAY_5000");
       
   572     RProcess server;
       
   573     TInt r = server.Create(KNameApaImage, KApaCommandLine, uidType);
       
   574     
       
   575     if (r != KErrNone)
       
   576         {
       
   577         return r;   
       
   578         }
       
   579     TRequestStatus stat;
       
   580     server.Rendezvous(stat);
       
   581     if (stat != KRequestPending)
       
   582         {
       
   583         server.Kill(0);     // abort startup
       
   584         }
       
   585     else
       
   586         {
       
   587         server.Resume();    // logon OK - start the server
       
   588         }
       
   589     User::WaitForRequest(stat); // wait for start or death
       
   590     server.Close();
       
   591     return stat.Int();
       
   592     }
       
   593 
       
   594 EXPORT_C TInt RAknUiServer::DoNotifierControllerCommand(TInt aNotifierControllerCommand)
       
   595     {
       
   596     return Send(KDoNotifierControllerCommand, TIpcArgs(aNotifierControllerCommand));
       
   597     }
       
   598 
       
   599 EXPORT_C TInt RAknUiServer::SetFgSpDataSubscriberId(TInt aId)
       
   600     {
       
   601     RThread thread;
       
   602     if (!Handle() && thread.Name() == EIKAPPUI_SERVER_THREAD_NAME)
       
   603         {
       
   604         return KErrNone;        
       
   605         }
       
   606     return SendReceive(EAknSetFgSpDataSubscriberId, TIpcArgs(aId));      
       
   607     }
       
   608 
       
   609 EXPORT_C TInt RAknUiServer::PreAllocateDynamicSoftNoteEvent(TInt aNoteId)
       
   610     {
       
   611     return SendReceive(EAknSPreAllocateDynamicSoftNoteEvent, TIpcArgs(aNoteId));
       
   612     }
       
   613     
       
   614 EXPORT_C void RAknUiServer::NotifyDynamicSoftNoteEvent(TRequestStatus& aStatus, TDes8& aActionId)
       
   615     {
       
   616     TIpcArgs args(&aActionId);
       
   617     SendReceive(EAknSNotifyDynamicSoftNoteEvent, args, aStatus);
       
   618     }
       
   619     
       
   620 EXPORT_C void RAknUiServer::CancelDynamicSoftNoteEventNotification()
       
   621     {
       
   622     SendReceive(EAknSCancelDynamicSoftNoteEventNotification, TIpcArgs());
       
   623     }
       
   624     
       
   625 EXPORT_C TInt RAknUiServer::MoveAppInZOrder(TInt aAppWindowGroupId, TBool aBackgroundOrForeground)
       
   626 	{
       
   627     return Send(EAknEikAppUiMoveAppInZOrder, TIpcArgs(aAppWindowGroupId, aBackgroundOrForeground));
       
   628 	}
       
   629     
       
   630 
       
   631 EXPORT_C void RAknUiServer::DoDiscreetPopupAction( 
       
   632         TAknDiscreetPopupData* aData, TRequestStatus* aStatus )
       
   633     {
       
   634     if ( !aData || !Handle() )
       
   635         {
       
   636         return;
       
   637         }
       
   638 
       
   639     switch ( aData->Type() )
       
   640         {
       
   641         // Launch global popup with params
       
   642         case ( TAknDiscreetPopupData::EAknPopupTypeParam ):
       
   643             {
       
   644             TPckg<TAknDiscreetPopupParamData> pkg( 
       
   645                     *( static_cast<TAknDiscreetPopupParamData*>( aData ) ) );
       
   646             SendReceive( EAknSDiscreetPopupAction, TIpcArgs( &pkg ), *aStatus );
       
   647             break;
       
   648             }
       
   649         // Launch global popup from resources
       
   650         case ( TAknDiscreetPopupData::EAknPopupTypeResource ):
       
   651             {
       
   652             TPckg<TAknDiscreetPopupResourceData> pkg( 
       
   653                     *( static_cast<TAknDiscreetPopupResourceData*>( aData ) ) );
       
   654             SendReceive( EAknSDiscreetPopupAction, TIpcArgs( &pkg ), *aStatus );
       
   655             break;
       
   656             }
       
   657         // All request cancellation
       
   658         case ( TAknDiscreetPopupData::EAknPopupTypeCancelRequest ):
       
   659             {
       
   660             TPckg<TAknDiscreetPopupCancelRequestData> pkg( 
       
   661                     *( static_cast<TAknDiscreetPopupCancelRequestData*>( aData ) ) );
       
   662             SendReceive( EAknSDiscreetPopupAction, TIpcArgs( &pkg ) );
       
   663             break;
       
   664             }
       
   665          // Id request
       
   666         case ( TAknDiscreetPopupData::EAknPopupTypeUndefined ):
       
   667             {
       
   668             TPckg<TAknDiscreetPopupData> pkg( 
       
   669                     *( static_cast<TAknDiscreetPopupData*>( aData ) ) );
       
   670             SendReceive( EAknSDiscreetPopupAction, TIpcArgs( &pkg ) );
       
   671             break;    
       
   672             }
       
   673         // Query the rect of global discreet popup in use
       
   674         case ( TAknDiscreetPopupData::EAknPopupTypeQueryInUseRect ):
       
   675             {
       
   676             TPckg<TAknDiscreetPopupRectData> pkg(
       
   677                     *( static_cast<TAknDiscreetPopupRectData*>( aData ) ) );
       
   678             SendReceive( EAknSDiscreetPopupAction, TIpcArgs( &pkg ) );
       
   679             break;
       
   680             }        
       
   681         default:
       
   682             {
       
   683             break;
       
   684             }
       
   685         }
       
   686     }
       
   687 
       
   688 // ---------------------------------------------------------------------------
       
   689 // RAknUiServer::GetInUseGlobalDiscreetPopupRect
       
   690 // ---------------------------------------------------------------------------
       
   691 //
       
   692 EXPORT_C const TRect RAknUiServer::GetInUseGlobalDiscreetPopupRect()
       
   693     {
       
   694     TAknDiscreetPopupRectData rectData(TRect::EUninitialized);
       
   695     DoDiscreetPopupAction( static_cast<TAknDiscreetPopupData*>(&rectData),NULL);
       
   696     return rectData.Rect();            
       
   697     }
       
   698 
       
   699 // End of file