14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 #include <s32mem.h> |
17 #include <s32mem.h> |
18 |
18 |
|
19 #include "tsresourcemanager.h" |
19 #include "tswindowgroupsmonitor.h" |
20 #include "tswindowgroupsmonitor.h" |
20 #include "tsrunningapp.h" |
21 #include "tsrunningapp.h" |
21 #include "tsrunningappstorage.h" |
22 #include "tsrunningappstorage.h" |
22 #include "tsscreenshotprovider.h" |
23 #include "tsscreenshotprovider.h" |
23 #include "tstaskmonitorglobals.h" |
24 #include "tstaskmonitorglobals.h" |
24 #include "tsscreenshotmsg.h" |
25 #include "tsscreenshotmsg.h" |
25 #include "tsidlist.h" |
26 #include "tsidlist.h" |
26 |
27 |
27 |
28 |
28 const TUid KPluginUID = {0x200267AE}; |
29 const TUid KPluginUID = {0x200267AE}; |
29 const TInt KSkippedApp [] = {0x20022F35 /* <-- hsapplication */, |
|
30 0x100058F3 /* <-- sysapp*/}; |
|
31 // ----------------------------------------------------------------------------- |
30 // ----------------------------------------------------------------------------- |
32 // |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 CTsScreenshotProvider* CTsScreenshotProvider::NewL( MTsDataStorage& aStorage, |
31 CTsScreenshotProvider* CTsScreenshotProvider::NewL( MTsDataStorage& aStorage, |
36 MTsWindowGroupsMonitor& aMonitor) |
32 MTsWindowGroupsMonitor& aMonitor) |
37 { |
33 { |
38 CTsScreenshotProvider *self = new (ELeave)CTsScreenshotProvider(aStorage, aMonitor); |
34 CTsScreenshotProvider *self = new (ELeave)CTsScreenshotProvider(aStorage, aMonitor); |
39 CleanupStack::PushL( self ); |
35 CleanupStack::PushL( self ); |
81 * and send it to module responsible for screenshot taking. |
77 * and send it to module responsible for screenshot taking. |
82 * Interface implementation. |
78 * Interface implementation. |
83 * @see MTsWindowGroupsObserver::HandleWindowGroupChangedL |
79 * @see MTsWindowGroupsObserver::HandleWindowGroupChangedL |
84 */ |
80 */ |
85 void CTsScreenshotProvider::HandleWindowGroupChangedL( |
81 void CTsScreenshotProvider::HandleWindowGroupChangedL( |
86 MTsResourceManager& /*aResources*/, |
82 MTsResourceManager& aResources, |
87 const MTsRunningApplicationStorage& aStorage) |
83 const MTsRunningApplicationStorage& aStorage) |
88 { |
84 { |
89 const TInt count(sizeof( KSkippedApp ) / sizeof(TInt)); |
85 |
90 CTsIdList* list = CTsIdList::NewLC(); |
86 CTsIdList* list = CTsIdList::NewLC(); |
91 for( TInt allowed(0); allowed < aStorage.Count(); ++allowed ) |
87 for( TInt allowed(0); allowed < aStorage.Count(); ++allowed ) |
92 { |
88 { |
93 if(!aStorage[allowed].IsHiddenL()) |
89 if(!IsBlocked(aResources, aStorage[allowed])) |
94 { |
90 { |
95 TBool isBlocked(EFalse); |
91 list->AppendL(aStorage[allowed].WindowGroupId()); |
96 for( TInt blocked(0); !isBlocked && blocked < count; ++blocked ) |
|
97 { |
|
98 isBlocked = (KSkippedApp[blocked] == aStorage[allowed].UidL().iUid); |
|
99 } |
|
100 if(!isBlocked) |
|
101 { |
|
102 list->AppendL(aStorage[allowed].WindowGroupId()); |
|
103 } |
|
104 } |
92 } |
105 } |
93 } |
106 if( *iCache != *list ) |
94 if( *iCache != *list ) |
107 { |
95 { |
108 RBuf8 message; |
96 SendWhiteListL(*list); |
109 CleanupClosePushL(message); |
|
110 message.CreateL(list->Size() + sizeof(TInt)); |
|
111 |
|
112 RDesWriteStream stream; |
|
113 CleanupClosePushL(stream); |
|
114 stream.Open(message); |
|
115 stream.WriteInt32L(AllowedWindowGroups); |
|
116 stream << (*list); |
|
117 CleanupStack::PopAndDestroy(&stream); |
|
118 |
|
119 SendMessage(message); |
|
120 CleanupStack::PopAndDestroy(&message); |
|
121 } |
97 } |
122 delete iCache; |
98 delete iCache; |
123 iCache = list; |
99 iCache = list; |
124 CleanupStack::Pop(list); |
100 CleanupStack::Pop(list); |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 TBool CTsScreenshotProvider::IsBlocked(const MTsResourceManager& aResources, |
|
105 const MTsRunningApplication& aApp) const |
|
106 { |
|
107 return MTsRunningApplication::System == aApp.HideMode() || |
|
108 aResources.ApplicationsBlackList().IsPresent(aApp.Uid().iUid); |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 void CTsScreenshotProvider::SendWhiteListL(const CTsIdList& aList) |
|
113 { |
|
114 RBuf8 message; |
|
115 CleanupClosePushL(message); |
|
116 message.CreateL(aList.Size() + sizeof(TInt)); |
|
117 |
|
118 RDesWriteStream stream; |
|
119 CleanupClosePushL(stream); |
|
120 stream.Open(message); |
|
121 stream.WriteInt32L(AllowedWindowGroups); |
|
122 stream << aList; |
|
123 CleanupStack::PopAndDestroy(&stream); |
|
124 |
|
125 SendMessage(message); |
|
126 CleanupStack::PopAndDestroy(&message); |
125 } |
127 } |
126 |
128 |
127 // ----------------------------------------------------------------------------- |
129 // ----------------------------------------------------------------------------- |
128 void CTsScreenshotProvider::HandleMessage( const TDesC8& aMsg ) |
130 void CTsScreenshotProvider::HandleMessage( const TDesC8& aMsg ) |
129 { |
131 { |