uifw/AknGlobalUI/AknCapServer/src/AknCapServer.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2005-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:  AknCapServer Server and Session implementation 
       
    15 *
       
    16 */
       
    17 
       
    18 #include <AknNotifierWrapperDefs.h>
       
    19 #include <aknconsts.h>
       
    20 #include <aknanimdllstd.h>
       
    21 #include <AknCapServerClient.h>
       
    22 #include <baclipb.h>
       
    23 #include "AknCapServerDefs.h"
       
    24 #include "AknCapServerEntry.h"
       
    25 #include "AknCapServer.h"
       
    26 #include "AknMemoryCardDialogImpl.h"
       
    27 #include "AknCapServerShutdown.h"
       
    28 #include "akndynamicsoftnoteeventmanager.h"
       
    29 #include <AknNotifierControllerPlugin.h>
       
    30 #include <aknlongtapanimation.h>
       
    31 #include <AknDef.h>
       
    32 #include "akncapserverdiscreetpopuphandler.h"
       
    33 
       
    34 NONSHARABLE_CLASS(CAknAlarmInterface): public CAknAppServiceBase, public MAknAlarmServiceStartup
       
    35     {
       
    36     };
       
    37 
       
    38 const TInt KEikonServerSecureId = 0x10003A4A;
       
    39     
       
    40 TBool  CAknCapServerSession::AllowClientL(const RMessage2& /*aMessage*/)
       
    41     {
       
    42     return ETrue;
       
    43     }
       
    44 
       
    45 void  CAknCapServerSession::HandleMessageL(const RMessage2& aMessage)
       
    46     {   
       
    47     switch (aMessage.Function())
       
    48         {
       
    49         case EAknSLaunchView:
       
    50             {
       
    51             // completes the message
       
    52             iServer->CreateActivateViewL(aMessage);
       
    53             }
       
    54             break;
       
    55         case EAknSKillApp:
       
    56         case EAknSKillAllApps:
       
    57             iServer->KillAppL(aMessage);
       
    58             break;
       
    59         case EAknSUnlockMedia:
       
    60             iServer->HandleMMCRequestL(aMessage, REINTERPRET_CAST(TInt,this));          
       
    61             break;
       
    62         case EAknSEnableTaskList:
       
    63         case EAknsLaunchTaskList:
       
    64         case EAknSRefreshTaskList:
       
    65             iServer->DoTaskListCommandL(aMessage);
       
    66             break;
       
    67         case EAknSSuppressAppsKey:
       
    68             if (aMessage.SecureId() != KEikonServerSecureId)
       
    69                 {
       
    70                 // WriteDeviceData required if client is not eiksrv.                    
       
    71                 aMessage.HasCapabilityL(ECapabilityWriteDeviceData); 
       
    72                 }
       
    73             iServer->SuppressAppsKeyL(aMessage,this);
       
    74             break;
       
    75         case EAknSHideApplicationFromFWS:
       
    76             iServer->HideApplicationFromFWSL(aMessage);
       
    77             break;        
       
    78         case EAknSSetStatusPaneFlags:
       
    79             {
       
    80             iServer->SetStatusPaneFlags(aMessage.Int0());
       
    81             aMessage.Complete(KErrNone);
       
    82             }
       
    83             break;
       
    84         case EAknSSetStatusPaneLayout:
       
    85             {
       
    86             iServer->SetStatusPaneLayoutL(aMessage.Int0());
       
    87             aMessage.Complete(KErrNone);
       
    88             }
       
    89             break;
       
    90         case EAknSBlankScreen:
       
    91             {
       
    92             iBlankCount++;
       
    93             TRAPD(err, iServer->BlankScreenL());
       
    94             aMessage.Complete(err);
       
    95             }
       
    96             break;
       
    97         case EAknSUnblankScreen:
       
    98             {
       
    99             iBlankCount--;
       
   100             iServer->UnblankScreenL();
       
   101             aMessage.Complete(KErrNone);
       
   102             }
       
   103             break;
       
   104         case EAknEikAppUiSetSgcParams:
       
   105             {
       
   106             TPckgBuf<SAknCapServerSetSgcParams> paramsBuf;
       
   107             aMessage.ReadL(0, paramsBuf);
       
   108             const SAknCapServerSetSgcParams& params = paramsBuf();
       
   109             
       
   110             iServer->SetSgcParamsL(
       
   111                 params.iWgId, 
       
   112                 params.iAppFlags, 
       
   113                 params.iSpLayout, 
       
   114                 params.iSpFlags, 
       
   115                 params.iAppScreenMode);
       
   116                 
       
   117             aMessage.Complete(KErrNone);
       
   118             }
       
   119             break;
       
   120         case EAknEikAppUiBlockServerStatusPaneRedraws:
       
   121             {
       
   122             aMessage.Complete(KErrNone);
       
   123             }
       
   124             break;
       
   125         case EAknEikAppUiRedrawServerStatusPane:
       
   126             {
       
   127             CAknSgcClient::RedrawServerStatusPane();
       
   128             aMessage.Complete(KErrNone);
       
   129             }
       
   130             break;
       
   131         case EAknEikAppUiPrepareForAppExit:
       
   132             {
       
   133             iServer->PrepareForAppExitL(aMessage.Int0());
       
   134             aMessage.Complete(KErrNone);
       
   135             }
       
   136             break;
       
   137         case EAknEikAppUiSetSystemFaded:
       
   138             {
       
   139             TBool isFaded(aMessage.Int0());
       
   140             CCoeEnv *env = CCoeEnv::Static();
       
   141             CAknAppUi *appUi = static_cast<CAknAppUi*>(env->AppUi());
       
   142             
       
   143             if (!isFaded 
       
   144                 && appUi->IsDisplayingMenuOrDialog() 
       
   145                 && env->RootWin().OrdinalPriority() >= ECoeWinPriorityAlwaysAtFront
       
   146                 && env->RootWin().Identifier() == env->WsSession().GetFocusWindowGroup())
       
   147                 {
       
   148                 // Don't unfaded the sytem, because in this case the requesting client application
       
   149                 // already go back to the background just after staying in the foreground
       
   150                 // for quite few moment, and the cap server return to the foreground again
       
   151                 // when a sleeping dialog poped up in global note.
       
   152                 }
       
   153             else
       
   154                 {
       
   155                 CAknSgcClient::SetSystemFaded(isFaded);
       
   156                 }
       
   157             
       
   158             aMessage.Complete(KErrNone);
       
   159             }
       
   160             break;
       
   161         case EAknEikAppUiIsSystemFaded:
       
   162             {
       
   163             TBool fade = CAknSgcClient::IsSystemFaded();
       
   164             TPckg<TBool> pckg(fade);
       
   165             aMessage.WriteL(0, pckg);
       
   166             aMessage.Complete(KErrNone);
       
   167             }
       
   168             break;
       
   169         case EAknEikAppUiRelinquishPriorityToForegroundApp:
       
   170             {
       
   171             iServer->RelinquishPriorityToForegroundAppL(aMessage);
       
   172             }
       
   173             break;
       
   174         case EAknEikAppUiLayoutConfigSize:
       
   175             {
       
   176             TInt size = CAknSgcClient::LayoutConfigBuf().Size();
       
   177             TPckg<TInt> pckg(size);
       
   178             aMessage.WriteL(0, pckg);
       
   179             aMessage.Complete(KErrNone);
       
   180             }
       
   181             break;
       
   182         case EAknEikAppUiGetLayoutConfig:
       
   183             {
       
   184             const TDesC8& buf = CAknSgcClient::LayoutConfigBuf();
       
   185             aMessage.WriteL(0, buf);
       
   186             aMessage.Complete(KErrNone);
       
   187             }
       
   188             break;
       
   189         case EAknEikAppUiMoveAppInZOrder:
       
   190             {
       
   191             CAknSgcClient::MoveApp(aMessage.Int0(), (TSgcMoveAppToWhere)aMessage.Int1());
       
   192             aMessage.Complete(KErrNone);
       
   193             }
       
   194             break;
       
   195         case EAknSSetKeyboardRepeatRate:
       
   196             {
       
   197             CAknSgcClient::SetKeyboardRepeatRate((TAknDefaultKeyboardRepeatRate)aMessage.Int0());    
       
   198             aMessage.Complete(KErrNone);
       
   199             break;
       
   200             }
       
   201         case EAknSUpdateKeyBlockMode:
       
   202             {
       
   203             CAknSgcClient::SetKeyBlockMode((TAknKeySoundOpcode)aMessage.Int0());
       
   204             aMessage.Complete(KErrNone);
       
   205             break;
       
   206             }
       
   207         case EAknSShowLockedNote:
       
   208             {
       
   209             CEikonEnv* env = CEikonEnv::Static();
       
   210             RWsSession& wsSession = env->WsSession();
       
   211             TInt myWgId = env->RootWin().Identifier();
       
   212             // if keylock is active, we have special wg priority
       
   213             if (wsSession.GetWindowGroupOrdinalPriority(myWgId) == ECoeWinPriorityAlwaysAtFront+1)
       
   214                 {
       
   215                 TKeyEvent key;
       
   216                 key.iCode=EKeyCBA2;
       
   217                 key.iModifiers=0;
       
   218                 key.iRepeats=0;
       
   219                 env->SimulateKeyEventL(key, EEventKey);
       
   220                 aMessage.Complete(ETrue);               
       
   221                 }
       
   222              else
       
   223                 {
       
   224                 aMessage.Complete(EFalse);                  
       
   225                 }   
       
   226             break;    
       
   227             }
       
   228         case EAknSShutdownApps:
       
   229             {
       
   230             if (aMessage.SecureId() != KEikonServerSecureId)
       
   231                 {
       
   232                 // PowerMgmt required if client is not eiksrv.                    
       
   233                 aMessage.HasCapabilityL(ECapabilityPowerMgmt); 
       
   234                 }
       
   235             //Empty clipboard here
       
   236             RFs& fs = CEikonEnv::Static()->FsSession();
       
   237             CClipboard* cb=0;
       
   238             TRAPD(err, 
       
   239                 { 
       
   240                 cb = CClipboard::NewForWritingLC(fs);
       
   241                 CleanupStack::Pop();
       
   242                 }); // end of trap
       
   243             
       
   244             if (!err)
       
   245                 {
       
   246                 cb->Clear(fs);
       
   247                 }
       
   248             delete cb;
       
   249 
       
   250             iServer->ShutdownAppsL(aMessage);
       
   251             break;
       
   252             }
       
   253         case EAknSCancelShutdownApps:
       
   254             {
       
   255             if (aMessage.SecureId() != KEikonServerSecureId)
       
   256                 {
       
   257                 // PowerMgmt required if client is not eiksrv.                    
       
   258                 aMessage.HasCapabilityL(ECapabilityPowerMgmt); 
       
   259                 }
       
   260             iServer->CancelShutdownAppsL();
       
   261             aMessage.Complete(KErrNone);
       
   262             break;
       
   263             }
       
   264         case EAknSStatusPaneResourceId:
       
   265             {   
       
   266             TInt id = CAknSgcClient::CurrentStatuspaneResource();
       
   267             TPckg<TInt> pckg(id);
       
   268             aMessage.WriteL(0, pckg);
       
   269             aMessage.Complete(KErrNone);
       
   270             break;
       
   271             }
       
   272         case EAknSStatusPaneAppResourceId:
       
   273             {   
       
   274             TInt id = iServer->CurrentAppStatuspaneResourceIdL();
       
   275             TPckg<TInt> pckg(id);
       
   276             aMessage.WriteL(0, pckg);
       
   277             aMessage.Complete(KErrNone);
       
   278             break;
       
   279             }
       
   280         case EAknSSetStatusPaneAppResourceId:
       
   281             {   
       
   282             iServer->SetCurrentAppStatuspaneResourceIdL(aMessage.Int0());
       
   283             aMessage.Complete(KErrNone);
       
   284             break;
       
   285             }
       
   286         case EAknSetFgSpDataSubscriberId:
       
   287             {   
       
   288             iServer->SetFgSpDataSubscriberIdL(aMessage.Int0());
       
   289             aMessage.Complete(KErrNone);
       
   290             break;
       
   291             }
       
   292         case EAknSRotateScreen:
       
   293             {
       
   294             iServer->RotateScreenL();
       
   295             aMessage.Complete(KErrNone);
       
   296             break;
       
   297             }
       
   298         case EAknSAppsKeyBlocked:
       
   299             {
       
   300             iServer->DoAskAppsKeyStatusL(aMessage);
       
   301             break;
       
   302             }
       
   303         case EAknSShowLongTapAnimation:
       
   304             {
       
   305             iServer->ShowLongTapAnimationL(aMessage.Int0(), aMessage.Int1());
       
   306             aMessage.Complete(KErrNone);
       
   307             break;
       
   308             }
       
   309         case EAknSHideLongTapAnimation:
       
   310             {
       
   311             iServer->HideLongTapAnimation();
       
   312             aMessage.Complete(KErrNone);
       
   313             break;
       
   314             }
       
   315         case EAknGetAliasKeyCode:
       
   316             {
       
   317             TUint code = 0;
       
   318             TPckgBuf<TKeyEvent> keyEvent;
       
   319             aMessage.ReadL(1,keyEvent);
       
   320             iServer->GetAliasKeyCodeL(code, keyEvent(), (TEventCode)aMessage.Int2());
       
   321             aMessage.WriteL(0,TPckg<TUint>(code));
       
   322             aMessage.Complete(KErrNone);
       
   323             break;    
       
   324             }
       
   325         case EAknSGetPhoneIdleViewId:
       
   326             {
       
   327             TPckgBuf<TVwsViewId> id;
       
   328             aMessage.ReadL(0, id); 
       
   329             iServer->GetPhoneIdleViewId(id());
       
   330             aMessage.WriteL(0, id);
       
   331             aMessage.Complete(KErrNone);
       
   332             break;
       
   333             }
       
   334         case EAknSPreAllocateDynamicSoftNoteEvent:
       
   335             {
       
   336             iServer->DynamicSoftNoteEventManager()->RegisterEventL(this, aMessage);            
       
   337             break;
       
   338             }
       
   339         case EAknSNotifyDynamicSoftNoteEvent:
       
   340             {
       
   341             iServer->DynamicSoftNoteEventManager()->NotifyEvent(this, aMessage);
       
   342             break;
       
   343             }
       
   344         case EAknSCancelDynamicSoftNoteEventNotification:
       
   345             {
       
   346             iServer->DynamicSoftNoteEventManager()->CancelEvent(this, aMessage);
       
   347             break;
       
   348             }
       
   349         case EAknSDiscreetPopupAction:
       
   350             {
       
   351             CAknCapServerDiscreetPopupHandler::HandleDiscreetPopupMessageL( aMessage );
       
   352             break;
       
   353             }
       
   354         case KDoNotifierControllerCommand:
       
   355             {
       
   356             if (aMessage.SecureId() != KEikonServerSecureId)
       
   357                 {
       
   358                 User::Leave(KErrPermissionDenied);
       
   359                 }
       
   360                 
       
   361             CAknCapAppServerAppUi* appUi = (CAknCapAppServerAppUi*) CEikonEnv::Static()->AppUi();
       
   362             if (appUi && appUi->iGlobalNotesController)
       
   363                 {
       
   364                 switch(aMessage.Int0())
       
   365                     {
       
   366                 case CAknNotifierControllerUtility::EDoAllow:
       
   367                     appUi->iGlobalNotesController->KeyLockStatusChange(EKeyLockAllowNotifications);
       
   368                     break;
       
   369                 case CAknNotifierControllerUtility::EDoStop:
       
   370                     appUi->iGlobalNotesController->KeyLockStatusChange(EKeyLockStopNotifications);
       
   371                     break;
       
   372                 case CAknNotifierControllerUtility::DoCancelAll:
       
   373                     appUi->iGlobalNotesController->KeyLockStatusChange(EKeyLockCancelNotification);
       
   374                     break;
       
   375                 default:
       
   376                     break;
       
   377                     }
       
   378                 }            
       
   379             } // fall through
       
   380         case ECancelNotifier:   // check if cancel (from TNotifierMessage)
       
   381             {
       
   382             RThread t;
       
   383             aMessage.ClientL(t);
       
   384 
       
   385             // store client information to appui
       
   386             CAknCapAppServerAppUi* appUi = (CAknCapAppServerAppUi*) CEikonEnv::Static()->AppUi();
       
   387             appUi->iClientId = t.Id();
       
   388             
       
   389             t.Close();
       
   390             } // fall through
       
   391         default:
       
   392             iServer->CheckAndLoadLibrariesL();
       
   393             // base call
       
   394             CAknNotifierServerAppService::HandleMessageL(aMessage);
       
   395             break;      
       
   396             }
       
   397     }
       
   398 
       
   399 CApaAppServiceBase* CAknCapServer::CreateServiceL(TUid aServiceType) const
       
   400     {
       
   401     // We provide place alarm library that can't run with eikon server capabilities.
       
   402     if (aServiceType == KAknAlarmServiceUid)
       
   403         { // There can't be more than one instance of this service running
       
   404         __ASSERT_DEBUG(iLibrary.Handle() == 0, User::Invariant());
       
   405         RLibrary& library = MUTABLE_CAST(RLibrary&, iLibrary);
       
   406         User::LeaveIfError(library.Load(KAknAlarmServiceLibrary));
       
   407         TLibraryFunction constructor = library.Lookup(1);
       
   408         MAknAlarmServiceStartup* alarm = (MAknAlarmServiceStartup*)((*constructor)());
       
   409         User::LeaveIfNull(alarm);
       
   410         alarm->StartupNewSessionL();
       
   411         return (CAknAlarmInterface*)alarm;
       
   412         }   
       
   413     else if ( aServiceType == KAknCapServiceUid || aServiceType == KAknNotifierServiceUid )
       
   414         {
       
   415         return new (ELeave) CAknCapServerSession(this);
       
   416         }
       
   417     else 
       
   418         {
       
   419         return CAknNotifierAppServer::CreateServiceL(aServiceType); 
       
   420         }   
       
   421     }
       
   422 
       
   423 void CAknCapServer::KillAppL(const RMessage2& aMessage)
       
   424     {
       
   425     EnsureAppUiValidityL();
       
   426     iAppUi->KillAppL(aMessage);
       
   427     }
       
   428 
       
   429 void CAknCapServer::DoTaskListCommandL(const RMessage2& aMessage)
       
   430     {
       
   431     EnsureAppUiValidityL();
       
   432     iAppUi->DoTaskListCommandL(aMessage);   
       
   433     }
       
   434 
       
   435 void CAknCapServer::SuppressAppsKeyL(const RMessage2& aMessage, CAknCapServerSession* aClient )
       
   436     {
       
   437     EnsureAppUiValidityL();
       
   438     iAppUi->SuppressAppSwitchingL(aMessage.Int0(),REINTERPRET_CAST(TInt,aClient));
       
   439     aMessage.Complete(KErrNone);
       
   440     }
       
   441 
       
   442 void CAknCapServer::HandleClientExit(CAknCapServerSession* aClient)
       
   443     { // not allowed to leave 
       
   444     if (iAppUi)
       
   445         { // can't leave when aAddCount == 0
       
   446         TInt clientId = REINTERPRET_CAST(TInt,aClient);
       
   447         TRAP_IGNORE(iAppUi->SuppressAppSwitchingL(EAknAppsKeyBlockRemoveClient, clientId));
       
   448         iAppUi->MMCUnlock()->ClientExit( clientId );
       
   449         }
       
   450     if (iDynamicSoftNoteEventManager)
       
   451         {
       
   452         iDynamicSoftNoteEventManager->ClientExit(aClient);
       
   453         }
       
   454     }
       
   455 
       
   456 void CAknCapServer::EnsureAppUiValidityL()
       
   457     {
       
   458     if (!iAppUi)
       
   459         {
       
   460         iAppUi = (CAknCapAppServerAppUi*) CEikonEnv::Static()->EikAppUi();
       
   461         }
       
   462     
       
   463     if (!iAppUi)
       
   464         {
       
   465         User::Leave(KErrNotReady);      
       
   466         }
       
   467     }
       
   468 
       
   469 void CAknCapServer::HideApplicationFromFWSL(const RMessage2& aMessage )
       
   470     {
       
   471     EnsureAppUiValidityL();
       
   472     iAppUi->HideApplicationFromFswL(aMessage.Int0(),aMessage.Int1());
       
   473     aMessage.Complete(KErrNone);
       
   474     }
       
   475 
       
   476 void CAknCapServer::HandleMMCRequestL(const RMessage2& aMessage, TInt aClientId )
       
   477     {
       
   478     if (aMessage.Int0() == 0) // not cancel
       
   479         { // owner ship of message to dialog
       
   480         EnsureAppUiValidityL();
       
   481         iAppUi->MMCUnlock()->StartL(aMessage.Int1(), aMessage.Int2(), aMessage, aClientId);
       
   482         }
       
   483     else
       
   484         {
       
   485         TRAPD(err,  EnsureAppUiValidityL())
       
   486         if (!err)
       
   487             {
       
   488             iAppUi->MMCUnlock()->Cancel(aClientId);
       
   489             }
       
   490         aMessage.Complete(KErrNone);
       
   491         }
       
   492     }
       
   493 
       
   494 void CAknCapServer::SetSgcParamsL(TInt aWgId, TBitFlags aAppFlags, TInt aSpLayout, TInt aSpFlags, 
       
   495     TInt aAppScreenMode)
       
   496     {
       
   497     EnsureAppUiValidityL();
       
   498     
       
   499     iAppUi->SgcServer()->HandleWindowGroupParamChangeL(
       
   500         aWgId, 
       
   501         aAppFlags, 
       
   502         aSpLayout, 
       
   503         aSpFlags, 
       
   504         aAppScreenMode);
       
   505     }
       
   506 
       
   507 void CAknCapServer::PrepareForAppExitL(TInt aWgId)
       
   508     {
       
   509     EnsureAppUiValidityL();
       
   510     iAppUi->SgcServer()->PrepareForAppExitL(aWgId);
       
   511     }
       
   512 
       
   513 void CAknCapServer::RelinquishPriorityToForegroundAppL(const RMessage2& aMessage)
       
   514     {
       
   515     EnsureAppUiValidityL();
       
   516     iAppUi->SgcServer()->RelinquishPriorityToForegroundAppL(aMessage);
       
   517     }
       
   518 
       
   519 void CAknCapServer::SetStatusPaneFlags(TInt aFlags)
       
   520     {
       
   521     if (iAppUi && iAppUi->StatusPane())
       
   522         {
       
   523         iAppUi->StatusPane()->SetFlags(aFlags);
       
   524         }
       
   525     }
       
   526 
       
   527 void CAknCapServer::SetStatusPaneLayoutL(TInt aResourceId)
       
   528     {
       
   529     EnsureAppUiValidityL(); 
       
   530     if (iAppUi->StatusPane())
       
   531         {
       
   532         iAppUi->StatusPane()->SwitchLayoutL(aResourceId);
       
   533         }
       
   534     }
       
   535     
       
   536 void CAknCapServer::BlankScreenL()
       
   537     {
       
   538     EnsureAppUiValidityL(); 
       
   539     iAppUi->BlankScreenL(ETrue);
       
   540     }
       
   541     
       
   542 void CAknCapServer::UnblankScreenL()
       
   543     {
       
   544     EnsureAppUiValidityL(); 
       
   545     iAppUi->BlankScreenL(EFalse);
       
   546     }
       
   547 
       
   548 CAknCapServer::~CAknCapServer()
       
   549     {
       
   550     delete iDynamicSoftNoteEventManager;
       
   551     delete iShutdown;
       
   552     iLibrary.Close();
       
   553     delete iLongTapAnimation;
       
   554     }
       
   555 
       
   556 void CAknCapServer::ShutdownAppsL(const RMessage2& aMessage)
       
   557     {
       
   558     delete iShutdown;
       
   559     iShutdown = 0;
       
   560     iShutdown = new(ELeave) CAknCapServerShutdown;
       
   561     iShutdown->ConstructL();
       
   562 
       
   563     TUid uid = { aMessage.Int0() };
       
   564     TInt timeout = aMessage.Int1();
       
   565     iShutdown->ShutdownAppsL(uid, aMessage, timeout);
       
   566     }
       
   567     
       
   568 void CAknCapServer::CancelShutdownAppsL()
       
   569     {
       
   570     if (iShutdown)
       
   571         {
       
   572         iShutdown->CancelShutdownAppsL();
       
   573         }
       
   574     }
       
   575 
       
   576 // For applications that do not have CCoeAppUI ready or available.
       
   577 void CAknCapServer::CreateActivateViewL(const RMessage2& aMessage)
       
   578     {
       
   579     EnsureAppUiValidityL(); 
       
   580     TInt messageLength = aMessage.GetDesLengthL(3);
       
   581     TInt appUid = aMessage.Int0();
       
   582     TInt viewUid = aMessage.Int1();
       
   583     TInt customUid = aMessage.Int2(); 
       
   584     if (messageLength > 0)
       
   585         {
       
   586         HBufC8* buf = HBufC8::NewLC(messageLength);        
       
   587         TPtr8 ptr = buf->Des();
       
   588         aMessage.ReadL(3, ptr);
       
   589         
       
   590         iAppUi->CreateActivateViewEventL(
       
   591             TVwsViewId(TUid::Uid(appUid), TUid::Uid(viewUid)),
       
   592             TUid::Uid(customUid),
       
   593             *buf);
       
   594             
       
   595         CleanupStack::PopAndDestroy();
       
   596         }
       
   597     else
       
   598         {
       
   599         iAppUi->CreateActivateViewEventL(
       
   600             TVwsViewId(TUid::Uid(appUid),TUid::Uid(viewUid)),
       
   601             TUid::Uid(customUid),
       
   602             KNullDesC8());        
       
   603         }
       
   604     aMessage.Complete(KErrNone);
       
   605     }
       
   606 
       
   607 void CAknCapServer::SetCurrentAppStatuspaneResourceIdL(TInt aResourceId)
       
   608     {
       
   609     EnsureAppUiValidityL(); 
       
   610     iAppUi->SetCurrentAppStatuspaneResourceIdL(aResourceId);
       
   611     }
       
   612 
       
   613 TInt CAknCapServer::CurrentAppStatuspaneResourceIdL()
       
   614     {
       
   615     EnsureAppUiValidityL(); 
       
   616     return iAppUi->CurrentAppStatuspaneResourceIdL();
       
   617     }
       
   618 
       
   619 void CAknCapServer::SetFgSpDataSubscriberIdL(TInt aId)
       
   620     {
       
   621     EnsureAppUiValidityL(); 
       
   622     iAppUi->SetFgSpDataSubscriberIdL(aId);
       
   623     }
       
   624 
       
   625 void CAknCapServer::RotateScreenL()
       
   626     {
       
   627     iAppUi->RotateScreenL();
       
   628     }
       
   629 
       
   630 void CAknCapServer::DoAskAppsKeyStatusL(const RMessage2& aMessage)
       
   631     {
       
   632     EnsureAppUiValidityL();
       
   633     aMessage.Complete(iAppUi->IsAppsKeySuppressed());    
       
   634     }           
       
   635 
       
   636 void CAknCapServer::ShowLongTapAnimationL( const TInt aX, const TInt aY )
       
   637     {    
       
   638     if ( !iLongTapAnimation )
       
   639         {
       
   640         iLongTapAnimation = CAknLongTapAnimation::NewL();
       
   641         }
       
   642     iLongTapAnimation->ShowAnimationL( aX, aY );
       
   643     }
       
   644 
       
   645 void CAknCapServer::HideLongTapAnimation()
       
   646     {
       
   647     if ( iLongTapAnimation )
       
   648         {
       
   649         iLongTapAnimation->HideAnimation();
       
   650         }
       
   651     }
       
   652 void CAknCapServer::GetAliasKeyCodeL(TUint& aCode, const TKeyEvent& aKeyEvent, TEventCode aType)
       
   653     {
       
   654     EnsureAppUiValidityL();
       
   655     iAppUi->GetAliasKeyCodeL(aCode,aKeyEvent,aType);
       
   656     }
       
   657 
       
   658 void CAknCapServer::GetPhoneIdleViewId( TVwsViewId& aViewId )
       
   659     {
       
   660     AknDef::GetPhoneIdleViewId( aViewId );
       
   661     }
       
   662 
       
   663 void CAknCapServer::RefreshLongTapAnimation()
       
   664     {
       
   665     delete iLongTapAnimation;
       
   666     iLongTapAnimation = NULL;
       
   667     }
       
   668     
       
   669 void CAknCapServer::CreateDynamicSoftNoteEventManagerL()
       
   670     {
       
   671     if(!iDynamicSoftNoteEventManager)
       
   672         {
       
   673         iDynamicSoftNoteEventManager = CAknDynamicSoftNoteEventManager::CreateUniqueInstanceL();
       
   674         }
       
   675     }
       
   676     
       
   677 CAknDynamicSoftNoteEventManager* CAknCapServer::DynamicSoftNoteEventManager()
       
   678     {
       
   679     return iDynamicSoftNoteEventManager;
       
   680     }
       
   681 
       
   682 // End of file