taskswitcher/server/src/tsscreenshotprovider.cpp
changeset 125 26079c1bb561
parent 119 50e220be30d1
child 127 7b66bc3c6dc9
equal deleted inserted replaced
123:d1dadafc5584 125:26079c1bb561
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 #include <s32mem.h>
    17 #include <s32mem.h>
    18 
    18 
       
    19 #include "tswindowgroupsmonitor.h"
       
    20 #include "tsrunningapp.h"
       
    21 #include "tsrunningappstorage.h"
    19 #include "tsscreenshotprovider.h"
    22 #include "tsscreenshotprovider.h"
    20 #include "tstaskmonitorglobals.h"
    23 #include "tstaskmonitorglobals.h"
    21 #include "tsscreenshotmsg.h"
    24 #include "tsscreenshotmsg.h"
    22 #include "tsidlist.h"
    25 #include "tsidlist.h"
    23 
    26 
    24 
    27 
    25 const TUid KPluginUID = {0x200267AE};
    28 const TUid KPluginUID = {0x200267AE};
    26 const TInt KSkippedApp [] = {0x20022F35 /* <-- hsapplication */};
    29 const TInt KSkippedApp [] = {0x20022F35 /* <-- hsapplication */,
       
    30                              0x100058F3 /* <-- sysapp*/};
    27 // -----------------------------------------------------------------------------
    31 // -----------------------------------------------------------------------------
    28 //
    32 //
    29 // -----------------------------------------------------------------------------
    33 // -----------------------------------------------------------------------------
    30 //
    34 //
    31 CTsScreenshotProvider* CTsScreenshotProvider::NewL( MTsDataStorage& aStorage,
    35 CTsScreenshotProvider* CTsScreenshotProvider::NewL( MTsDataStorage& aStorage,
    32                                                     MTsWindowGroupsMonitor& aMonitor)
    36                                                     MTsWindowGroupsMonitor& aMonitor)
    33     {
    37     {
    34     CTsScreenshotProvider *self = new (ELeave)CTsScreenshotProvider(aStorage, aMonitor);
    38     CTsScreenshotProvider *self = new (ELeave)CTsScreenshotProvider(aStorage, aMonitor);
    35     CleanupStack::PushL( self );
    39     CleanupStack::PushL( self );
    36     self->BaseConstructL(KPluginUID, KNullDesC8);
    40     self->ConstructL();
    37     aMonitor.SubscribeL(*self);
       
    38     CleanupStack::Pop( self );
    41     CleanupStack::Pop( self );
    39     return self;
    42     return self;
    40     }
    43     }
    41 
    44 
    42 // -----------------------------------------------------------------------------
    45 // -----------------------------------------------------------------------------
    47     iMonitor(aMonitor)
    50     iMonitor(aMonitor)
    48     {
    51     {
    49     //No implementation required
    52     //No implementation required
    50     }
    53     }
    51 
    54 
       
    55 // -----------------------------------------------------------------------------
       
    56 void CTsScreenshotProvider::ConstructL()
       
    57     {
       
    58     BaseConstructL(KPluginUID, KNullDesC8);
       
    59     iCache = CTsIdList::NewL();
       
    60     iMonitor.SubscribeL(*this);
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
    52 CTsScreenshotProvider::~CTsScreenshotProvider()
    64 CTsScreenshotProvider::~CTsScreenshotProvider()
    53     {
    65     {
    54     iMonitor.Cancel(*this);
    66     iMonitor.Cancel(*this);
       
    67     delete iCache;
    55     }
    68     }
    56 
    69 
    57 // -----------------------------------------------------------------------------
    70 // -----------------------------------------------------------------------------
    58 void CTsScreenshotProvider::HandleWindowGroupChanged(
    71 void CTsScreenshotProvider::HandleWindowGroupChanged(
    59                                   MTsResourceManager &aResources, 
    72                                   MTsResourceManager &aResources, 
    73                                    MTsResourceManager& /*aResources*/, 
    86                                    MTsResourceManager& /*aResources*/, 
    74                                    const MTsRunningApplicationStorage& aStorage)
    87                                    const MTsRunningApplicationStorage& aStorage)
    75     {
    88     {
    76     const TInt count(sizeof( KSkippedApp ) / sizeof(TInt));
    89     const TInt count(sizeof( KSkippedApp ) / sizeof(TInt));
    77     CTsIdList* list = CTsIdList::NewLC();
    90     CTsIdList* list = CTsIdList::NewLC();
    78     list->AppendL(aStorage.BlockedWindowGroups());//filtered servers
    91     for( TInt allowed(0); allowed < aStorage.Count(); ++allowed )
    79     for( TInt iter(0); iter < aStorage.Count(); ++iter )
       
    80         {
    92         {
    81         if(aStorage[iter].IsHiddenL())
    93         if(!aStorage[allowed].IsHiddenL())
    82             {
    94             {
    83             list->AppendL(aStorage[iter].WindowGroupId());
    95             TBool isBlocked(EFalse);
    84             }
    96             for( TInt blocked(0); !isBlocked && blocked < count; ++blocked )
    85         else
       
    86             {
       
    87             for(TInt blocked(0); blocked < count; ++blocked)
       
    88                 {
    97                 {
    89                 if(aStorage[iter].UidL().iUid == KSkippedApp[blocked])
    98                 isBlocked = (KSkippedApp[blocked] == aStorage[allowed].UidL().iUid);
    90                     {
    99                 }
    91                     list->AppendL(aStorage[iter].WindowGroupId());
   100             if(!isBlocked)
    92                     }
   101                 {
       
   102                 list->AppendL(aStorage[allowed].WindowGroupId());
    93                 }
   103                 }
    94             }
   104             }
    95         }
   105         }
    96     
   106     if( *iCache != *list )
    97     RBuf8 message;
   107         {
    98     CleanupClosePushL(message);
   108         RBuf8 message;
    99     message.CreateL(list->Size() + sizeof(TInt));
   109         CleanupClosePushL(message);
   100     
   110         message.CreateL(list->Size() + sizeof(TInt));
   101     RDesWriteStream stream;
   111             
   102     CleanupClosePushL(stream);
   112         RDesWriteStream stream;
   103     stream.Open(message);
   113         CleanupClosePushL(stream);
   104     stream.WriteInt32L(IgnoreWindowGroups);
   114         stream.Open(message);
   105     stream << (*list);
   115         stream.WriteInt32L(AllowedWindowGroups);
   106     CleanupStack::PopAndDestroy(&stream);
   116         stream << (*list);
   107     
   117         CleanupStack::PopAndDestroy(&stream);
   108     SendMessage(message);
   118         
   109     CleanupStack::PopAndDestroy(&message);
   119         SendMessage(message);
   110     CleanupStack::PopAndDestroy(list);
   120         CleanupStack::PopAndDestroy(&message);
       
   121         }
       
   122     delete iCache;
       
   123     iCache = list;
       
   124     CleanupStack::Pop(list);
   111     }
   125     }
   112 
   126 
   113 // -----------------------------------------------------------------------------
   127 // -----------------------------------------------------------------------------
   114 void CTsScreenshotProvider::HandleMessage( const TDesC8& aMsg )
   128 void CTsScreenshotProvider::HandleMessage( const TDesC8& aMsg )
   115     {
   129     {