terminalsecurity/SCP/DmEventNotifier/src/JavaApplicationService.cpp
changeset 5 3f7d9dbe57c8
parent 0 b497e44ab2fc
equal deleted inserted replaced
4:958eca8527dd 5:3f7d9dbe57c8
    24 // ---------------------------------------------------------------------------
    24 // ---------------------------------------------------------------------------
    25 // CJavaApplicationService::NewL
    25 // CJavaApplicationService::NewL
    26 // ---------------------------------------------------------------------------
    26 // ---------------------------------------------------------------------------
    27 CJavaApplicationService* CJavaApplicationService::NewL()
    27 CJavaApplicationService* CJavaApplicationService::NewL()
    28     {
    28     {
    29     FLOG(_L("CJavaApplicationService::NewL >>"));
    29     _DMEVNT_DEBUG(_L("CJavaApplicationService::NewL >>"));
    30 
    30 
    31     CJavaApplicationService* self = new (ELeave) CJavaApplicationService(KJavaPSKeyCondition);
    31     CJavaApplicationService* self = new (ELeave) CJavaApplicationService(KJavaPSKeyCondition);
    32     CleanupStack::PushL(self);
    32     CleanupStack::PushL(self);
    33 
    33 
    34     self->ConstructL();
    34     self->ConstructL();
    35 
    35 
    36     CleanupStack::Pop(self);
    36     CleanupStack::Pop(self);
    37     FLOG(_L("CJavaApplicationService::NewL <<"));
    37     _DMEVNT_DEBUG(_L("CJavaApplicationService::NewL <<"));
    38     return self;
    38     return self;
    39     }
    39     }
    40 
    40 
    41 // ---------------------------------------------------------------------------
    41 // ---------------------------------------------------------------------------
    42 // CJavaApplicationService::NewLC
    42 // CJavaApplicationService::NewLC
    43 // ---------------------------------------------------------------------------
    43 // ---------------------------------------------------------------------------
    44 CJavaApplicationService* CJavaApplicationService::NewLC()
    44 CJavaApplicationService* CJavaApplicationService::NewLC()
    45     {
    45     {
    46     FLOG(_L("CJavaApplicationService::NewLC >>"));
    46     _DMEVNT_DEBUG(_L("CJavaApplicationService::NewLC >>"));
    47 
    47 
    48     CJavaApplicationService* self = CJavaApplicationService::NewL();
    48     CJavaApplicationService* self = CJavaApplicationService::NewL();
    49     CleanupStack::PushL(self);
    49     CleanupStack::PushL(self);
    50 
    50 
    51     FLOG(_L("CJavaApplicationService::NewLC <<"));
    51     _DMEVNT_DEBUG(_L("CJavaApplicationService::NewLC <<"));
    52     return self;
    52     return self;
    53     }
    53     }
    54 
    54 
    55 // ---------------------------------------------------------------------------
    55 // ---------------------------------------------------------------------------
    56 // CJavaApplicationService::ConstructL
    56 // CJavaApplicationService::ConstructL
    57 // ---------------------------------------------------------------------------
    57 // ---------------------------------------------------------------------------
    58 void CJavaApplicationService::ConstructL()
    58 void CJavaApplicationService::ConstructL()
    59     {
    59     {
    60     FLOG(_L("CJavaApplicationService::ConstructL >>"));
    60     _DMEVNT_DEBUG(_L("CJavaApplicationService::ConstructL >>"));
    61 
    61 
    62     FLOG(_L("CJavaApplicationService::ConstructL <<"));
    62     _DMEVNT_DEBUG(_L("CJavaApplicationService::ConstructL <<"));
    63     }
    63     }
    64 
    64 
    65 // ---------------------------------------------------------------------------
    65 // ---------------------------------------------------------------------------
    66 // CJavaApplicationService::CJavaApplicationService
    66 // CJavaApplicationService::CJavaApplicationService
    67 // ---------------------------------------------------------------------------
    67 // ---------------------------------------------------------------------------
    68 CJavaApplicationService::CJavaApplicationService(const TPSKeyCondition& aPSKeyCondition):CDmEventServiceBase(aPSKeyCondition, EJavaService)
    68 CJavaApplicationService::CJavaApplicationService(const TPSKeyCondition& aPSKeyCondition):CDmEventServiceBase(aPSKeyCondition, EJavaService)
    69         {
    69         {
    70         FLOG(_L("CJavaApplicationService::CJavaApplicationService >>"));
    70         _DMEVNT_DEBUG(_L("CJavaApplicationService::CJavaApplicationService >>"));
    71 
    71 
    72         FLOG(_L("CJavaApplicationService::CJavaApplicationService <<"));
    72         _DMEVNT_DEBUG(_L("CJavaApplicationService::CJavaApplicationService <<"));
    73         }
    73         }
    74 
    74 
    75 // ---------------------------------------------------------------------------
    75 // ---------------------------------------------------------------------------
    76 // CJavaApplicationService::~CJavaApplicationService
    76 // CJavaApplicationService::~CJavaApplicationService
    77 // ---------------------------------------------------------------------------
    77 // ---------------------------------------------------------------------------
    83 // ---------------------------------------------------------------------------
    83 // ---------------------------------------------------------------------------
    84 // CJavaApplicationService::IsKeyValid
    84 // CJavaApplicationService::IsKeyValid
    85 // ---------------------------------------------------------------------------
    85 // ---------------------------------------------------------------------------
    86 TBool CJavaApplicationService::IsKeyValid()
    86 TBool CJavaApplicationService::IsKeyValid()
    87     {
    87     {
    88     FLOG(_L("CJavaApplicationService::IsKeyValid >>"));
    88     _DMEVNT_DEBUG(_L("CJavaApplicationService::IsKeyValid >>"));
    89     TBool ret (EFalse);
    89     TBool ret (EFalse);
    90     TInt value (KErrNone);
    90     TInt value (KErrNone);
    91 
    91 
    92     //Just read the key to find if it exists
    92     //Just read the key to find if it exists
    93     if (RProperty::Get(KJavaPSKeyCondition.iPskey.iConditionCategory, KJavaPSKeyCondition.iPskey.iConditionKey, value) == KErrNone)
    93     if (RProperty::Get(KJavaPSKeyCondition.iPskey.iConditionCategory, KJavaPSKeyCondition.iPskey.iConditionKey, value) == KErrNone)
    94         ret = ETrue;
    94         ret = ETrue;
    95 
    95 
    96     FLOG(_L("CJavaApplicationService::IsKeyValid, return = %d >>"), ret);
    96     _DMEVNT_DEBUG(_L("CJavaApplicationService::IsKeyValid, return = %d >>"), ret);
    97     return ret;
    97     return ret;
    98     }
    98     }
    99 
    99 
   100 
   100 
   101 // ---------------------------------------------------------------------------
   101 // ---------------------------------------------------------------------------
   102 // CJavaApplicationService::WaitForRequestCompleteL
   102 // CJavaApplicationService::WaitForRequestCompleteL
   103 // ---------------------------------------------------------------------------
   103 // ---------------------------------------------------------------------------
   104 void CJavaApplicationService::WaitForRequestCompleteL()
   104 void CJavaApplicationService::WaitForRequestCompleteL()
   105     {
   105     {
   106     FLOG(_L("CJavaApplicationService::WaitForRequestCompleteL >>"));
   106     _DMEVNT_DEBUG(_L("CJavaApplicationService::WaitForRequestCompleteL >>"));
   107 
   107 
   108     TRequestStatus status (KErrNone);
   108     TRequestStatus status (KErrNone);
   109     RProperty prop;
   109     RProperty prop;
   110     TInt value (KErrNone);
   110     TInt value (KErrNone);
   111 
   111 
   112     iOperation = ENoOpn;
   112     iOperation = ENoOpn;
   113     TPSKey pskey = GetPSKeyCondition().iPskey;
   113     TPSKey pskey = GetPSKeyCondition().iPskey;
   114     do {
   114     do {
   115         FLOG(_L("Waiting for IDLE state..."))
   115         _DMEVNT_DEBUG(_L("Waiting for IDLE state..."))
   116         __LEAVE_IF_ERROR( prop.Attach(pskey.iConditionCategory, pskey.iConditionKey));
   116         __LEAVE_IF_ERROR( prop.Attach(pskey.iConditionCategory, pskey.iConditionKey));
   117     
   117     
   118         prop.Subscribe(status);
   118         prop.Subscribe(status);
   119         User::WaitForRequest(status);
   119         User::WaitForRequest(status);
   120     
   120     
   121         __LEAVE_IF_ERROR( prop.Get(pskey.iConditionCategory, pskey.iConditionKey, value));
   121         __LEAVE_IF_ERROR( prop.Get(pskey.iConditionCategory, pskey.iConditionKey, value));
   122     }while (IsSwInIdle(value));
   122     }while (IsSwInIdle(value));
   123 
   123 
   124     FLOG(_L("CSwApplicationService::WaitForRequestCompleteL >>"));
   124     _DMEVNT_DEBUG(_L("CSwApplicationService::WaitForRequestCompleteL >>"));
   125     }
   125     }
   126 
   126 
   127 // ---------------------------------------------------------------------------
   127 // ---------------------------------------------------------------------------
   128 // CJavaApplicationService::IsSwInIdle
   128 // CJavaApplicationService::IsSwInIdle
   129 // ---------------------------------------------------------------------------
   129 // ---------------------------------------------------------------------------
   130 TBool CJavaApplicationService::IsSwInIdle(TInt aValue)
   130 TBool CJavaApplicationService::IsSwInIdle(TInt aValue)
   131     {
   131     {
   132     FLOG(_L("CJavaApplicationService::IsSwInIdle, value = %d >> "), aValue);
   132     _DMEVNT_DEBUG(_L("CJavaApplicationService::IsSwInIdle, value = %d >> "), aValue);
   133     TBool ret (EFalse);
   133     TBool ret (EFalse);
   134 
   134 
   135     TInt operation(aValue & KJavaOperationMask);
   135     TInt operation(aValue & KJavaOperationMask);
   136     TInt operationStatus(aValue & KJavaStatusMask);
   136     TInt operationStatus(aValue & KJavaStatusMask);
   137 
   137 
   138 
   138 
   139     FLOG(_L("operation %d, status %d"), operation, operationStatus);
   139     _DMEVNT_DEBUG(_L("operation %d, status %d"), operation, operationStatus);
   140 
   140 
   141     if (EJavaStatusSuccess == operationStatus) 
   141     if (EJavaStatusSuccess == operationStatus) 
   142         {
   142         {
   143         switch (operation)
   143         switch (operation)
   144             {
   144             {
   145             case EJavaInstall:
   145             case EJavaInstall:
   146                 {
   146                 {
   147                 FLOG(_L("Uninstallation in progress"));
   147                 _DMEVNT_DEBUG(_L("Uninstallation in progress"));
   148                 iOperation = EOpnInstall;
   148                 iOperation = EOpnInstall;
   149                 }
   149                 }
   150                 break;
   150                 break;
   151             case EJavaUninstall:
   151             case EJavaUninstall:
   152                 {
   152                 {
   153                 FLOG(_L("Restore in progress"));
   153                 _DMEVNT_DEBUG(_L("Restore in progress"));
   154                 iOperation = EOpnUninstall;
   154                 iOperation = EOpnUninstall;
   155                 }
   155                 }
   156                 break;
   156                 break;
   157             default:
   157             default:
   158                 {
   158                 {
   159                 FLOG(_L("Unknown operation"));
   159                 _DMEVNT_DEBUG(_L("Unknown operation"));
   160                 iOperation = EOpnUnknown;
   160                 iOperation = EOpnUnknown;
   161                 }
   161                 }
   162             }
   162             }
   163         }
   163         }
   164 
   164 
   165     ret = (operation != Swi::ESwisNone)? ETrue:EFalse;
   165     ret = (operation != Swi::ESwisNone)? ETrue:EFalse;
   166 
   166 
   167     FLOG(_L("CJavaApplicationService::IsSwInIdle, ret = %d << "),ret);
   167     _DMEVNT_DEBUG(_L("CJavaApplicationService::IsSwInIdle, ret = %d << "),ret);
   168     return ret;
   168     return ret;
   169     }
   169     }
   170 
   170 
   171 // ---------------------------------------------------------------------------
   171 // ---------------------------------------------------------------------------
   172 // CJavaApplicationService::TaskName
   172 // CJavaApplicationService::TaskName