27 #include "WidgetInstaller.h" |
27 #include "WidgetInstaller.h" |
28 #include <libxml2_globals.h> |
28 #include <libxml2_globals.h> |
29 #include <libc/stdlib.h> |
29 #include <libc/stdlib.h> |
30 #include <libxml2_parser.h> |
30 #include <libxml2_parser.h> |
31 #include <libxml2_tree.h> |
31 #include <libxml2_tree.h> |
32 #include "WidgetMMCHandler.h" |
|
33 #include <xmlengxestd.h> |
32 #include <xmlengxestd.h> |
34 #include "UidAllocator.h" |
33 #include "UidAllocator.h" |
35 #if defined( BRDO_WRT_SECURITY_MGR_FF ) |
34 #if defined( BRDO_WRT_SECURITY_MGR_FF ) |
36 #include <RTSecManager.h> |
35 #include <RTSecManager.h> |
37 #endif |
36 #endif |
132 // ============================================================================ |
131 // ============================================================================ |
133 // Changes the Publish & Subscribe key value |
132 // Changes the Publish & Subscribe key value |
134 // ============================================================================ |
133 // ============================================================================ |
135 // |
134 // |
136 |
135 |
137 void CWidgetRegistry::NotifyWidgetAltered() |
136 static void NotifyWidgetAltered() |
138 { |
137 { |
139 const TUid KMyPropertyCat = { 0x10282E5A }; |
138 const TUid KMyPropertyCat = { 0x10282E5A }; |
140 enum TMyPropertyKeys { EMyPropertyAltered = 110 }; |
139 enum TMyPropertyKeys { EMyPropertyAltered = 110 }; |
141 TInt altered( 1 ); |
140 TInt altered( 1 ); |
142 RProperty::Set( KMyPropertyCat, EMyPropertyAltered , altered ); |
141 RProperty::Set( KMyPropertyCat, EMyPropertyAltered , altered ); |
182 // ============================================================================ |
181 // ============================================================================ |
183 // |
182 // |
184 CWidgetRegistry::~CWidgetRegistry() |
183 CWidgetRegistry::~CWidgetRegistry() |
185 { |
184 { |
186 iEntries.ResetAndDestroy(); |
185 iEntries.ResetAndDestroy(); |
187 iOldEntries.ResetAndDestroy(); |
|
188 iUsedUids.Close(); |
186 iUsedUids.Close(); |
189 // iFs not owned |
187 // iFs not owned |
190 iAppArch.Close(); |
188 iAppArch.Close(); |
191 delete iInstaller; |
189 delete iInstaller; |
192 iLangDirList.ResetAndDestroy(); |
190 iLangDirList.ResetAndDestroy(); |
193 delete iMMCHandler; |
|
194 delete iXmlProcessor; |
191 delete iXmlProcessor; |
|
192 delete iApaAppListNotifier; |
195 iFs.Close(); |
193 iFs.Close(); |
196 LOG_DESTRUCT; |
194 LOG_DESTRUCT; |
197 } |
195 } |
198 |
196 |
199 // ============================================================================ |
197 // ============================================================================ |
250 #endif |
248 #endif |
251 |
249 |
252 LOG1( "ConstructL internalize done, registry count %d", |
250 LOG1( "ConstructL internalize done, registry count %d", |
253 iEntries.Count() ); |
251 iEntries.Count() ); |
254 LOG_CLOSE; |
252 LOG_CLOSE; |
255 iMMCHandler = CWidgetMMCHandler::NewL( *this, iFs ); |
253 iApaAppListNotifier = CApaAppListNotifier::NewL(this,CActive::EPriorityStandard); |
256 iMMCHandler->Start(); |
|
257 } |
254 } |
258 |
255 |
259 // ============================================================================ |
256 // ============================================================================ |
260 // CWidgetRegistry::FetchSecurityPolicyIdL() |
257 // CWidgetRegistry::FetchSecurityPolicyIdL() |
261 // Get policyId from security manager |
258 // Get policyId from security manager |
385 } |
382 } |
386 return -1; |
383 return -1; |
387 } |
384 } |
388 |
385 |
389 // ============================================================================ |
386 // ============================================================================ |
390 // CWidgetRegistry::GetWidgetOldEntry() |
|
391 // Get the widget entry from iOldEntrys array |
|
392 // |
|
393 // @since 3.1 |
|
394 // ============================================================================ |
|
395 // |
|
396 TInt CWidgetRegistry::GetWidgetOldEntry( |
|
397 const TUid& aUid, |
|
398 CWidgetEntry*& aEntry) const |
|
399 { |
|
400 for(TInt i = 0;i < iOldEntries.Count();i++) |
|
401 { |
|
402 CWidgetEntry* entry = iOldEntries[i]; |
|
403 if ( TUid::Uid( (*entry)[EUid] ) == aUid ) |
|
404 { |
|
405 aEntry = entry; |
|
406 return i; |
|
407 } |
|
408 } |
|
409 return -1; |
|
410 } |
|
411 |
|
412 // ============================================================================ |
|
413 // CWidgetRegistry::GetWidgetEntry() |
387 // CWidgetRegistry::GetWidgetEntry() |
414 // Get the widget entry |
388 // Get the widget entry |
415 // |
389 // |
416 // @since 3.1 |
390 // @since 3.1 |
417 // ============================================================================ |
391 // ============================================================================ |
551 aDirtyFlag = EFalse; |
525 aDirtyFlag = EFalse; |
552 |
526 |
553 // internal dirty flag, will be copied to arg dirty flag at |
527 // internal dirty flag, will be copied to arg dirty flag at |
554 // end if no leave occurs |
528 // end if no leave occurs |
555 TBool dirtyFlag = EFalse; |
529 TBool dirtyFlag = EFalse; |
556 |
530 |
557 // Copy the entries so we are able to use them later |
531 // empty the registry |
558 // iOldEntries owns the data and is responcible to ResetAndDestroy() |
532 iEntries.ResetAndDestroy(); |
559 for ( TInt i = 0; i < iEntries.Count(); i++ ) |
|
560 { |
|
561 iOldEntries.Append( iEntries[i] ); |
|
562 } |
|
563 // Only reset here as the iOldEntries owns the data |
|
564 iEntries.Reset(); |
|
565 iUsedUids.Reset(); |
533 iUsedUids.Reset(); |
566 |
534 |
567 CleanupClosePushL( appArchList ); |
535 CleanupClosePushL( appArchList ); |
568 CleanupClosePushL( appArchListFlags ); |
536 CleanupClosePushL( appArchListFlags ); |
569 if ( doConsistency ) |
537 if ( doConsistency ) |
712 AppArchListConsistency( appArchList, appArchListFlags ); |
680 AppArchListConsistency( appArchList, appArchListFlags ); |
713 } |
681 } |
714 CleanupStack::PopAndDestroy( 2, &appArchList );//appArchListFlags, appArchList |
682 CleanupStack::PopAndDestroy( 2, &appArchList );//appArchListFlags, appArchList |
715 |
683 |
716 aDirtyFlag = dirtyFlag; |
684 aDirtyFlag = dirtyFlag; |
717 // Reset and Destroy entries in iOldEntries array |
|
718 iOldEntries.ResetAndDestroy(); |
|
719 LOG1( "Internalize done, dirty flag %d", (TInt)dirtyFlag ); |
685 LOG1( "Internalize done, dirty flag %d", (TInt)dirtyFlag ); |
720 LOG_CLOSE; |
686 LOG_CLOSE; |
721 } |
687 } |
722 |
688 |
723 // ============================================================================ |
689 // ============================================================================ |
744 RFileReadStream readStream; |
710 RFileReadStream readStream; |
745 CleanupClosePushL( readStream ); |
711 CleanupClosePushL( readStream ); |
746 readStream.Attach( file ); |
712 readStream.Attach( file ); |
747 |
713 |
748 TInt error = KErrNone; |
714 TInt error = KErrNone; |
749 TInt entryCount = 0,errorCount =0; |
715 TInt entryCount = 0; |
750 TRAP( error, entryCount = readStream.ReadInt32L() ); |
716 TRAP( error, entryCount = readStream.ReadInt32L() ); |
751 // TODO should limit entryCount to something like 1024 |
717 // TODO should limit entryCount to something like 1024 |
752 // for each entry in the registry file |
718 // for each entry in the registry file |
753 for ( TInt i = 0 ; i < entryCount; i++ ) |
719 for ( TInt i = 0 ; i < entryCount; i++ ) |
754 { |
720 { |
755 CWidgetEntry* entry = CWidgetEntry::NewL(); |
721 CWidgetEntry* entry = CWidgetEntry::NewL(); |
756 // push as delete entry so if we leave it will be handled |
722 CleanupStack::PushL( entry ); |
757 CleanupDeletePushL( entry ); |
723 |
758 // extract one entry |
724 // extract one entry |
759 TRAP( error, |
725 TRAP( error, |
760 entry->InternalizeBinaryL( readStream ) ); |
726 entry->InternalizeBinaryL( readStream ) ); |
761 if ( KErrNone == error ) |
727 if ( KErrNone == error ) |
762 { |
728 { |
796 } |
762 } |
797 LOG2( " entry 0x%x (%d) added to registry", |
763 LOG2( " entry 0x%x (%d) added to registry", |
798 uidInt, uidInt ); |
764 uidInt, uidInt ); |
799 } |
765 } |
800 } |
766 } |
801 else |
|
802 { |
|
803 // Pop and delete the un-needed entry so it is not left behind. |
|
804 errorCount++; |
|
805 CleanupStack::PopAndDestroy( entry ); |
|
806 } |
|
807 } |
767 } |
808 else |
768 else |
809 { |
769 { |
810 // entry error |
770 // entry error |
811 CleanupStack::PopAndDestroy( entry ); |
771 CleanupStack::PopAndDestroy( entry ); |
812 } |
772 } |
813 } // for |
773 } // for |
814 |
774 |
815 CleanupStack::PopAndDestroy( 2, &file ); // readStream, file |
775 CleanupStack::PopAndDestroy( 2, &file ); // readStream, file |
816 if ( errorCount != 0 ) |
|
817 { |
|
818 User::Leave(KErrGeneral); |
|
819 } |
|
820 } |
776 } |
821 |
777 |
822 // ============================================================================ |
778 // ============================================================================ |
823 // CWidgetRegistry::InternalizeXmlL() |
779 // CWidgetRegistry::InternalizeXmlL() |
824 // Read entry info from data file into memory |
780 // Read entry info from data file into memory |
909 aInstalledListForDriveFlags, |
865 aInstalledListForDriveFlags, |
910 aDriveUnit, |
866 aDriveUnit, |
911 aDirtyFlag ); |
867 aDirtyFlag ); |
912 } |
868 } |
913 if ( NULL != entry ) |
869 if ( NULL != entry ) |
914 { |
870 { |
915 CWidgetEntry* entry1 = NULL; |
|
916 TInt uid = (*entry)[EUid]; |
|
917 TInt pos = GetWidgetOldEntry( TUid::Uid( uid ), entry1 ); |
|
918 if ( pos != -1 ) |
|
919 { |
|
920 entry->SetActive((iOldEntries[pos]->ActiveL())); |
|
921 entry->SetFullView((iOldEntries[pos]->GetFullViewState())); |
|
922 entry->SetMiniView((iOldEntries[pos]->GetMiniViewState())); |
|
923 } |
|
924 TRAP( error, InsertL( entry ) ); |
871 TRAP( error, InsertL( entry ) ); |
925 if ( KErrNone != error ) |
872 if ( KErrNone != error ) |
926 { |
873 { |
927 delete entry; |
874 delete entry; |
928 } |
875 } |
2295 TRAP_IGNORE( iInstaller->DeregisterWidgetL( aAppArchList[i] ) ); |
2242 TRAP_IGNORE( iInstaller->DeregisterWidgetL( aAppArchList[i] ) ); |
2296 } |
2243 } |
2297 } |
2244 } |
2298 LOG( "AppArchListConsistency done" ); |
2245 LOG( "AppArchListConsistency done" ); |
2299 } |
2246 } |
|
2247 |
|
2248 void CWidgetRegistry::HandleAppListEvent(TInt aEvent) |
|
2249 { |
|
2250 TBool dirtyFlag = EFalse; |
|
2251 TInt parseError = KErrNone; |
|
2252 // Assume usual case and things are consistent |
|
2253 // and the registry entry file can be parsed and used. |
|
2254 TRAPD( error, InternalizeL( EFalse, |
|
2255 EFalse, |
|
2256 dirtyFlag, |
|
2257 parseError ) ); |
|
2258 if ( KErrNone == error ) |
|
2259 { |
|
2260 // internalize consistency enforcement may have altered registry |
|
2261 if ( dirtyFlag ) |
|
2262 { |
|
2263 TRAP_IGNORE( ExternalizeL(); ); |
|
2264 } |
|
2265 } |
|
2266 } |
2300 // End of File |
2267 // End of File |