equal
deleted
inserted
replaced
189 { |
189 { |
190 TBitFlags32 flags( aFeature.FeatureFlags() ); |
190 TBitFlags32 flags( aFeature.FeatureFlags() ); |
191 flags.Set( EFeatureRuntime ); |
191 flags.Set( EFeatureRuntime ); |
192 |
192 |
193 //Check the feature falg is valid |
193 //Check the feature falg is valid |
194 TRAP(err, err = ValidateRuntimeFeatureFlagL(flags)); |
194 TRAP(err,ValidateRuntimeFeatureFlagL(flags)); |
195 if (err != KErrNone) |
195 if (err != KErrNone) |
196 return err; |
196 return err; |
197 |
197 |
198 TFeatureServerEntry entry( aFeature.FeatureUid(), flags, aFeature.FeatureData() ); |
198 TFeatureServerEntry entry( aFeature.FeatureUid(), flags, aFeature.FeatureData() ); |
199 err = iFeatureList.InsertInOrder( entry, FindByUid ); |
199 err = iFeatureList.InsertInOrder( entry, FindByUid ); |
605 TInt err( KErrNone ); |
605 TInt err( KErrNone ); |
606 TRAP( err, ReadFileL( path ) ); |
606 TRAP( err, ReadFileL( path ) ); |
607 |
607 |
608 if ((err == KErrCorrupt) || (err == KErrArgument)) |
608 if ((err == KErrCorrupt) || (err == KErrArgument)) |
609 { |
609 { |
610 iFs.Delete(path); |
610 User::LeaveIfError(iFs.Delete(path)); |
611 aFeaturesReady = ETrue; |
611 aFeaturesReady = ETrue; |
612 } |
612 } |
613 else if ( err != KErrNone && err != KErrNotFound && err != KErrPathNotFound ) |
613 else if ( err != KErrNone && err != KErrNotFound && err != KErrPathNotFound ) |
614 { |
614 { |
615 ERROR_LOG1( "CFeatMgrFeatureRegistry::ReadRuntimeFeatures - ReadFileL returned err %d", err ); |
615 ERROR_LOG1( "CFeatMgrFeatureRegistry::ReadRuntimeFeatures - ReadFileL returned err %d", err ); |
864 User::LeaveIfError( writeStream.Create( iFs, path, EFileWrite ) ); |
864 User::LeaveIfError( writeStream.Create( iFs, path, EFileWrite ) ); |
865 |
865 |
866 // Write header and entry |
866 // Write header and entry |
867 RFeatureServerArray temp(1); |
867 RFeatureServerArray temp(1); |
868 CleanupClosePushL( temp ); |
868 CleanupClosePushL( temp ); |
869 temp.Append( aFeature ); |
869 temp.AppendL( aFeature ); |
870 WriteHeaderAndEntriesL( writeStream, temp ); |
870 WriteHeaderAndEntriesL( writeStream, temp ); |
871 CleanupStack::PopAndDestroy( &temp ); |
871 CleanupStack::PopAndDestroy( &temp ); |
872 CleanupStack::PopAndDestroy( &writeStream ); |
872 CleanupStack::PopAndDestroy( &writeStream ); |
873 } |
873 } |
874 else if( err == KErrNone ) |
874 else if( err == KErrNone ) |
959 aStream.WriteUint32L( 0 ); |
959 aStream.WriteUint32L( 0 ); |
960 for(TInt i = 0; i < count; i++) |
960 for(TInt i = 0; i < count; i++) |
961 { |
961 { |
962 aArray[i].ExternalizeL( aStream ); |
962 aArray[i].ExternalizeL( aStream ); |
963 } |
963 } |
|
964 aStream.CommitL(); |
964 } |
965 } |
965 |
966 |
966 // ----------------------------------------------------------------------------- |
967 // ----------------------------------------------------------------------------- |
967 // CFeatMgrFeatureRegistry::MergePluginFeatures |
968 // CFeatMgrFeatureRegistry::MergePluginFeatures |
968 // ----------------------------------------------------------------------------- |
969 // ----------------------------------------------------------------------------- |
969 // |
970 // |
970 void CFeatMgrFeatureRegistry::MergePluginFeatures( |
971 void CFeatMgrFeatureRegistry::MergePluginFeaturesL( |
971 RArray<FeatureInfoCommand::TFeature>& aList ) |
972 RArray<FeatureInfoCommand::TFeature>& aList ) |
972 { |
973 { |
973 FUNC_LOG |
974 FUNC_LOG |
974 |
975 |
975 TInt count = aList.Count(); |
976 TInt count = aList.Count(); |
1004 // Insert new entry in array |
1005 // Insert new entry in array |
1005 TFeatureServerEntry newFeature( uid, flags, KDefaultData ); |
1006 TFeatureServerEntry newFeature( uid, flags, KDefaultData ); |
1006 TInt err = iFeatureList.InsertInOrder( newFeature, FindByUid ); |
1007 TInt err = iFeatureList.InsertInOrder( newFeature, FindByUid ); |
1007 INFO_LOG2( "CFeatMgrFeatureRegistry::MergePluginFeatures - 0x%08x insert result %d", |
1008 INFO_LOG2( "CFeatMgrFeatureRegistry::MergePluginFeatures - 0x%08x insert result %d", |
1008 newFeature.FeatureUid().iUid, err ); |
1009 newFeature.FeatureUid().iUid, err ); |
|
1010 User::LeaveIfError(err); |
1009 } |
1011 } |
1010 } |
1012 } |
1011 } |
1013 } |
1012 |
1014 |
1013 // ----------------------------------------------------------------------------- |
1015 // ----------------------------------------------------------------------------- |
1014 // CFeatMgrFeatureRegistry::MergePluginFeatures |
1016 // CFeatMgrFeatureRegistry::MergePluginFeatures |
1015 // ----------------------------------------------------------------------------- |
1017 // ----------------------------------------------------------------------------- |
1016 // |
1018 // |
1017 void CFeatMgrFeatureRegistry::MergePluginFeatures( RFeatureArray& aList ) |
1019 void CFeatMgrFeatureRegistry::MergePluginFeaturesL( RFeatureArray& aList ) |
1018 { |
1020 { |
1019 FUNC_LOG |
1021 FUNC_LOG |
1020 |
1022 |
1021 TInt count = aList.Count(); |
1023 TInt count = aList.Count(); |
1022 |
1024 |
1046 // Insert new entry in array |
1048 // Insert new entry in array |
1047 TFeatureServerEntry newFeature( uid, aList[i].FeatureFlags(), aList[i].FeatureData() ); |
1049 TFeatureServerEntry newFeature( uid, aList[i].FeatureFlags(), aList[i].FeatureData() ); |
1048 TInt err = iFeatureList.InsertInOrder( newFeature, FindByUid ); |
1050 TInt err = iFeatureList.InsertInOrder( newFeature, FindByUid ); |
1049 INFO_LOG2( "CFeatMgrFeatureRegistry::MergePluginFeatures - 0x%08x insert result %d", |
1051 INFO_LOG2( "CFeatMgrFeatureRegistry::MergePluginFeatures - 0x%08x insert result %d", |
1050 newFeature.FeatureUid().iUid, err ); |
1052 newFeature.FeatureUid().iUid, err ); |
|
1053 User::LeaveIfError(err); |
1051 } |
1054 } |
1052 } |
1055 } |
1053 } |
1056 } |
1054 |
1057 |
1055 // ----------------------------------------------------------------------------- |
1058 // ----------------------------------------------------------------------------- |
1105 * for the ffs. |
1108 * for the ffs. |
1106 * This does not validate the dsr ranges. |
1109 * This does not validate the dsr ranges. |
1107 * The following are the rules to check for errors in the run time defined feature flags |
1110 * The following are the rules to check for errors in the run time defined feature flags |
1108 * Rule 1)Blacklisting of a run-time defined feature flag is an error |
1111 * Rule 1)Blacklisting of a run-time defined feature flag is an error |
1109 * Rule 2)Un-initialised feature flag should be modifiable. |
1112 * Rule 2)Un-initialised feature flag should be modifiable. |
1110 * Funtion returns KErrArgument if a rule is broken otherwise KErrNone |
|
1111 */ |
1113 */ |
1112 TInt CFeatMgrFeatureRegistry::ValidateRuntimeFeatureFlagL(TBitFlags32 aFlags) |
1114 void CFeatMgrFeatureRegistry::ValidateRuntimeFeatureFlagL(TBitFlags32 aFlags) |
1113 { |
1115 { |
1114 |
1116 |
1115 //Rule 1 (Blacklisting of run-time defined feature aFlags is not allowed) |
1117 //Rule 1 (Blacklisting of run-time defined feature aFlags is not allowed) |
1116 if(aFlags.IsSet(EFeatureBlackListed) ) |
1118 if(aFlags.IsSet(EFeatureBlackListed) ) |
1117 { |
1119 { |
1123 if(!aFlags.IsSet(EFeatureModifiable) && aFlags.IsSet(EFeatureUninitialized) ) |
1125 if(!aFlags.IsSet(EFeatureModifiable) && aFlags.IsSet(EFeatureUninitialized) ) |
1124 { |
1126 { |
1125 //error |
1127 //error |
1126 User::Leave( KErrArgument ); |
1128 User::Leave( KErrArgument ); |
1127 } |
1129 } |
1128 |
|
1129 return KErrNone; |
|
1130 } |
1130 } |
1131 |
1131 |
1132 |
1132 |
1133 /** |
1133 /** |
1134 * After restore, some features might have changed. This function will examine |
1134 * After restore, some features might have changed. This function will examine |
1135 * the differences between the old feature set and the newly restored feature set |
1135 * the differences between the old feature set and the newly restored feature set |
1136 * to discover if any changes have taken place: then it will handle the required |
1136 * to discover if any changes have taken place: then it will handle the required |
1137 * notifications for new, deleted and changed featuers. |
1137 * notifications for new, deleted and changed featuers. |
1138 */ |
1138 */ |
1139 TInt CFeatMgrFeatureRegistry::HandleRestoredFeatureNotificationsL( void ) |
1139 void CFeatMgrFeatureRegistry::HandleRestoredFeatureNotificationsL() |
1140 { |
1140 { |
1141 // All comparisons are between the new list iFeatureList and the old list iFeatureListBackup |
1141 // All comparisons are between the new list iFeatureList and the old list iFeatureListBackup |
1142 TInt new_count = iFeatureList.Count(); |
1142 TInt new_count = iFeatureList.Count(); |
1143 TInt old_count = iFeatureListBackup.Count(); |
1143 TInt old_count = iFeatureListBackup.Count(); |
1144 |
1144 |
1159 |
1159 |
1160 // KErrNotFound, if no matching object can be found |
1160 // KErrNotFound, if no matching object can be found |
1161 if( KErrNotFound == index ) |
1161 if( KErrNotFound == index ) |
1162 { |
1162 { |
1163 // Recently added feature |
1163 // Recently added feature |
1164 added.Append( iFeatureList[i] ); |
1164 added.AppendL( iFeatureList[i] ); |
1165 } |
1165 } |
1166 else |
1166 else |
1167 { |
1167 { |
1168 // Get the features in iFeatureList that have recently been altered |
1168 // Get the features in iFeatureList that have recently been altered |
1169 TFeatureServerEntry old_item = iFeatureListBackup[index]; |
1169 TFeatureServerEntry old_item = iFeatureListBackup[index]; |
1175 // if any thing has changed, then add it to our list. |
1175 // if any thing has changed, then add it to our list. |
1176 // there is no != overload for TBitFlags32 |
1176 // there is no != overload for TBitFlags32 |
1177 if( !( old_flags == new_flags) || !( old_data == new_data) ) |
1177 if( !( old_flags == new_flags) || !( old_data == new_data) ) |
1178 { |
1178 { |
1179 // changed in the "new" iFeatureList array |
1179 // changed in the "new" iFeatureList array |
1180 changed.Append( iFeatureList[i] ); |
1180 changed.AppendL( iFeatureList[i] ); |
1181 } |
1181 } |
1182 } |
1182 } |
1183 |
1183 |
1184 } // end if ! EFeatureRuntime |
1184 } // end if ! EFeatureRuntime |
1185 } // end loop |
1185 } // end loop |
1197 |
1197 |
1198 // KErrNotFound, if no matching object can be found |
1198 // KErrNotFound, if no matching object can be found |
1199 if( KErrNotFound == index ) |
1199 if( KErrNotFound == index ) |
1200 { |
1200 { |
1201 // Recently removed feature |
1201 // Recently removed feature |
1202 removed.Append( iFeatureListBackup[i] ); |
1202 removed.AppendL( iFeatureListBackup[i] ); |
1203 } |
1203 } |
1204 // the else has already been completed in previous loop |
1204 // the else has already been completed in previous loop |
1205 |
1205 |
1206 } // end if ! EFeatureRuntime |
1206 } // end if ! EFeatureRuntime |
1207 } // end loop |
1207 } // end loop |
1231 { |
1231 { |
1232 TFeatureServerEntry entry( removed[i].FeatureUid(), removed[i].FeatureFlags(), removed[i].FeatureData() ); |
1232 TFeatureServerEntry entry( removed[i].FeatureUid(), removed[i].FeatureFlags(), removed[i].FeatureData() ); |
1233 TFeatureChangeType changeType( EFeatureFeatureDeleted ); |
1233 TFeatureChangeType changeType( EFeatureFeatureDeleted ); |
1234 iObserver.HandleFeatureChange( entry, changeType ); |
1234 iObserver.HandleFeatureChange( entry, changeType ); |
1235 } |
1235 } |
1236 |
|
1237 return( 0 ); |
|
1238 } |
1236 } |
1239 |
1237 |
1240 // ----------------------------------------------------------------------------- |
1238 // ----------------------------------------------------------------------------- |
1241 // CFeatMgrFeatureRegistry::SWIStart |
1239 // CFeatMgrFeatureRegistry::SWIStart |
1242 // ----------------------------------------------------------------------------- |
1240 // ----------------------------------------------------------------------------- |